0001 function [obj] = bm_edit_app_update_ui_state(obj)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 if ~exist('obj', 'var'), error('obj is a required parameter.'); end
0017 if ~strcmp(obj.class_type, 'bm_edit_app')
0018 error('class type is invalid.');
0019 end
0020
0021
0022
0023
0024 H = guihandles(obj.h);
0025
0026
0027 all_index = bm_manager_get_bm_list_index(obj.bmm);
0028 selected_index = get(H.brain_model_list_listbox, 'value');
0029 Nselected = length(selected_index);
0030 selected_type_is_all_same = false;
0031 selected_model_info = cell(0);
0032 model_type = [];
0033
0034 if ~isempty(all_index) && Nselected >= 1
0035 selected_model_info = bm_manager_get_model_info(obj.bmm, selected_index);
0036 if Nselected >= 1
0037 model_type = selected_model_info{1}.class_type;
0038 end
0039
0040 for k=1:Nselected
0041 if strcmp(selected_model_info{k}.class_type, model_type)
0042 selected_type_is_all_same = true;
0043 else
0044 selected_type_is_all_same = false;
0045 break;
0046 end
0047 end
0048 end
0049
0050
0051
0052
0053 Import_button_group = [H.brain_file_push;
0054 H.head_file_push;
0055 H.curry_file_push;
0056 H.face_file_push;
0057 H.mask_file_push;
0058 H.spm_norm_file_push];
0059 if length(get(H.analyze_file_edit, 'String')) == 0
0060 set(Import_button_group, 'Enable', 'off');
0061 else
0062 set(Import_button_group, 'Enable', 'on');
0063 end
0064
0065
0066
0067
0068
0069
0070 set(H.view2d_push, 'Enable', 'off');
0071 set(H.view3d_push, 'Enable', 'off');
0072
0073 if ~isempty(all_index)
0074
0075 set(H.view2d_push, 'Enable', 'on');
0076
0077 if selected_type_is_all_same && strcmp(model_type, 'mask_image_data')
0078
0079 set(H.view3d_push, 'Enable', 'off');
0080 else
0081 set(H.view3d_push, 'Enable', 'on');
0082 end
0083 end
0084
0085
0086
0087
0088
0089 set(H.processing_surf_data_menu, 'Enable', 'off');
0090 set(H.processing_mask_data_menu, 'Enable', 'off');
0091
0092 if ~isempty(all_index)
0093 if selected_type_is_all_same && strcmp(model_type, 'surf_data')
0094
0095 set(H.processing_surf_data_menu, 'Enable', 'on');
0096 elseif selected_type_is_all_same && strcmp(model_type, 'mask_image_data')
0097
0098 set(H.processing_mask_data_menu, 'Enable', 'on');
0099 end
0100 end
0101
0102
0103
0104
0105 surf_group = [H.surf_smooth_push;
0106 H.surf_smooth_expand_push;
0107 H.surf_to_filled_mask_push;
0108 H.separate_surf_push;
0109 H.close_surf_push];
0110 mask_group = [H.morphology_operation_push;
0111 H.surf_extract_push];
0112 set(surf_group, 'Enable', 'off');
0113 set(mask_group, 'Enable', 'off');
0114
0115 if ~isempty(all_index)
0116 if selected_type_is_all_same && strcmp(model_type, 'surf_data')
0117 set(surf_group, 'Enable', 'on');
0118
0119
0120 for k=1:length(selected_model_info)
0121 if(selected_model_info{k}.surf_close) == false
0122 set(H.surf_to_filled_mask_push, 'Enable', 'off');
0123 set(H.surf_smooth_expand_push, 'Enable', 'off');
0124 set(H.close_surf_push, 'Enable', 'on');
0125 else
0126 set(H.close_surf_push, 'Enable', 'off');
0127 end
0128 end
0129 elseif selected_type_is_all_same && strcmp(model_type, 'mask_image_data')
0130 set(mask_group, 'Enable', 'on');
0131 end
0132 end
0133
0134
0135
0136
0137
0138 if isempty(all_index)
0139 set(H.rename_push, 'Enable', 'off');
0140 set(H.delete_push, 'Enable', 'off');
0141 else
0142 set(H.rename_push, 'Enable', 'on');
0143 set(H.delete_push, 'Enable', 'on');
0144 end
0145
0146
0147
0148
0149 if selected_type_is_all_same && strcmp(model_type, 'surf_data')
0150 set(H.export_push, 'Enable', 'on');
0151 else
0152 set(H.export_push, 'Enable', 'off');
0153 end
0154
0155
0156
0157 if nargout ~= 1
0158 error('function caller should receive obj.');
0159 end