Home > functions > device > eeg > vb_eeginfo_get_sensor_position.m

vb_eeginfo_get_sensor_position

PURPOSE ^

get sensor position data from EEGinfo struct

SYNOPSIS ^

function [SensorPosition, center, result] =vb_eeginfo_get_sensor_position(EEGinfo, active_swt)

DESCRIPTION ^

 get sensor position data from EEGinfo struct
 [usage]
   [SensorPosition, center] = vb_eeginfo_get_sensor_position(EEGinfo, active_swt)
 [input]
          EEGinfo : <required> EEGinfo struct data
       active_swt : <optional> <<boolean>> [false] active filter switch
                  :   true) return only active
                  :  false) return all the channels
 [output]
   SensorPosition : [N_sensor x 3] 3-D coordinates of sensor
           center : [1 x 3] coordinate of center point
           result : <<integer>> error code
                  :  0) success
                  :  1) bad eeginfo
 [note]
   @see vb_eeginfo_set_sensor_position
 [history]
   2006-12-06 (Sako) initial version
   2008-04-15 (Sako) added active_swt, result

 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 [SensorPosition, center, result] = ...
0002   vb_eeginfo_get_sensor_position(EEGinfo, active_swt)
0003 % get sensor position data from EEGinfo struct
0004 % [usage]
0005 %   [SensorPosition, center] = vb_eeginfo_get_sensor_position(EEGinfo, active_swt)
0006 % [input]
0007 %          EEGinfo : <required> EEGinfo struct data
0008 %       active_swt : <optional> <<boolean>> [false] active filter switch
0009 %                  :   true) return only active
0010 %                  :  false) return all the channels
0011 % [output]
0012 %   SensorPosition : [N_sensor x 3] 3-D coordinates of sensor
0013 %           center : [1 x 3] coordinate of center point
0014 %           result : <<integer>> error code
0015 %                  :  0) success
0016 %                  :  1) bad eeginfo
0017 % [note]
0018 %   @see vb_eeginfo_set_sensor_position
0019 % [history]
0020 %   2006-12-06 (Sako) initial version
0021 %   2008-04-15 (Sako) added active_swt, result
0022 %
0023 % Copyright (C) 2011, ATR All Rights Reserved.
0024 % License : New BSD License(see VBMEG_LICENSE.txt)
0025 
0026 if ~exist('EEGinfo', 'var'), EEGinfo = []; end
0027 if ~exist('active_swt', 'var'), active_swt = []; end
0028 [EEGinfo, active_swt, result] = inner_check_arguments(EEGinfo, active_swt);
0029 
0030 % --- MAIN PROCEDURE --------------------------------------------------------- %
0031 %
0032 SensorPosition = [];
0033 center = [];
0034 
0035 if result ~= 0
0036   return;
0037 end
0038 
0039 if isfield(EEGinfo, 'Vcenter')
0040   center = EEGinfo.Vcenter;
0041 end
0042 
0043 if isfield(EEGinfo, 'Coord')
0044   SensorPosition = EEGinfo.Coord;
0045 end
0046 
0047 % --- active channel filter
0048 if isempty(SensorPosition)
0049   % --- end here
0050   return;
0051 end
0052 
0053 if ~vb_info_active_channel_is_valid(EEGinfo)
0054   % do nothing any more
0055   return;
0056 end
0057 
0058 if active_swt
0059   active_list = vb_info_get_active_channel(EEGinfo);
0060   
0061   if length(active_list) ~= size(SensorPosition, 1)
0062     fprintf('(%s) different length - active list and sensor position\n', ...
0063       mfilename);
0064     return;
0065   end
0066   
0067   % --- filtered sensor position
0068   SensorPosition = SensorPosition((active_list == 1),:);
0069 end
0070 return;
0071 %
0072 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0073 
0074 % --- INNER FUNCTIONS -------------------------------------------------------- %
0075 %
0076 % --- inner_check_arguments()
0077 %
0078 function [EEGinfo, active_swt, result] = ...
0079   inner_check_arguments(EEGinfo, active_swt)
0080 func_ = mfilename;
0081 result = 0;
0082 
0083 if isempty(EEGinfo)
0084   fprintf('(%s)EEGinfo is a required parameter\n', func_);
0085   result = 1;
0086   return;
0087 end
0088 
0089 if isempty(active_swt)
0090   active_swt = false;
0091 end
0092 return;
0093 %
0094 % --- end of inner_check_arguments()
0095 %
0096 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0097 
0098 % --- END OF FILE --- %

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