Home > vbmeg > functions > gui > preAnalysis > fmri > pa_fmri_callback.m

pa_fmri_callback

PURPOSE ^

callback function for fmri gui.

SYNOPSIS ^

function pa_fmri_callback(fig, hObj)

DESCRIPTION ^

 callback function for fmri gui.
 [USAGE]
    pa_fmri_callback(<fig>, <hObj>);
 [IN]
     fig : figure handle of fmri gui.
    hObj : 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_fmri_callback(fig, hObj)
0002 % callback function for fmri gui.
0003 % [USAGE]
0004 %    pa_fmri_callback(<fig>, <hObj>);
0005 % [IN]
0006 %     fig : figure handle of fmri gui.
0007 %    hObj : component handle.
0008 % [OUT]
0009 %    none
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 %
0015 % --- Previous check
0016 %
0017 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0018     error('invalid figure is specified.');
0019 end
0020 if ~exist('hObj', 'var')
0021     error('hObj is a required parameter.');
0022 end
0023 
0024 %
0025 % --- Main Procedure
0026 %
0027 global vbmeg_inst;
0028 define = vbmeg_inst.const;
0029 
0030 % load data(@see pa_fmri_create)
0031 data = guidata(fig);
0032 H = data.H;
0033 
0034 switch( hObj )
0035     case H.prjroot_push
0036         dir = dir_dialog(get(H.prjroot_edit, 'String'));
0037         if dir ~= 0
0038             set(H.prjroot_edit, 'String', dir);
0039         end
0040     case H.spm_push
0041         [dir fname] = vb_file_select({'.mat'}, 'Select SPM result file');
0042         if ~isempty(dir)
0043             spm_result_file = fullfile(dir, fname{1});
0044             pa_fmri_util(fig, 'set_spm_result_file', spm_result_file);
0045             pa_fmri_util(fig, 'update_exec_push_status');
0046         end
0047     case H.spm_normalization_file_push
0048         [dir fname] = vb_file_select({'_sn.mat'}, 'Select SPM normalization file');
0049         if ~isempty(dir)
0050             spm_normalization_file = fullfile(dir, fname{1});
0051             set(H.spm_normalization_file_edit, 'String', spm_normalization_file);
0052             pa_fmri_util(fig, 'update_exec_push_status');
0053         end
0054     case H.spm_mni2subj_radiobutton
0055         pa_fmri_util(fig, 'set_spm_type', 'mni2subj');
0056     case H.spm_mni2mni_radiobutton
0057         pa_fmri_util(fig, 'set_spm_type', 'mni2mni');
0058     case H.spm_subj2subj_radiobutton
0059         pa_fmri_util(fig, 'set_spm_type', 'subj2subj');
0060     case H.postfix_push
0061         res = inputdlg('Input Area/Activity ID Postfix', 'Input', 1, {data.keys_postfix});
0062         if ~(iscell(res) && isempty(res))
0063             data.keys_postfix = res{1};
0064             guidata(fig, data);
0065             spm_result_file = get(H.spm_edit, 'String');
0066             if exist(spm_result_file, 'file') == 2
0067                 pa_fmri_util(fig, 'set_spm_result_file', spm_result_file);
0068                 pa_fmri_util(fig, 'update_exec_push_status');
0069             end
0070         end
0071     case H.brain_push
0072         proj_root = get(H.prjroot_edit, 'String');
0073         [dir fname canceled] = pa_prjfile_select(proj_root, {define.BRAIN_EXTENSION}, 'Select cortical model file');
0074         if ~canceled
0075             brain_file = fullfile(dir, fname{1});
0076             set(H.brain_file_edit, 'String', brain_file);
0077 
0078             area_file = strrep(brain_file, define.BRAIN_EXTENSION, define.AREA_EXTENSION);
0079             act_file  = strrep(brain_file, define.BRAIN_EXTENSION, define.FMRI_EXTENSION);
0080             
0081             area_file_abs = fullfile(proj_root, area_file);
0082             act_file_abs   = fullfile(proj_root, act_file);
0083             if exist(area_file_abs, 'file') == 2
0084                 set(H.area_file_edit, 'String', area_file);
0085             end
0086             if exist(act_file_abs, 'file') == 2
0087                 set(H.act_file_edit,  'String', act_file);
0088             end
0089             pa_fmri_util(fig, 'update_exec_push_status');
0090         end
0091     case H.area_push
0092         proj_root = get(H.prjroot_edit, 'String');
0093         [dir fname canceled] = pa_prjfile_select(proj_root, {define.AREA_EXTENSION}, 'Select cortical area file');
0094         if ~canceled
0095             set(H.area_file_edit, 'String', [dir filesep fname{1}]);
0096             pa_fmri_util(fig, 'update_exec_push_status');
0097         end
0098     case H.act_push
0099         proj_root = get(H.prjroot_edit, 'String');
0100         [dir fname canceled] = pa_prjfile_select(proj_root, {define.FMRI_EXTENSION}, 'Select cortical activity file');
0101         if ~canceled
0102             set(H.act_file_edit, 'String', [dir filesep fname{1}]);
0103             pa_fmri_util(fig, 'update_exec_push_status');
0104         end
0105     case H.exec_push
0106         pa_fmri_util(fig, 'exec_fmri');
0107     case H.brain_file_edit
0108         pa_fmri_util(fig, 'update_exec_push_status');
0109     case H.spm_edit
0110         pa_fmri_util(fig, 'update_exec_push_status');
0111     case H.fmri_parm_push
0112         if ishandle(data.adv_fig)
0113             figure(data.adv_fig);
0114         else
0115             data.adv_fig = pa_fmri_parm_gui_create(fig, data.fmri_parm);
0116         end
0117     %%%%%%%%%%%%%%%%%%%%%%%%%
0118     % Menu
0119     case {H.figure, H.menu_close}
0120         pa_fmri_close(fig);
0121         return;
0122     case H.menu_about_fmri_data
0123         urls = vb_users_manual_url('fMRI data');
0124         vb_browser_show(urls{1});
0125     case H.menu_import_fmri_data
0126         urls = vb_users_manual_url('fMRI data');
0127         vb_browser_show(urls{2});
0128 end
0129 
0130 % save data
0131 guidata(fig, data);

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