Home > vbmeg > functions > job > subdirectory > vb_judge_function_name.m

vb_judge_function_name

PURPOSE ^

Check parameter and return its job function

SYNOPSIS ^

function [func_name] = vb_judge_function_name(parm, parm_type)

DESCRIPTION ^

 Check parameter and return its job function
 [USAGE]
    [func_name] = vb_judge_function_name(parm, parm_type);
 [IN]
         parm : parameter
    parm_type : parameter type string (ex. 'brain_parm', 'head_parm')
 [OUT]
    func_name : function name(string)

 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 [func_name] = vb_judge_function_name(parm, parm_type)
0002 % Check parameter and return its job function
0003 % [USAGE]
0004 %    [func_name] = vb_judge_function_name(parm, parm_type);
0005 % [IN]
0006 %         parm : parameter
0007 %    parm_type : parameter type string (ex. 'brain_parm', 'head_parm')
0008 % [OUT]
0009 %    func_name : function name(string)
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 
0015 %
0016 % --- Previous check
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 % --- Main Procedure
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 % if parm field doesn't have a caller function field,
0042 % function name is judged here.
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         %func_name = 'vb_job_grandaverage'; % not supported yet 2011/01/28
0076     case 'tf_parm'
0077         %func_name = 'unknown'; % not supported yet 2011/01/28
0078     case 'mkdir_parm'
0079         func_name = 'vb_batch_job_mkdir';
0080 end

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