Home > functions > gui > brain_file_maker > brain_file_maker_update_ui_state.m

brain_file_maker_update_ui_state

PURPOSE ^

change ui status of brain_file_maker gui

SYNOPSIS ^

function [obj] = brain_file_maker_update_ui_state(obj)

DESCRIPTION ^

 change ui status of brain_file_maker gui
 [USAGE]
    [obj] = brain_file_maker_update_ui_state(<obj>);
 [IN]
    obj : brain_file_maker object
 [OUT]
    obj : brain_file_maker object

 Author: rhayashi
 Created: 2007-07-17

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [obj] = brain_file_maker_update_ui_state(obj)
0002 % change ui status of brain_file_maker gui
0003 % [USAGE]
0004 %    [obj] = brain_file_maker_update_ui_state(<obj>);
0005 % [IN]
0006 %    obj : brain_file_maker object
0007 % [OUT]
0008 %    obj : brain_file_maker object
0009 %
0010 % Author: rhayashi
0011 % Created: 2007-07-17
0012 %
0013 % Copyright (C) 2011, ATR All Rights Reserved.
0014 % License : New BSD License(see VBMEG_LICENSE.txt)
0015 
0016 %
0017 % --- Previous check
0018 %
0019 if ~exist('obj', 'var'), error('obj is a required parameter.'); end
0020 
0021 %
0022 % --- Main Procedure
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 % Processing target filenames
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 % Target file exist flags
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 % -- relation of proj_root
0044 %
0045 if is_proj_root_inputted
0046     enable = 'on';
0047 else
0048     enable = 'off';
0049 end
0050 
0051 % Brain file directory
0052 set(H.brain_dir_push, 'Enable', enable);
0053 set(H.brain_dir_edit, 'Enable', enable);
0054 
0055 % brain file output directory
0056 set(H.brain_file_output_dir_edit, 'Enable', enable);
0057 set(H.brain_file_output_dir_push, 'Enable', enable);
0058 
0059 % 2D button state
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 % 3D button state
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 % -- Job button state
0075 %
0076 
0077 % Smoothing button state
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 % --- make brain files from standard model button state
0088 %
0089 handles = H.make_brain_from_standard_push;
0090 
0091 % Button Visibility
0092 if obj.product_type == 1
0093     set(handles, 'Visible', 'on');
0094 else
0095     set(handles, 'Visible', 'off');
0096 end
0097 % Button state
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 % --- make brain files from mask file button state
0110 %
0111 % Button Visibility
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 % Button state
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 % --- After check
0135 %
0136 if nargout ~= 1
0137     error('function caller should receive obj.');
0138 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005