Home > 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 - 3xN matrix, ie inpoints = [X Y Z]'
 
 outpoints - the Talairach coordinates (3xN matrix)
 
 See also, TAL2MNI, MNI2TAL_MATRIX &
 http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml

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 - 3xN matrix, ie inpoints = [X Y Z]'
0008 %
0009 % outpoints - the Talairach coordinates (3xN matrix)
0010 %
0011 % See also, TAL2MNI, MNI2TAL_MATRIX &
0012 % http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml
0013 %
0014 
0015 % $Revision: 1.3 $ $Date: 2004/12/10 18:15:20 $
0016 
0017 % Licence:  GNU GPL, no express or implied warranties
0018 % Matthew Brett 10/8/99, matthew.brett@mrc-cbu.cam.ac.uk
0019 % modified 02/2003, Darren.Weber_at_radiology.ucsf.edu
0020 %                   - removed dependence on spm_matrix and
0021 %                     abstracted the matrix in case it changes
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 
0025 [s1,s2] = size(inpoints);
0026 if s1 ~= 3,
0027     error('input must be a 3xN matrix')
0028 end
0029 
0030 % Transformation matrices, different zooms above/below AC
0031 M2T = mni2tal_matrix;
0032 
0033 inpoints = [inpoints; ones(1, size(inpoints, 2))];
0034 
0035 tmp = inpoints(3,:) < 0;  % 1 if below AC
0036 
0037 inpoints(:,  tmp) = (M2T.rotn * M2T.downZ) * inpoints(:,  tmp);
0038 inpoints(:, ~tmp) = (M2T.rotn * M2T.upZ  ) * inpoints(:, ~tmp);
0039 
0040 outpoints = inpoints(1:3, :);
0041 
0042 return

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003