Home > functions > device > vb_info_add_posfile_info.m

vb_info_add_posfile_info

PURPOSE ^

load position data from POS-MAT file and set to the appropriate field of

SYNOPSIS ^

function [info] = vb_info_add_posfile_info(info, posfile)

DESCRIPTION ^

 load position data from POS-MAT file and set to the appropriate field of
 MEGinfo or EEGinfo

 [usage]
   [info] = vb_info_add_posfile_info(info, posfile)

 [input]
      info : <optional> <<struct>> MEG or EEG information []
           :  if this is empty, program creates MEGinfo or EEGinfo.
   posfile : <optional> <<file>> POS-MAT file ''
           :   if this is empty, empty fields will be added to info

 [output]
      info : <<struct>> updated info

 [note]
   fields which wll be added are ...
     MRI_ID
     Vcenter
     Vradius
     device_info.TransInfo

 [history]
   2008-03-12 (Sako) initial version
   2011-02-08 (Sako) modified to set empty values when posfile is invalid
   2011-05-27 (Sako) modified according to the new data format

 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 [info] = vb_info_add_posfile_info(info, posfile)
0002 % load position data from POS-MAT file and set to the appropriate field of
0003 % MEGinfo or EEGinfo
0004 %
0005 % [usage]
0006 %   [info] = vb_info_add_posfile_info(info, posfile)
0007 %
0008 % [input]
0009 %      info : <optional> <<struct>> MEG or EEG information []
0010 %           :  if this is empty, program creates MEGinfo or EEGinfo.
0011 %   posfile : <optional> <<file>> POS-MAT file ''
0012 %           :   if this is empty, empty fields will be added to info
0013 %
0014 % [output]
0015 %      info : <<struct>> updated info
0016 %
0017 % [note]
0018 %   fields which wll be added are ...
0019 %     MRI_ID
0020 %     Vcenter
0021 %     Vradius
0022 %     device_info.TransInfo
0023 %
0024 % [history]
0025 %   2008-03-12 (Sako) initial version
0026 %   2011-02-08 (Sako) modified to set empty values when posfile is invalid
0027 %   2011-05-27 (Sako) modified according to the new data format
0028 %
0029 % Copyright (C) 2011, ATR All Rights Reserved.
0030 % License : New BSD License(see VBMEG_LICENSE.txt)
0031 
0032 % --- CHECK ARGUMENTS --- %
0033 if ~exist('info', 'var'), info = []; end
0034 if ~exist('posfile', 'var'), posfile = []; end
0035 [info, posfile] = inner_check_arguments(info, posfile);
0036 
0037 % --- MAIN PROCEDURE --------------------------------------------------------- %
0038 %
0039 func_ = mfilename;
0040 
0041 def_coord = vb_define_coordinate;
0042 
0043 if isempty(posfile)
0044   fprintf('--- (%s)posfile is empty - only set empty fields\n', func_);
0045   return;
0046 end
0047 
0048 % ----- MRI_ID
0049 info.MRI_ID = vb_posfile_load_mrikey(posfile);
0050 
0051 % ----- TransInfo
0052 [info] = vb_info_set_transinfo(info, vb_posfile_load_transinfo(posfile));
0053 
0054 % ----- Vcenter, Vradius
0055 [center, radius, c_type] = vb_posfile_get_sphericalinfo(posfile);
0056 if ~strcmp(c_type, def_coord.COORDINATE_SPM_RIGHT_M)
0057   warning('(%s)The type of obtained center coordinate is %s', func_, c_type);
0058 end
0059 
0060 info.Vcenter = center;
0061 info.Vradius = radius;
0062 
0063 return;
0064 %
0065 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0066 
0067 % --- INNER FUNCTIONS -------------------------------------------------------- %
0068 %
0069 % --- inner_check_arguments()
0070 %
0071 function [info, posfile] = inner_check_arguments(info, posfile)
0072 func_ = mfilename;
0073 
0074 if isempty(info)
0075   % set empty fields
0076   info.Vcenter = [];
0077   info.Vradius = [];
0078   info.MRI_ID = '';
0079 end
0080 
0081 if isempty(posfile)
0082   % set empty fields
0083   info.Vcenter = [];
0084   info.Vradius = [];
0085   info.MRI_ID = '';
0086 
0087 elseif exist(posfile, 'file') ~= 2
0088   warning('(%s)cannot find posfile : %s\n', func_, posfile);
0089   % set empty fields
0090   info.Vcenter = [];
0091   info.Vradius = [];
0092   info.MRI_ID = '';
0093   posfile = []; 
0094 end
0095 return;
0096 %
0097 % --- end of inner_check_arguments()
0098 %
0099 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0100 
0101 % --- END OF FILE --- %

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