Transform SPM-Right-m coordinate to MNI mm coordinate [Vmni, origin] = vb_spm_right_to_mni_mm(Vspm, 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 [Vmni, origin] = vb_spm_right_to_mni_mm(Vspm, fname) 0002 % Transform SPM-Right-m coordinate to MNI mm coordinate 0003 % [Vmni, origin] = vb_spm_right_to_mni_mm(Vspm, 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 MNI mm coordinate 0016 % [x y z 1] = [i j k 1] * Trans 0017 % Xmni = Vox * Trans 0018 % Vox = Xmni * inv(Trans) 0019 0020 % Center position of 3D image in MNI mm 0021 center = vb_affine_trans(dim/2 , Trans); 0022 0023 % Xspm = 0 <-> Xmni = center 0024 % Xspm = -center <-> Xmni = 0 0025 % Xspm = Xmni - center 0026 % Xmni = Xspm + center 0027 0028 % Get MNI mm coordinate 0029 Vmni = vb_repadd(Vspm * 1000 , center) ; 0030 0031 % origin of MNI cordinate in SPM-Right coordinate 0032 %origin = -center ; 0033 origin = -center * 0.001;