Transform MNI coordinate to SPM-Right coordinate [Vspm, origin] = vb_mni_mm_to_spm_right(Vmni, fname) Vmni ; MNI [mm] coordinate (Npoint x 3) fname : file name (MNI_152) of T1 image file Vspm : SPM-Right [m] coordinate origin: origin of MNI cordinate in SPM-Right [m] coordinate Vspm = Vmni + origin; (Vmni = 0 at origin) Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Vspm, origin] = vb_mni_mm_to_spm_right(Vmni, fname) 0002 % Transform MNI coordinate to SPM-Right coordinate 0003 % [Vspm, origin] = vb_mni_mm_to_spm_right(Vmni, fname) 0004 % Vmni ; MNI [mm] coordinate (Npoint x 3) 0005 % fname : file name (MNI_152) of T1 image file 0006 % Vspm : SPM-Right [m] coordinate 0007 % origin: origin of MNI cordinate in SPM-Right [m] coordinate 0008 % Vspm = Vmni + origin; (Vmni = 0 at origin) 0009 % 0010 % Copyright (C) 2011, ATR All Rights Reserved. 0011 % License : New BSD License(see VBMEG_LICENSE.txt) 0012 0013 [Trans , dim] = get_coord_trans_mat(fname); 0014 0015 % Trans : transform matrix from voxcel to RAS mm coordinate 0016 % [x y z 1] = [i j k 1] * Trans 0017 % Xstd = Vox * Trans 0018 % Vox = Xstd * inv(Trans) 0019 0020 % Center position of 3D image 0021 center = vb_affine_trans(dim/2 , Trans); 0022 0023 % Get SPM-Right coordinate (center = 0 & mm -> m) 0024 Vspm = vb_repadd(Vmni, -center) * 0.001; 0025 0026 % origin of MNI cordinate in SPM-Right coordinate 0027 origin = -center * 0.001;