get neuromag sensor center position in head coordinate [pick,Qpick,Weight] = get_center_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)
0001 function [pick,Qpick] = get_center_neuromag(ch_info) 0002 % get neuromag sensor center position in head coordinate 0003 % [pick,Qpick,Weight] = get_center_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 % Coil position & direction 0034 pick = zeros(Nch,3); 0035 Qpick = zeros(Nch,3); 0036 0037 Ncoil = 0; 0038 Nchan = 0; 0039 0040 % Head coordinate 0041 for n=1:Nch 0042 % Transformation matrix from coil -> head 0043 U = ch_info.trans_coil2head{n}'; 0044 0045 % Get coil position & direction 0046 % fixed coil position is defined for coil_type in Coil coordinate 0047 [pick1, Qpick1] = sensor_center_neuromag(ch_info.coil_type{n}, U); 0048 0049 Npick = size(pick1,1); 0050 0051 if Npick > 0, 0052 0053 % Coil position & direction 0054 ix = (1:Npick) + Ncoil; 0055 pick(ix ,:) = pick1; 0056 Qpick(ix ,:) = Qpick1; 0057 0058 % Coil -> Channel matrix index 0059 % Channel index 0060 Nchan = Nchan + 1; 0061 Ncoil = Ncoil + Npick; 0062 end 0063 end 0064 0065 pick = pick(1:Ncoil,:) ; 0066 Qpick = Qpick(1:Ncoil,:);