0001 function H = pa_fmri_util(fig, command)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
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
0026
0027
0028
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
0042
0043
0044
0045
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
0059
0060
0061
0062
0063
0064 H = data.H;
0065
0066
0067
0068
0069 proj_root = get(H.prjroot_edit, 'String');
0070
0071
0072 fmri_parm = data.fmri_parm;
0073
0074
0075 fmri_parm.brain_file = get(H.brain_file_edit, 'String');
0076
0077
0078 fmri_parm.spm_file = get(H.spm_edit, 'String');
0079
0080
0081 fmri_parm.fmri_id = get(H.fMRIid_edit, 'String');
0082 fmri_parm.area_id = get(H.areaid_edit, 'String');
0083
0084
0085 fmri_parm.area_file = get(H.area_file_edit, 'String');
0086
0087
0088 fmri_parm.act_file = get(H.act_file_edit, 'String');
0089
0090
0091 fmri_parm.comment = get(H.comment_edit, 'String');
0092
0093
0094
0095
0096 str = get(H.exec_push, 'String');
0097 set(H.exec_push, 'String','Processing...');
0098 pause(0.01);
0099
0100 vb_job_fmri(proj_root, fmri_parm);
0101
0102 set(H.exec_push, 'String', 'Exec');
0103
0104 function reset_parameter(H)
0105
0106
0107
0108
0109
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