Home > functions > gui > preAnalysis > fmri > pa_fmri_util.m

pa_fmri_util

PURPOSE ^

This function is subcontracting function of fMRI GUI.

SYNOPSIS ^

function H = pa_fmri_util(fig, command)

DESCRIPTION ^

 This function is subcontracting function of fMRI GUI.
 [USAGE]
    pa_brain_util(<fig>, <command>);
 [IN]
        fig : figure handle of brain gui.
    command : command
 [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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function H = pa_fmri_util(fig, command)
0002 % This function is subcontracting function of fMRI GUI.
0003 % [USAGE]
0004 %    pa_brain_util(<fig>, <command>);
0005 % [IN]
0006 %        fig : figure handle of brain gui.
0007 %    command : command
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('command', 'var') || isempty(command)
0021     error('command is a required parameter.');
0022 end
0023 
0024 %
0025 % --- Main Procedure
0026 %
0027 
0028 % load data(@see pa_fmri_create)
0029 data = guidata(fig);
0030 
0031 switch(command)
0032     case 'update_exec_push_status'
0033         update_exec_push_status(data.H);
0034     case 'reset_parameter'
0035         reset_parameter(data.H);
0036     case 'exec_fmri'
0037         exec_fmri(data);
0038 end
0039 
0040 function update_exec_push_status(H)
0041 % This function changes Exec button status.(clickable or not)
0042 % [IN]
0043 %    H : GUI component handles
0044 % [OUT]
0045 %    none
0046     if ~isempty(get(H.brain_file_edit, 'String')) & ...
0047        ~isempty(get(H.spm_edit, 'String')) & ...
0048        ~isempty(get(H.fMRIid_edit, 'String')) & ...
0049        ~isempty(get(H.areaid_edit, 'String')) &...
0050        ~isempty(get(H.area_file_edit, 'String')) & ...
0051        ~isempty(get(H.act_file_edit, 'String'))
0052        set(H.exec_push, 'Enable', 'on');
0053     else
0054        set(H.exec_push, 'Enable', 'off');
0055     end
0056 
0057 function H = exec_fmri(data)
0058 % This function execute vb_job_fmri with set parameter.
0059 % [IN]
0060 %    data : data of fmri gui(@see pa_fmri_create)
0061 % [OUT]
0062 %    none
0063 
0064     H = data.H;
0065 
0066     %%%%%%%%%%%%%%%%%%%%
0067     % Parameter setting
0068     %%%%%%%%%%%%%%%%%%%%
0069     proj_root = get(H.prjroot_edit, 'String');
0070 
0071     % advanced parameters are set here.
0072     fmri_parm = data.fmri_parm;
0073     
0074     % BRAIN file
0075     fmri_parm.brain_file = get(H.brain_file_edit, 'String');
0076 
0077     % SPM file
0078     fmri_parm.spm_file   = get(H.spm_edit, 'String');
0079 
0080     % fmriID & area ID
0081     fmri_parm.fmri_id  = get(H.fMRIid_edit, 'String');
0082     fmri_parm.area_id  = get(H.areaid_edit, 'String');
0083 
0084     % AREA file
0085     fmri_parm.area_file = get(H.area_file_edit, 'String');
0086 
0087     % ACT file
0088     fmri_parm.act_file  = get(H.act_file_edit, 'String');
0089 
0090     % Comment
0091     fmri_parm.comment   = get(H.comment_edit, 'String');
0092 
0093     %%%%%%%%%%%%%%%%%%%%
0094     % execute job
0095     %%%%%%%%%%%%%%%%%%%%
0096     str = get(H.exec_push, 'String');
0097     set(H.exec_push, 'String','Processing...');
0098     pause(0.01);% for label string update
0099 
0100     vb_job_fmri(proj_root, fmri_parm);
0101 
0102     set(H.exec_push, 'String', 'Exec');
0103 
0104 function reset_parameter(H)
0105 % This function resets fMRI GUI
0106 % [IN]
0107 %    H : GUI component handles
0108 % [OUT]
0109 %    none
0110 
0111     set(H.brain_file_edit, 'String', '');
0112     set(H.spm_edit, 'String', '');
0113     set(H.fMRIid_edit, 'String', '');
0114     set(H.areaid_edit, 'String', '');
0115     update_exec_push_status(H);
0116

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