Home > vbmeg > external > bioelectromagnetism > mni2tal.m

mni2tal

PURPOSE ^

MNI2TAL - MNI to Talairach coordinates (best guess)

SYNOPSIS ^

function outpoints = mni2tal(inpoints)

DESCRIPTION ^

 MNI2TAL - MNI to Talairach coordinates (best guess)
 
 outpoints = mni2tal(inpoints)
 
 inpoints - Nx3 or 3xN matrix of coordinates
            (N being the number of points)
 
 outpoints - the coordinate matrix with Talairach points
 
 See also, TAL2MNI, MNI2TAL_MATRIX &
 http://www.mrc-cbu.cam.ac.uk/Imaging/mnispace.html

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function outpoints = mni2tal(inpoints)
0002 
0003 % MNI2TAL - MNI to Talairach coordinates (best guess)
0004 %
0005 % outpoints = mni2tal(inpoints)
0006 %
0007 % inpoints - Nx3 or 3xN matrix of coordinates
0008 %            (N being the number of points)
0009 %
0010 % outpoints - the coordinate matrix with Talairach points
0011 %
0012 % See also, TAL2MNI, MNI2TAL_MATRIX &
0013 % http://www.mrc-cbu.cam.ac.uk/Imaging/mnispace.html
0014 %
0015 
0016 % $Revision: 1332 $ $Date:: 2011-02-24 15:57:20 +0900#$
0017 
0018 % Licence:  GNU GPL, no express or implied warranties
0019 % Matthew Brett 10/8/99, matthew.brett@mrc-cbu.cam.ac.uk
0020 % modified 02/2003, Darren.Weber_at_radiology.ucsf.edu
0021 %                   - removed dependence on spm_matrix and
0022 %                     abstracted the matrix in case it changes
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 dimdim = find(size(inpoints) == 3);
0027 if isempty(dimdim),
0028     error('input must be a Nx3 or 3xN matrix')
0029 end
0030 if dimdim == 2,
0031     inpoints = inpoints';
0032 end
0033 
0034 % Transformation matrices, different zooms above/below AC
0035 M2T = mni2tal_matrix;
0036 
0037 inpoints = [inpoints; ones(1, size(inpoints, 2))];
0038 
0039 tmp = inpoints(3,:) < 0;  % 1 if below AC
0040 
0041 inpoints(:,  tmp) = (M2T.rotn * M2T.downZ) * inpoints(:,  tmp);
0042 inpoints(:, ~tmp) = (M2T.rotn * M2T.upZ  ) * inpoints(:, ~tmp);
0043 
0044 outpoints = inpoints(1:3, :);
0045 if dimdim == 2,
0046     outpoints = outpoints';
0047 end
0048 
0049 return

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