Home > functions > gui > preAnalysis > head > head_spm_curry > pa_head_check_parm.m

pa_head_check_parm

PURPOSE ^

This function check the parameter fields.

SYNOPSIS ^

function [parm_is_ok, msg] = pa_head_check_parm(fig, head_parm)

DESCRIPTION ^

 This function check the parameter fields.
 When defectiveness is found, the reason will be shown.

 [USAGE]
    [parm_is_ok, msg] = pa_head_check_parm(<fig>, <head_parm>);
 [IN]
          fig : figure handle of gui.
    head_parm : the parameter to be checked.
 [OUT]
    parm_is_ok : check result  = true  : OK
                               = false : NG
           msg : error reason

 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 [parm_is_ok, msg] = pa_head_check_parm(fig, head_parm)
0002 % This function check the parameter fields.
0003 % When defectiveness is found, the reason will be shown.
0004 %
0005 % [USAGE]
0006 %    [parm_is_ok, msg] = pa_head_check_parm(<fig>, <head_parm>);
0007 % [IN]
0008 %          fig : figure handle of gui.
0009 %    head_parm : the parameter to be checked.
0010 % [OUT]
0011 %    parm_is_ok : check result  = true  : OK
0012 %                               = false : NG
0013 %           msg : error reason
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 %
0019 % --- Previous check
0020 %
0021 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0022     error('invalid figure handle.');
0023 end
0024 if ~exist('head_parm', 'var'),
0025     error('head_parm is a required parameter.');
0026 end
0027 
0028 %
0029 % --- Main Procedure
0030 %
0031 % load data(@see pa_brain_create)
0032 data = guidata(fig);
0033 
0034 H = data.H; % component handles
0035 
0036 parm_is_ok = true;
0037 msg = [];
0038 
0039 try
0040 % Nvertex
0041 if ~isfield(head_parm, 'Nvertex') || ...
0042     head_parm.Nvertex < 0
0043     msg = 'The number of vertices is invalid.';
0044     error('go_to_catch_block');
0045 end
0046 
0047 % analyze_file
0048 if ~isfield(head_parm, 'analyze_file') || ...
0049     exist(head_parm.analyze_file, 'file') == 0
0050     msg = 'Analyze file is needed.';
0051     error('go_to_catch_block');
0052 end
0053 
0054 % Nsurf
0055 if ~isfield(head_parm, 'Nsurf') || ...
0056     head_parm.Nsurf < 0
0057     msg = 'The Model number is invalid.';
0058     error('go_to_catch_block');
0059 end
0060 
0061 % Voxel size
0062 if ~isfield(head_parm, 'vstep') || ...
0063     head_parm.vstep < 0
0064     msg = 'Voxel size should be 1 or 2 mm';
0065     error('go_to_catch_block');
0066 end
0067 
0068 %
0069 % --- CSF source
0070 %
0071 if get(H.csf_source_popup, 'Value') == 1
0072     % SPM segmentation file + Cortical model file [+ FreeSurfer file]
0073 
0074     % gray_file
0075     if ~isfield(head_parm, 'gray_file') || ...
0076         exist(head_parm.gray_file, 'file') == 0
0077 
0078         msg = 'SPM gray file is needed.';
0079         error('go_to_catch_block');
0080     end
0081 
0082     % brain_file
0083     proj_root = get(H.prjroot_edit, 'String');
0084     if ~isfield(head_parm, 'brain_file') || ...
0085         exist([proj_root, '/', head_parm.brain_file], 'file') == 0
0086 
0087         msg = 'Cortical model file is needed.';
0088         error('go_to_catch_block');
0089     end
0090 
0091 elseif get(H.csf_source_popup, 'Value') == 2
0092     % Curry v4.5 surface file
0093     if ~isfield(head_parm, 'curry_file') || ...
0094         exist(head_parm.curry_file, 'file') == 0
0095 
0096         msg = 'Curry surface file is needed.';
0097         error('go_to_catch_block');
0098     end
0099 else
0100     msg = 'internal error is occured.';
0101     error('go_to_catch_block');
0102 end
0103 
0104 %if head_parm.Nsurf > 1
0105     %
0106     % --- Skull source
0107     %
0108     if get(H.skull_source_popup, 'Value') == 1
0109         % use Scalp thickness
0110         if ~isfield(head_parm, 'Radius_scalp') || ...
0111            head_parm.Radius_scalp < 0
0112             msg = 'Scalp thickness is invalid.';
0113             error('go_to_catch_block');
0114         end
0115     elseif get(H.skull_source_popup, 'Value') == 2
0116         % FreeSurfer surface file(outer skull)
0117         if ~isfield(head_parm, 'fs_skull_file') || ...
0118            exist(head_parm.fs_skull_file, 'file') == 0
0119 
0120             msg = 'FreeSurfer surface file is needed.';
0121             error('go_to_catch_block');
0122         end
0123     else
0124         msg = 'internal error is occured.';
0125         error('go_to_catch_block');
0126     end
0127 
0128     %
0129     % --- Scalp source
0130     %
0131     if get(H.scalp_source_popup, 'Value') == 1
0132         % FreeSurfer surface file(outer skin)
0133         if ~isfield(head_parm, 'fs_scalp_file') || ...
0134            exist(head_parm.fs_scalp_file, 'file') == 0
0135 
0136             msg = 'FreeSurfer surface file(outer skin) is needed.';
0137             error('go_to_catch_block');
0138         end
0139     elseif get(H.scalp_source_popup, 'Value') == 2
0140         % Face file(made by positioning program)
0141         if ~isfield(head_parm, 'face_file') || ...
0142             exist(head_parm.face_file, 'file') == 0
0143 
0144             msg = 'Face surface file is needed.';
0145             error('go_to_catch_block');
0146         end
0147     end
0148 %end
0149 
0150 if ~isfield(head_parm, 'head_file') || ...
0151     isempty(head_parm.head_file);
0152 
0153     msg = 'Head file is needed.';
0154     error('go_to_catch_block');
0155 end
0156 
0157 catch
0158     parm_is_ok = false;
0159 end
0160

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