0001 function [func_name] = vb_judge_function_name(parm, parm_type)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if ~exist('parm', 'var')
0020 error('parm is a required parameter.');
0021 end
0022 if ~exist('parm_type', 'var')
0023 error('parm_type is a required parameter.');
0024 end
0025
0026
0027
0028
0029
0030 func_name = 'unknown';
0031
0032 if isfield(parm, 'caller_function')
0033 caller_function = parm.caller_function;
0034 if ~isempty(caller_function) && ischar(caller_function) && ...
0035 ~isempty(which(caller_function))
0036 func_name = caller_function;
0037 return;
0038 end
0039 end
0040
0041
0042
0043 switch(parm_type)
0044 case 'brain_parm'
0045 if isfield(parm, 'subj_mask')
0046 func_name = 'vb_job_brain_std2sbj';
0047 elseif isfield(parm, 'std_brain')
0048 func_name = 'vb_job_brain_model_std2sbj';
0049 elseif isfield(parm, 'brain_sphL') && isfield(parm, 'brain_sphR')
0050 func_name = 'vb_job_brain_add_sphcoord';
0051 elseif isfield(parm, 'vstep')
0052 func_name = 'vb_job_smooth_cortex';
0053 else
0054 func_name = 'vb_job_brain';
0055 end
0056 case 'fmri_parm'
0057 func_name = 'vb_job_fmri';
0058 case 'basis_parm'
0059 func_name = 'vb_job_leadfield';
0060 case 'bayes_parm'
0061 func_name = 'vb_job_vb';
0062 case 'current_parm'
0063 if isfield(parm, 'filterfile')
0064 func_name = 'vb_job_current_feature';
0065 else
0066 func_name = 'vb_job_current';
0067 end
0068 case 'meg_parm'
0069 func_name = 'vb_job_meg';
0070 case 'head_parm'
0071 func_name = 'vb_job_head_3shell';
0072 case 'coreg_parm'
0073 func_name = 'vb_job_coreg_brain';
0074 case 'avr_parm'
0075
0076 case 'tf_parm'
0077
0078 case 'mkdir_parm'
0079 func_name = 'vb_batch_job_mkdir';
0080 end