Home > vbmeg > 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 
0036 switch( hObj )
0037     case H.prjroot_push
0038         dir = dir_dialog(get(H.prjroot_edit, 'String'));
0039         if dir ~= 0
0040             set(H.prjroot_edit, 'String', dir);
0041         end
0042     case H.analyze_push
0043         [dir fname] = vb_file_select({'.nii', '.hdr'}, 'Select MRI file');
0044         if ~isempty(dir)
0045             set(H.analyze_edit, 'String', [dir filesep fname{1}]);
0046         end
0047         pa_brain_util(fig, 'update_output_fname');
0048     case {H.model_brainvoyager_radiobutton, ...
0049           H.model_freesurfer_radiobutton }
0050         group = [H.model_brainvoyager_radiobutton;
0051                  H.model_freesurfer_radiobutton];
0052         set(group, 'Value', 0);
0053         set(hObj, 'Value', 1);
0054         pa_brain_util(fig, 'update_model_type');
0055         pa_brain_util(fig, 'update_exec_push_status');
0056     case H.left_push
0057         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select LH surface file (BrainVoyager)');
0058         if ~isempty(dir)
0059             set(H.left_edit, 'String', [dir filesep fname{1}]);
0060         end
0061         pa_brain_util(fig, 'update_exec_push_status');
0062     case H.right_push
0063         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select RH surface file (BrainVoyager)');
0064         if ~isempty(dir)
0065             set(H.right_edit, 'String', [dir filesep fname{1}]);
0066         end
0067         pa_brain_util(fig, 'update_exec_push_status');
0068     case H.left_inflate_push
0069         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select LH inflate file (BrainVoyager)');
0070         if ~isempty(dir)
0071             set(H.left_inflate_edit, 'String', [dir filesep fname{1}]);
0072         end
0073         pa_brain_util(fig, 'update_exec_push_status');
0074     case H.right_inflate_push
0075         [dir fname] = vb_file_select({define.BV_EXTENSION}, 'Select RH inflate file (BrainVoyager)');
0076         if ~isempty(dir)
0077             set(H.right_inflate_edit, 'String', [dir filesep fname{1}]);
0078         end
0079         pa_brain_util(fig, 'update_exec_push_status');
0080     case H.fs_quick_input_push
0081         pa_brain_input_freesurfer_items(fig);
0082         pa_brain_util(fig, 'update_exec_push_status');
0083     case H.freesurfer_left_push
0084         [dir fname] = vb_file_select({define.FS_BRAIN_EXTENSION}, 'Select LH surface file (FreeSurfer)');
0085         if ~isempty(dir)
0086             set(H.freesurfer_left_edit, 'String', [dir filesep fname{1}]);
0087         end
0088         pa_brain_util(fig, 'update_exec_push_status');
0089     case H.freesurfer_right_push
0090         [dir fname] = vb_file_select({define.FS_BRAIN_EXTENSION}, 'Select RH surface file (FreeSurfer)');
0091         if ~isempty(dir)
0092             set(H.freesurfer_right_edit, 'String', [dir filesep fname{1}]);
0093         end
0094         pa_brain_util(fig, 'update_exec_push_status');
0095     case H.freesurfer_left_inflate_push
0096         [dir fname] = vb_file_select({define.FS_BRAIN_INFLATE_EXTENSION}, 'Select LH inflate file (FreeSurfer)');
0097         if ~isempty(dir)
0098             set(H.freesurfer_left_inflate_edit, 'String', [dir filesep fname{1}]);
0099         end
0100         pa_brain_util(fig, 'update_exec_push_status');
0101     case H.freesurfer_right_inflate_push
0102         [dir fname] = vb_file_select({define.FS_BRAIN_INFLATE_EXTENSION}, 'Select RH inflate file (FreeSurfer)');
0103         if ~isempty(dir)
0104             set(H.freesurfer_right_inflate_edit, 'String', [dir filesep fname{1}]);
0105         end
0106         pa_brain_util(fig, 'update_exec_push_status');
0107     case H.freesurfer_left_curv_push
0108         [dir fname] = vb_file_select({define.FS_CURV_EXTENSION}, 'Select LH curvature file (FreeSurfer)');
0109         if ~isempty(dir)
0110             set(H.freesurfer_left_curv_edit, 'String', [dir filesep fname{1}]);
0111         end
0112         pa_brain_util(fig, 'update_exec_push_status');
0113     case H.freesurfer_right_curv_push
0114         [dir fname] = vb_file_select({define.FS_CURV_EXTENSION}, 'Select RH curvature file (FreeSurfer)');
0115         if ~isempty(dir)
0116             set(H.freesurfer_right_curv_edit, 'String', [dir filesep fname{1}]);
0117         end
0118         pa_brain_util(fig, 'update_exec_push_status');
0119     case H.freesurfer_left_label_push
0120         [dir fname] = vb_file_select({'.cortex.label'}, 'Select Left cortex label file (FreeSurfer)');
0121         if ~isempty(dir)
0122             set(H.freesurfer_left_label_edit, 'String', [dir filesep fname{1}]);
0123         end
0124         pa_brain_util(fig, 'update_exec_push_status');
0125     case H.freesurfer_right_label_push
0126         [dir fname] = vb_file_select({'.cortex.label'}, 'Select Right cortex label file (FreeSurfer)');
0127         if ~isempty(dir)
0128             set(H.freesurfer_right_label_edit, 'String', [dir filesep fname{1}]);
0129         end
0130         pa_brain_util(fig, 'update_exec_push_status');
0131 
0132     case H.freesurfer_left_sphere_push
0133         [dir fname] = vb_file_select({'.sphere.reg.asc'}, 'Select Left sphere file (FreeSurfer)');
0134         if ~isempty(dir)
0135             set(H.freesurfer_left_sphere_edit, 'String', [dir filesep fname{1}]);
0136         end
0137         pa_brain_util(fig, 'update_exec_push_status');
0138     case H.freesurfer_right_sphere_push
0139         [dir fname] = vb_file_select({'.sphere.reg.asc'}, 'Select Right sphere file (FreeSurfer)');
0140         if ~isempty(dir)
0141             set(H.freesurfer_right_sphere_edit, 'String', [dir filesep fname{1}]);
0142         end
0143         pa_brain_util(fig, 'update_exec_push_status');
0144     case H.spm_normalization_file_push
0145         [dir fname] = vb_file_select({'.mat'}, 'Select SPM normalization file');
0146         if ~isempty(dir)
0147             set(H.spm_normalization_file_edit, 'String', [dir filesep fname{1}]);
0148         end
0149         pa_brain_util(fig, 'update_exec_push_status');
0150     case H.save_dir_push
0151         proj_root = get(H.prjroot_edit, 'String');
0152         [dir canceled] = pa_prjdir_select(proj_root);
0153         if ~canceled
0154             set(H.save_dir_edit, 'String', dir);
0155         end
0156         pa_brain_util(fig, 'update_output_fname');
0157     case H.change_output_filename_push
0158         res = inputdlg('', 'New output filename');
0159         if iscell(res) && length(res) >= 1
0160             res = res{1};
0161         end
0162         if ~isempty(res)
0163             data.output_filename = res;
0164             guidata(fig, data);
0165         end
0166         pa_brain_util(fig, 'update_output_fname');
0167     case H.brain_exec_push
0168         pa_brain_util(fig, 'exec_brain');
0169     case H.analyze_edit
0170         pa_brain_util(fig, 'update_output_fname');
0171         pa_brain_util(fig, 'update_exec_push_status');
0172     case {H.freesurfer_left_edit, ...
0173           H.freesurfer_right_edit, ...
0174           H.freesurfer_left_inflate_edit, ...
0175           H.freesurfer_right_inflate_edit, ...
0176           H.freesurfer_left_label_edit, ...
0177           H.freesurfer_right_label_edit, ...
0178           H.freesurfer_left_sphere_edit, ...
0179           H.freesurfer_right_sphere_edit, ...
0180           H.spm_normalization_file_edit}
0181           pa_brain_util(fig, 'update_exec_push_status');
0182     case H.save_dir_edit
0183         pa_brain_util(fig, 'update_output_fname');
0184     case H.brain_parm_push
0185         if ishandle(data.adv_fig)
0186             figure(data.adv_fig);
0187         else
0188             data.adv_fig = pa_brain_parm_gui_create(fig, data.brain_parm);
0189         end
0190     %%%%%%%%%%%%%%%%%%%%%%%%%
0191     % Menu
0192     case {H.figure, H.menu_close}
0193         pa_brain_close(fig);
0194         return;
0195     case H.menu_about_image
0196         vb_browser_show(vb_users_manual_url('MR image preprocessing'));
0197     case H.menu_about_cortical_model
0198         urls = vb_users_manual_url('Cortical surface model');
0199         vb_browser_show(urls{1});
0200     case H.menu_import_cortical_model
0201         urls = vb_users_manual_url('Cortical surface model');
0202         vb_browser_show(urls{2});
0203 end
0204 
0205 % save data
0206 guidata(fig, data);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005