Home > vbmeg > external > bioelectromagnetism > tal2mni.m

tal2mni

PURPOSE ^

TAL2MNI - Talairach to MNI coordinates

SYNOPSIS ^

function outpoints = tal2mni(inpoints)

DESCRIPTION ^

 TAL2MNI - Talairach to MNI coordinates
 
 outpoints = tal2mni(inpoints)
 
 inpoints  - Nx3 or 3xN matrix of coordinates
             (N being the number of points)
 
 outpoints - the coordinate matrix with MNI points
 
 See also, MNI2TAL & the best guess discussion at
 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 = tal2mni(inpoints)
0002 
0003 % TAL2MNI - Talairach to MNI coordinates
0004 %
0005 % outpoints = tal2mni(inpoints)
0006 %
0007 % inpoints  - Nx3 or 3xN matrix of coordinates
0008 %             (N being the number of points)
0009 %
0010 % outpoints - the coordinate matrix with MNI points
0011 %
0012 % See also, MNI2TAL & the best guess discussion at
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 2/2/01, matthew.brett@mrc-cbu.cam.ac.uk
0020 % modified 02/2003, Darren.Weber_at_radiology.ucsf.edu
0021 %                   - swapped inv() for slash equivalent
0022 %                   - removed dependence on spm_matrix
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