Home > functions > gui > preAnalysis > brain > pa_brain_callback.m

pa_brain_callback

PURPOSE ^

callback function for brain gui.

SYNOPSIS ^

function pa_brain_callback(fig, hObj)

DESCRIPTION ^

 callback function for brain gui.
 [USAGE]
    pa_brain_callback(<fig>, <hObj>);
 [IN]
     fig : figure handle of brain gui.
    hObj : event component handle.
 [OUT]
    none


 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 pa_brain_callback(fig, hObj)
0002 % callback function for brain gui.
0003 % [USAGE]
0004 %    pa_brain_callback(<fig>, <hObj>);
0005 % [IN]
0006 %     fig : figure handle of brain gui.
0007 %    hObj : event component handle.
0008 % [OUT]
0009 %    none
0010 %
0011 %
0012 % Copyright (C) 2011, ATR All Rights Reserved.
0013 % License : New BSD License(see VBMEG_LICENSE.txt)
0014 
0015 %
0016 % --- Previous check
0017 %
0018 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0019     error('invalid figure is specified.');
0020 end
0021 if ~exist('hObj', 'var')
0022     error('hObj is a required parameter.');
0023 end
0024 
0025 %
0026 % --- Main Procedure
0027 %
0028 global vbmeg_inst;
0029 define = vbmeg_inst.const;
0030 
0031 % load data(@see pa_brain_create)
0032 data = guidata(fig);
0033 H = data.H;
0034 
0035 switch( hObj )
0036     case H.prjroot_push
0037         dir = dir_dialog(get(H.prjroot_edit, 'String'));
0038         if dir ~= 0
0039             set(H.prjroot_edit, 'String', dir);
0040         end
0041     case H.analyze_push
0042         [dir fname] = vb_file_select({'.hdr'}, 'Select analyze file');
0043         if ~isempty(dir)
0044             set(H.analyze_edit, 'String', [dir filesep fname{1}]);
0045         end
0046         pa_brain_util(fig, 'update_output_fname');
0047     case {H.model_brainvoyager_radiobutton, ...
0048           H.model_freesurfer_radiobutton }
0049         group = [H.model_brainvoyager_radiobutton;
0050                  H.model_freesurfer_radiobutton];
0051         set(group, 'Value', 0);
0052         set(hObj, 'Value', 1);
0053         pa_brain_util(fig, 'update_model_type');
0054         pa_brain_util(fig, 'update_exec_push_status');
0055     case H.left_push
0056         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select LH surface file (BrainVoyager)');
0057         if ~isempty(dir)
0058             set(H.left_edit, 'String', [dir filesep fname{1}]);
0059         end
0060         pa_brain_util(fig, 'update_exec_push_status');
0061     case H.right_push
0062         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select RH surface file (BrainVoyager)');
0063         if ~isempty(dir)
0064             set(H.right_edit, 'String', [dir filesep fname{1}]);
0065         end
0066         pa_brain_util(fig, 'update_exec_push_status');
0067     case H.left_inflate_push
0068         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select LH inflate file (BrainVoyager)');
0069         if ~isempty(dir)
0070             set(H.left_inflate_edit, 'String', [dir filesep fname{1}]);
0071         end
0072         pa_brain_util(fig, 'update_exec_push_status');
0073     case H.right_inflate_push
0074         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select RH inflate file (BrainVoyager)');
0075         if ~isempty(dir)
0076             set(H.right_inflate_edit, 'String', [dir filesep fname{1}]);
0077         end
0078         pa_brain_util(fig, 'update_exec_push_status');
0079     case H.freesurfer_left_push
0080         [dir fname] = vb_file_select({define.FS_BRAIN_EXTENSION}, 'Select LH surface file (FreeSurfer)');
0081         if ~isempty(dir)
0082             set(H.freesurfer_left_edit, 'String', [dir filesep fname{1}]);
0083         end
0084         pa_brain_util(fig, 'update_exec_push_status');
0085     case H.freesurfer_right_push
0086         [dir fname] = vb_file_select({define.FS_BRAIN_EXTENSION}, 'Select RH surface file (FreeSurfer)');
0087         if ~isempty(dir)
0088             set(H.freesurfer_right_edit, 'String', [dir filesep fname{1}]);
0089         end
0090         pa_brain_util(fig, 'update_exec_push_status');
0091     case H.freesurfer_xml_push
0092         [dir fname] = vb_file_select({define.FS_XFM_EXTENSION}, 'Select transformation file (FreeSurfer)');
0093         if ~isempty(dir)
0094             set(H.freesurfer_xfm_edit, 'String', [dir filesep fname{1}]);
0095         end
0096         pa_brain_util(fig, 'update_exec_push_status');
0097     case H.freesurfer_left_inflate_push
0098         [dir fname] = vb_file_select({define.FS_BRAIN_INFLATE_EXTENSION}, 'Select LH inflate file (FreeSurfer)');
0099         if ~isempty(dir)
0100             set(H.freesurfer_left_inflate_edit, 'String', [dir filesep fname{1}]);
0101         end
0102         pa_brain_util(fig, 'update_exec_push_status');
0103     case H.freesurfer_right_inflate_push
0104         [dir fname] = vb_file_select({define.FS_BRAIN_INFLATE_EXTENSION}, 'Select RH inflate file (FreeSurfer)');
0105         if ~isempty(dir)
0106             set(H.freesurfer_right_inflate_edit, 'String', [dir filesep fname{1}]);
0107         end
0108         pa_brain_util(fig, 'update_exec_push_status');
0109     case H.freesurfer_left_curv_push
0110         [dir fname] = vb_file_select({define.FS_CURV_EXTENSION}, 'Select LH curvature file (FreeSurfer)');
0111         if ~isempty(dir)
0112             set(H.freesurfer_left_curve_edit, 'String', [dir filesep fname{1}]);
0113         end
0114         pa_brain_util(fig, 'update_exec_push_status');
0115     case H.freesurfer_right_curv_push
0116         [dir fname] = vb_file_select({define.FS_CURV_EXTENSION}, 'Select RH curvature file (FreeSurfer)');
0117         if ~isempty(dir)
0118             set(H.freesurfer_right_curv_edit, 'String', [dir filesep fname{1}]);
0119         end
0120         pa_brain_util(fig, 'update_exec_push_status');
0121     case H.spm_normalization_file_push
0122         [dir fname] = vb_file_select({'.mat'}, 'Select SPM normalization file');
0123         if ~isempty(dir)
0124             set(H.spm_normalization_file_edit, 'String', [dir filesep fname{1}]);
0125         end
0126         
0127     case H.save_dir_push
0128         proj_root = get(H.prjroot_edit, 'String');
0129         [dir canceled] = pa_prjdir_select(proj_root);
0130         if ~canceled
0131             set(H.save_dir_edit, 'String', dir);
0132         end
0133         pa_brain_util(fig, 'update_output_fname');
0134     case H.brain_reset_push
0135         pa_brain_util(fig, 'reset_parameter');
0136     case H.brain_exec_push
0137         pa_brain_util(fig, 'exec_brain');
0138     case H.keyword_edit
0139         pa_brain_util(fig, 'update_output_fname');
0140         pa_brain_util(fig, 'update_exec_push_status');
0141     case H.analyze_edit
0142         pa_brain_util(fig, 'update_output_fname');
0143         pa_brain_util(fig, 'update_exec_push_status');
0144     case H.left_edit
0145         pa_brain_util(fig, 'update_exec_push_status');
0146     case H.right_edit
0147         pa_brain_util(fig, 'update_exec_push_status');
0148     case H.left_inflate_edit
0149         pa_brain_util(fig, 'update_exec_push_status');
0150     case H.right_inflate_edit
0151         pa_brain_util(fig, 'update_exec_push_status');
0152     case H.save_dir_edit
0153         pa_brain_util(fig, 'update_output_fname');
0154     case H.keyword_edit
0155         pa_brain_util(fig, 'update_exec_push_status');
0156     case H.brain_parm_push
0157         if ishandle(data.adv_fig)
0158             figure(data.adv_fig);
0159         else
0160             data.adv_fig = pa_brain_parm_gui_create(fig, data.brain_parm);
0161         end
0162 end
0163 
0164 % save data
0165 guidata(fig, data);

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