Home > functions > device > acqdata > vb_posfile_get_posinfo.m

vb_posfile_get_posinfo

PURPOSE ^

<<getter>> return data from POS-MAT file

SYNOPSIS ^

function [posinfo] = vb_posfile_get_posinfo(posfile)

DESCRIPTION ^

 <<getter>> return data from POS-MAT file
 [usage]
   [posinfo] = vb_posfile_get_posinfo(posfile)
 [input]
   posfile : <required> <<file>> POS-MAT file
 [output]
   posinfo : <<struct>> this struct is provided for only here
           : SensorPosition : [Nch x3 double] coodinates of sensor
           : CoordType      : [x1 string] coodinate type
           : ChannelLabel   : {Nch x1 cell} list of sensor name
           : Vcenter        : [1x3 double] center coordinate of spherical head
           : Vradius        : [x1 double] radius of spherical head
 [note]

 [history]
   2008-02-26 (Sako) initial version

 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 [posinfo] = vb_posfile_get_posinfo(posfile)
0002 % <<getter>> return data from POS-MAT file
0003 % [usage]
0004 %   [posinfo] = vb_posfile_get_posinfo(posfile)
0005 % [input]
0006 %   posfile : <required> <<file>> POS-MAT file
0007 % [output]
0008 %   posinfo : <<struct>> this struct is provided for only here
0009 %           : SensorPosition : [Nch x3 double] coodinates of sensor
0010 %           : CoordType      : [x1 string] coodinate type
0011 %           : ChannelLabel   : {Nch x1 cell} list of sensor name
0012 %           : Vcenter        : [1x3 double] center coordinate of spherical head
0013 %           : Vradius        : [x1 double] radius of spherical head
0014 % [note]
0015 %
0016 % [history]
0017 %   2008-02-26 (Sako) initial version
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 % --- CHECK ARGUMENTS --- %
0023 if ~exist('posfile', 'var'), posfile = ''; end
0024 [pos] = inner_check_arguments(posfile);
0025 
0026 % --- MAIN PROCEDURE --------------------------------------------------------- %
0027 %
0028 
0029 % ----- coordinate and its type
0030 posinfo.SensorPosition = pos.pos;
0031 posinfo.CoordType      = pos.coord_type;
0032   
0033 % ----- eeg_sensor.name is [n_channel x 1];
0034 posinfo.ChannelLabel   = vb_util_arrange_list(pos.name);
0035 
0036 % ----- spherical head data
0037 posinfo.Vcenter        = pos.spherical_info.Vcenter;
0038 posinfo.Vradius        = pos.spherical_info.Vradius;
0039 return;
0040 %
0041 % --- end of inner_get_info_digit_file()
0042 %
0043 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0044 
0045 % --- INNER FUNCTIONS -------------------------------------------------------- %
0046 %
0047 % --- inner_check_arguments()
0048 %
0049 function [pos] = inner_check_arguments(posfile)
0050 func_ = mfilename;
0051 
0052 if isempty(posfile)
0053   error('(%s)posfile is a required parameter', func_);
0054 end
0055 
0056 if exist(posfile, 'file') ~= 2
0057   error('(%s)cannot find posfile:%s', func_, posfile);
0058 end
0059 pos = load(posfile);
0060 
0061 % ----- check necessary fields
0062 if ~isfield(pos, 'coord_type')
0063   error('(%s)invalid pos_file:%s - cannot find coord_type field', ...
0064     func_, posfile);
0065 end;
0066 
0067 if ~isfield(pos, 'pos')
0068   error('(%s)invalid pos_file:%s - cannot find pos field', ...
0069     func_, posfile);
0070 end
0071 
0072 if ~isfield(pos, 'name')
0073   error('(%s)invalid pos_file:%s - cannot find name field', ...
0074     func_, posfile);
0075 end
0076 
0077 if ~isfield(pos, 'spherical_info')
0078   warning('(%s)invalid pos_file:%s - cannot find spherical_info field\n', ...
0079     func_, posfile);
0080   pos.spherical_info.Vcenter = [0 0 0];
0081   pos.spherical_info.Vradius = 0.08;
0082 end
0083 return;
0084 %
0085 % --- end of inner_check_arguments()
0086 
0087 % --- END OF FILE --- %

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