change Analyze Right-hand mm coordinate to Right-hand SPM (m) coord. Vspm = vb_analyze_right_mm_to_spm_right(Vana) : normal vector Vspm = vb_analyze_right_mm_to_spm_right(Vana,Vdim,Vsize) : coordinate vector Vspm = vb_analyze_right_mm_to_spm_right(Vana,Vdim,Vsize,nflag) --- Input Vana : NV x 3 Analyze Right-hand voxel coordinate Vdim : Voxel dimension of Analyze image Vsize : Voxel size of Analyze image nflag = 1 : normal vector : no translation and scaling is applied --- Output Vspm : NV x 3 Right-hand SPM (m) coord. --- Analyze mm coordinate [Right-hand coordinate] X: Left(1) -> Right(191) Y: Back(1) -> Front(256) Z: Bottom(1) -> Top(256) --- SPM coordinate [Right-hand coordinate] X: Left(-191/2) -> Right(191/2) Y: Back(-256/2) -> Front(256/2) Z: Bottom(-256/2) -> Top(256/2) written by M. Sato 2005-8-1 Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function Vspm = vb_analyze_right_mm_to_spm_right(Vana,Vdim,Vsize,nflag) 0002 % change Analyze Right-hand mm coordinate to Right-hand SPM (m) coord. 0003 % Vspm = vb_analyze_right_mm_to_spm_right(Vana) : normal vector 0004 % Vspm = vb_analyze_right_mm_to_spm_right(Vana,Vdim,Vsize) : coordinate vector 0005 % Vspm = vb_analyze_right_mm_to_spm_right(Vana,Vdim,Vsize,nflag) 0006 % --- Input 0007 % Vana : NV x 3 Analyze Right-hand voxel coordinate 0008 % Vdim : Voxel dimension of Analyze image 0009 % Vsize : Voxel size of Analyze image 0010 % nflag = 1 : normal vector : no translation and scaling is applied 0011 % --- Output 0012 % Vspm : NV x 3 Right-hand SPM (m) coord. 0013 % 0014 % --- Analyze mm coordinate 0015 % 0016 % [Right-hand coordinate] 0017 % X: Left(1) -> Right(191) 0018 % Y: Back(1) -> Front(256) 0019 % Z: Bottom(1) -> Top(256) 0020 % 0021 % --- SPM coordinate 0022 % 0023 % [Right-hand coordinate] 0024 % X: Left(-191/2) -> Right(191/2) 0025 % Y: Back(-256/2) -> Front(256/2) 0026 % Z: Bottom(-256/2) -> Top(256/2) 0027 % 0028 % written by M. Sato 2005-8-1 0029 % 0030 % Copyright (C) 2011, ATR All Rights Reserved. 0031 % License : New BSD License(see VBMEG_LICENSE.txt) 0032 0033 if nargin == 1, 0034 nflag = 1; 0035 elseif nargin < 4, 0036 nflag = 0; 0037 end; 0038 0039 if nflag == 1, 0040 return; 0041 end; 0042 0043 NV = size(Vana,1); 0044 Vspm = zeros(NV,3); 0045 0046 Vspm(:,1) = ( Vana(:,1) - Vdim(1)*0.5*Vsize(1) ); 0047 Vspm(:,2) = ( Vana(:,2) - Vdim(2)*0.5*Vsize(2) ); 0048 Vspm(:,3) = ( Vana(:,3) - Vdim(3)*0.5*Vsize(3) ); 0049 0050 % Change [mm] to [m] 0051 Vspm = Vspm*0.001;