Home > vbmeg > external > mne > fiff_transform_meg_chs.m

fiff_transform_meg_chs

PURPOSE ^

SYNOPSIS ^

function [res, count] = fiff_transform_meg_chs(chs,trans)

DESCRIPTION ^

 [res, count] = fiff_transform_meg_chs(chs,trans)

 Move to another coordinate system in MEG channel channel info
 Count gives the number of channels transformed

 NOTE: Only the coil_trans field is modified by this routine, not
 loc which remains to reflect the original data read from the fif file

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [res, count] = fiff_transform_meg_chs(chs,trans)
0002 %
0003 % [res, count] = fiff_transform_meg_chs(chs,trans)
0004 %
0005 % Move to another coordinate system in MEG channel channel info
0006 % Count gives the number of channels transformed
0007 %
0008 % NOTE: Only the coil_trans field is modified by this routine, not
0009 % loc which remains to reflect the original data read from the fif file
0010 %
0011 %
0012 
0013 %
0014 %   Author : Matti Hamalainen, MGH Martinos Center
0015 %   License : BSD 3-clause
0016 %
0017 %
0018 %   Revision 1.7  2006/05/03 19:09:03  msh
0019 %   Fixed even more compatibility issues.
0020 %
0021 %   Revision 1.6  2006/04/23 15:29:40  msh
0022 %   Added MGH to the copyright
0023 %
0024 %   Revision 1.5  2006/04/21 17:31:07  msh
0025 %   Added the examples.
0026 %   Modified the formatting of some informative output.
0027 %
0028 %   Revision 1.4  2006/04/18 20:44:46  msh
0029 %   Added reading of forward solution.
0030 %   Use length instead of size when appropriate
0031 %
0032 %   Revision 1.3  2006/04/17 15:01:34  msh
0033 %   More small improvements.
0034 %
0035 %   Revision 1.2  2006/04/17 11:52:15  msh
0036 %   Added coil definition stuff
0037 %
0038 %   Revision 1.1  2006/04/13 22:37:03  msh
0039 %   Added head_head_trans field to info.
0040 %
0041 %   Revision 1.1  2006/04/13 21:20:06  msh
0042 %   Added new routines for the channel information transformation.
0043 %
0044 %
0045 
0046 me='MNE:fiff_transform_meg_chs';
0047 
0048 global FIFF;
0049 if isempty(FIFF)
0050    FIFF = fiff_define_constants();
0051 end
0052 
0053 if nargin ~= 2
0054     error(me,'Wrong number of arguments');
0055  end
0056 
0057 res = chs;
0058 if isempty(trans)
0059    return;
0060 end
0061 
0062 count=0;
0063 t   = trans.trans;
0064 for k = 1:length(res)
0065     if res(k).kind == FIFF.FIFFV_MEG_CH || res(k).kind == FIFF.FIFFV_REF_MEG_CH
0066        if res(k).coord_frame == trans.from && ~isempty(res(k).coil_trans)
0067            res(k).coil_trans  = t*res(k).coil_trans;
0068            res(k).coord_frame = trans.to;
0069            count = count + 1;
0070        end
0071     end
0072 end
0073 
0074 if count > 0
0075     fprintf(1,'\t%d MEG channel locations transformed\n',count);
0076 end
0077 
0078 return;
0079 
0080 end

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