change SBI-Voxcel(mm) coordinate to Light-hand Analyze voxcel coordinate Vana = vb_vox_to_analyze_left(V) : normal vector Vana = vb_vox_to_analyze_left(V,Vdim,Vsize) : coordinate vector Vana = vb_vox_to_analyze_left(V,Vdim,Vsize,nflag) --- Input V : NV x 3 SBI-Voxcel coordinate Vdim : Voxel dimension of Analyze image Vsize : Voxel size of Analyze image nflag = 1 : normal vector : no translation and scaling is applied --- Output Vana : NV x 3 Analyze Left-hand voxcel coordinate --- MRI-Voxel coordinate [Right-hand coordinate] X:Front(1) -> Back(256) Y:Top(1) -> Bottom(256) Z:Left(1) -> Right(191) --- Analyze voxcel coordinate [Left-hand coordinate] X: Right(1) -> Left(191) Y: Back(1) -> Front(256) Z: Bottom(1) -> Top(256) written by M. Sato 2005-8-1 Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function Vana = vb_vox_to_analyze_left(V,Vdim,Vsize,nflag) 0002 % change SBI-Voxcel(mm) coordinate to Light-hand Analyze voxcel coordinate 0003 % Vana = vb_vox_to_analyze_left(V) : normal vector 0004 % Vana = vb_vox_to_analyze_left(V,Vdim,Vsize) : coordinate vector 0005 % Vana = vb_vox_to_analyze_left(V,Vdim,Vsize,nflag) 0006 % --- Input 0007 % V : NV x 3 SBI-Voxcel 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 % Vana : NV x 3 Analyze Left-hand voxcel coordinate 0013 % 0014 % --- MRI-Voxel coordinate 0015 % 0016 % [Right-hand coordinate] 0017 % X:Front(1) -> Back(256) 0018 % Y:Top(1) -> Bottom(256) 0019 % Z:Left(1) -> Right(191) 0020 % 0021 % --- Analyze voxcel coordinate 0022 % 0023 % [Left-hand coordinate] 0024 % X: Right(1) -> Left(191) 0025 % Y: Back(1) -> Front(256) 0026 % Z: Bottom(1) -> Top(256) 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 0034 if nargin == 1, 0035 nflag = 1; 0036 elseif nargin < 4, 0037 nflag = 0; 0038 end; 0039 0040 NV = size(V,1); 0041 Vana = zeros(NV,3); 0042 0043 if nflag == 1 0044 Vana(:,1) = - V(:,3); 0045 Vana(:,2) = - V(:,1); 0046 Vana(:,3) = - V(:,2); 0047 else 0048 Vana(:,1) = - V(:,3)/Vsize(1) + Vdim(1) ; 0049 Vana(:,2) = - V(:,1)/Vsize(2) + Vdim(2); 0050 Vana(:,3) = - V(:,2)/Vsize(3) + Vdim(3); 0051 end