Home > vbmeg > functions > tool_box > neuromag > get_pos_neuromag.m

get_pos_neuromag

PURPOSE ^

get neuromag sensor position in head coordinate

SYNOPSIS ^

function [pick,Qpick,Weight,ch_meg] = get_pos_neuromag(ch_info)

DESCRIPTION ^

 get neuromag sensor position in head coordinate
  [pick,Qpick,Weight] = get_pos_neuromag(ch_info)

    ch_info     @ channel information is including transform matrix
             .Nch      [double]
                 : The number of channels.
             .channel_ix   [Nch x 1 double]
                 : MEG channel name list.
             .sensort_type [Nch x 1 double]
                 : sensor type list
             .coil_type    {Nch x 1 cell}
                 : coil type string list
                   ex. coil_type{1} = 'VV_PLANAR_T1'
             .trans_coil2head   : {Nch x 1}
                 : transformation matrix (COIL  ==> HEAD)
                   trans_coil2head{n} = [4x4 double]
             .trans_coil2device : {Nch x 1}
                 : transformation matrix list (COIL  ==> DEVICE)
                   trans_coil2device{n} = [4x4 double]
             .trans_device2head : [4 x 4 double]
                 : transformation matrix (DEVICE  ==> HEAD)

  [rHead 1] = [rCoil 1] * ch_info.trans_coil2head{n}'

 Masa-aki Sato 2009-4-13

 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    [pick,Qpick,Weight,ch_meg] = get_pos_neuromag(ch_info)
0002 % get neuromag sensor position in head coordinate
0003 %  [pick,Qpick,Weight] = get_pos_neuromag(ch_info)
0004 %
0005 %    ch_info     @ channel information is including transform matrix
0006 %             .Nch      [double]
0007 %                 : The number of channels.
0008 %             .channel_ix   [Nch x 1 double]
0009 %                 : MEG channel name list.
0010 %             .sensort_type [Nch x 1 double]
0011 %                 : sensor type list
0012 %             .coil_type    {Nch x 1 cell}
0013 %                 : coil type string list
0014 %                   ex. coil_type{1} = 'VV_PLANAR_T1'
0015 %             .trans_coil2head   : {Nch x 1}
0016 %                 : transformation matrix (COIL  ==> HEAD)
0017 %                   trans_coil2head{n} = [4x4 double]
0018 %             .trans_coil2device : {Nch x 1}
0019 %                 : transformation matrix list (COIL  ==> DEVICE)
0020 %                   trans_coil2device{n} = [4x4 double]
0021 %             .trans_device2head : [4 x 4 double]
0022 %                 : transformation matrix (DEVICE  ==> HEAD)
0023 %
0024 %  [rHead 1] = [rCoil 1] * ch_info.trans_coil2head{n}'
0025 %
0026 % Masa-aki Sato 2009-4-13
0027 %
0028 % Copyright (C) 2011, ATR All Rights Reserved.
0029 % License : New BSD License(see VBMEG_LICENSE.txt)
0030 
0031 Nch = ch_info.Nch;
0032 
0033 % ch_info.coil_type :
0034 % ch_info.sensor_type : 0 for magnetometers, 1 for planar gradiometers
0035 % ch_info.channel_name : 'MEG xxxx'
0036 %sensor_type  = ch_info.sensor_type;
0037 %channel_name = ch_info.channel_name;
0038 
0039 ch_meg = zeros(Nch,1);
0040 
0041 % Coil position & direction
0042 pick  = [];
0043 Qpick = [];
0044 
0045 % Coil -> Channel matrix index
0046 n_coil     = [];
0047 n_channl = [];
0048 n_val     = [];
0049 
0050 Ncoil = 0;
0051 Nchan = 0;
0052 
0053 % Head coordinate
0054 for n=1:Nch
0055     % Transformation matrix from coil -> head
0056     U = ch_info.trans_coil2head{n}';
0057     
0058     % Get coil position & direction
0059     % fixed coil position is defined for coil_type in Coil coordinate
0060     if iscell(ch_info.coil_type)
0061         [pick1, Qpick1, w] = sensor_pos_neuromag(ch_info.coil_type{n}, U);
0062     else
0063         [pick1, Qpick1, w] = sensor_pos_neuromag(ch_info.coil_type(n), U);
0064     end
0065     
0066     Npick  = size(pick1,1);
0067     
0068     if Npick > 0,
0069         % MEG channel
0070         ch_meg(n) = 1;
0071         
0072         % Coil index
0073         ix = (1:Npick) + Ncoil;
0074         
0075         % Coil position & direction
0076         pick  = [pick ; pick1];
0077         Qpick = [Qpick; Qpick1];
0078         
0079         % Coil -> Channel matrix index
0080         % Channel index
0081         Nchan = Nchan + 1;
0082         n_channl = [n_channl;  repmat(Nchan, [Npick, 1])];
0083 
0084         % Coil index
0085         n_coil = [n_coil; ix(:)];
0086         n_val  = [n_val ; w(:) ];
0087         Ncoil = Ncoil + Npick;
0088     end
0089 end
0090 
0091 Weight = sparse(n_channl, n_coil, n_val, Nchan, Ncoil, Ncoil);
0092 
0093 %ch_id  = find(ch_meg > 0);

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