TAL2MNI - Talairach to MNI coordinates outpoints = tal2mni(inpoints) inpoints - 3xN matrix of coordinates outpoints - the coordinate matrix with MNI points See also, MNI2TAL & the best guess discussion at http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml
0001 function outpoints = tal2mni(inpoints) 0002 0003 % TAL2MNI - Talairach to MNI coordinates 0004 % 0005 % outpoints = tal2mni(inpoints) 0006 % 0007 % inpoints - 3xN matrix of coordinates 0008 % 0009 % outpoints - the coordinate matrix with MNI points 0010 % 0011 % See also, MNI2TAL & the best guess discussion at 0012 % http://www.mrc-cbu.cam.ac.uk/Imaging/Common/mnispace.shtml 0013 % 0014 0015 % $Revision: 1.3 $ $Date: 2005/01/21 06:22:14 $ 0016 0017 % Licence: GNU GPL, no express or implied warranties 0018 % Matthew Brett 2/2/01, matthew.brett@mrc-cbu.cam.ac.uk 0019 % modified 02/2003, Darren.Weber_at_radiology.ucsf.edu 0020 % - swapped inv() for slash equivalent 0021 % - removed dependence on spm_matrix 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