0001 function [obj] = brain_file_maker_update_ui_state(obj)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if ~exist('obj', 'var'), error('obj is a required parameter.'); end
0020
0021
0022
0023
0024 H = obj.H;
0025 brain_dir = obj.brain_dir;
0026
0027 is_proj_root_inputted = ~isempty(obj.proj_root) && ...
0028 (exist(obj.proj_root, 'dir') == 7);
0029
0030
0031 brain_file = [obj.proj_root, filesep, obj.brain_file];
0032 area_file = [obj.proj_root, filesep, obj.area_file];
0033 act_file = [obj.proj_root, filesep, obj.act_file];
0034 output_mask_file = [obj.proj_root, filesep, obj.output_mask_file];
0035
0036
0037 brain_file_exist = (exist(brain_file, 'file') == 2);
0038 area_file_exist = (exist(area_file, 'file') == 2);
0039 act_file_exist = (exist(act_file, 'file') == 2);
0040 spm_file_exist = (exist(obj.spm_norm_file, 'file') == 2);
0041
0042
0043
0044
0045 if is_proj_root_inputted
0046 enable = 'on';
0047 else
0048 enable = 'off';
0049 end
0050
0051
0052 set(H.brain_dir_push, 'Enable', enable);
0053 set(H.brain_dir_edit, 'Enable', enable);
0054
0055
0056 set(H.brain_file_output_dir_edit, 'Enable', enable);
0057 set(H.brain_file_output_dir_push, 'Enable', enable);
0058
0059
0060 if brain_file_exist && ~isempty(obj.analyze_info)
0061 set(H.view2d_push, 'Enable', 'on');
0062 else
0063 set(H.view2d_push, 'Enable', 'off');
0064 end
0065
0066
0067 if brain_file_exist
0068 set(H.view3d_push, 'Enable', 'on');
0069 else
0070 set(H.view3d_push, 'Enable', 'off');
0071 end
0072
0073
0074
0075
0076
0077
0078 if ~isempty(obj.analyze_info) && brain_file_exist && ...
0079 area_file_exist && act_file_exist
0080
0081 set(H.make_smoothed_brain_push, 'Enable', 'on');
0082 else
0083 set(H.make_smoothed_brain_push, 'Enable', 'off');
0084 end
0085
0086
0087
0088
0089 handles = H.make_brain_from_standard_push;
0090
0091
0092 if obj.product_type == 1
0093 set(handles, 'Visible', 'on');
0094 else
0095 set(handles, 'Visible', 'off');
0096 end
0097
0098 if ~isempty(obj.output_brain_file) && ~isempty(obj.output_area_file) && ...
0099 ~isempty(obj.output_act_file) && ...
0100 ~isempty(get(obj.H.brain_file_output_filename_edit, 'String')) && ...
0101 spm_file_exist
0102
0103 set(handles, 'Enable', 'on');
0104 else
0105 set(handles, 'Enable', 'off');
0106 end
0107
0108
0109
0110
0111
0112 handles = [H.mask_file_text;
0113 H.make_brain_from_mask_push;
0114 H.output_mask_file_text];
0115 if obj.product_type == 2
0116 set(handles, 'Visible', 'on');
0117 else
0118 set(handles, 'Visible', 'off');
0119 end
0120
0121 if ~isempty(obj.analyze_info) && length(output_mask_file) && ...
0122 ~isempty(obj.output_brain_file) && ~isempty(obj.output_area_file) && ...
0123 ~isempty(obj.output_act_file) && ...
0124 ~isempty(get(obj.H.brain_file_output_filename_edit, 'String')) && ...
0125 spm_file_exist
0126
0127 set(H.make_brain_from_mask_push, 'Enable', 'on');
0128 else
0129 set(H.make_brain_from_mask_push, 'Enable', 'off');
0130 end
0131
0132
0133
0134
0135
0136 if nargout ~= 1
0137 error('function caller should receive obj.');
0138 end