Home > vbmeg > functions > device > meg > vb_megfile_load_specified_sensor.m

vb_megfile_load_specified_sensor

PURPOSE ^

return sensor data which are specified by ch_name

SYNOPSIS ^

function [pick, Qpick, CoilWeight, Vcenter] =vb_megfile_load_specified_sensor(megfile, ch_name, active_swt)

DESCRIPTION ^

 return sensor data which are specified by ch_name
 [usage]
   [pick, Qpick, CoilWeight, Vcenter] = ...
     vb_megfile_load_specified_sensor(megfile, ch_name, active_swt)
 [input]
      megfile : <required> <<file>> MEG-MAT file
      ch_name : <optional> [Nch x 1] list of channel name
              :  if this is empty, target is all the channels
   active_swt : <optional> <<boolean>> active switch [false]
              :   true : target channels are only active
              :  false : target channels are all the channels
 [output]
         pick : n-th coil position  (Right-hand SPM coordinate) [m]
              :  [Ncoil x 3]
        Qpick : n-th coil direction (Right-hand SPM coordinate)
              :  [Ncoil x 3]
   CoilWeight : n-th coil weight for m-th channel [Nchannel x Ncoil]
              : basis(channel,dipole) = CoilWeight * basis(coil,dipole)
      Vcenter : Center of spherical head model [m] [1 x 3]
 [note]
   @see vb_load_sensor.m
   @see vb_meginfo_get_channel_index_meg.m
   @see vb_meginfo_get_channel_index_extra.m
 [history]
   2008-08-25 (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 [pick, Qpick, CoilWeight, Vcenter] = ...
0002   vb_megfile_load_specified_sensor(megfile, ch_name, active_swt)
0003 % return sensor data which are specified by ch_name
0004 % [usage]
0005 %   [pick, Qpick, CoilWeight, Vcenter] = ...
0006 %     vb_megfile_load_specified_sensor(megfile, ch_name, active_swt)
0007 % [input]
0008 %      megfile : <required> <<file>> MEG-MAT file
0009 %      ch_name : <optional> [Nch x 1] list of channel name
0010 %              :  if this is empty, target is all the channels
0011 %   active_swt : <optional> <<boolean>> active switch [false]
0012 %              :   true : target channels are only active
0013 %              :  false : target channels are all the channels
0014 % [output]
0015 %         pick : n-th coil position  (Right-hand SPM coordinate) [m]
0016 %              :  [Ncoil x 3]
0017 %        Qpick : n-th coil direction (Right-hand SPM coordinate)
0018 %              :  [Ncoil x 3]
0019 %   CoilWeight : n-th coil weight for m-th channel [Nchannel x Ncoil]
0020 %              : basis(channel,dipole) = CoilWeight * basis(coil,dipole)
0021 %      Vcenter : Center of spherical head model [m] [1 x 3]
0022 % [note]
0023 %   @see vb_load_sensor.m
0024 %   @see vb_meginfo_get_channel_index_meg.m
0025 %   @see vb_meginfo_get_channel_index_extra.m
0026 % [history]
0027 %   2008-08-25 (Sako) initial version
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('megfile', 'var'), megfile = ''; end
0034 if ~exist('ch_name', 'var'), ch_name = []; end
0035 if ~exist('active_swt', 'var'), active_swt = []; end
0036 [megfile, ch_name, active_swt] = ...
0037   inner_check_arguments(megfile, ch_name, active_swt);
0038 
0039 % --- MAIN PROCEDURE --------------------------------------------------------- %
0040 %
0041 [org_pick, org_Qpick, org_CoilWeight, org_Vcenter] = ...
0042   vb_load_sensor(megfile, 'MEG', active_swt);
0043 
0044 n_ch   = size(org_CoilWeight,1);
0045 
0046 meginfo = vb_load_meg_info(megfile);
0047 ch_idx = vb_meginfo_get_channel_index_meg(meginfo, ch_name, active_swt);
0048 coil_idx = [ch_idx; ch_idx+n_ch];
0049 
0050 pick = org_pick(coil_idx, :);
0051 Qpick = org_Qpick(coil_idx, :);
0052 CoilWeight = org_CoilWeight(ch_idx, coil_idx);
0053 Vcenter = org_Vcenter;
0054 return;
0055 %
0056 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0057 
0058 % --- INNER FUNCTIONS -------------------------------------------------------- %
0059 %
0060 % --- inner_check_arguments()
0061 %
0062 function [megfile, ch_name, active_swt] = ...
0063   inner_check_arguments(megfile, ch_name, active_swt)
0064 func_ = mfilename;
0065 if isempty(megfile)
0066   error('(%s)megfile is a required parameter', func_);
0067 end
0068 
0069 if exist(megfile, 'file') ~= 2
0070   error('(%s)cannot find megfile : %s', func_, megfile);
0071 end
0072 
0073 if isempty(ch_name)
0074   % require no action
0075 end
0076 
0077 if isempty(active_swt)
0078   % default target is all the channels
0079   active_swt = false;
0080 end
0081 return;
0082 %
0083 % --- end of inner_check_arguments()
0084 %
0085 % --- END OF INNER FUNCTIONS ------------------------------------------------- %

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