Home > vbmeg > functions > common > coordinate > vb_vox_to_analyze_right.m

vb_vox_to_analyze_right

PURPOSE ^

change SBI-Voxcel(mm) coordinate to Right-hand Analyze voxcel coordinate

SYNOPSIS ^

function Vspm = vb_vox_to_analyze_right(V,Vdim,Vsize,nflag)

DESCRIPTION ^

 change SBI-Voxcel(mm) coordinate to Right-hand Analyze voxcel coordinate
  Vspm = vb_vox_to_analyze_right(V)            : normal vector
  Vspm = vb_vox_to_analyze_right(V,Vdim,Vsize) : coordinate vector
  Vspm = vb_vox_to_analyze_right(V,Vdim,Vsize,nflag)
 --- Input
 V     : NV x 3 SBI-Voxcel(mm) 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 Right-hand voxcel coordinate

 --- MRI-Voxel(mm) coordinate   

 [Right-hand coordinate]
 X:Front(1) -> Back(256)
 Y:Top(1)   -> Bottom(256) 
 Z:Left(1)  -> Right(191) 

 --- Analyze voxcel coordinate   

 [Right-hand coordinate]
 X: Left(1)   -> Right(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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    Vspm = vb_vox_to_analyze_right(V,Vdim,Vsize,nflag)
0002 % change SBI-Voxcel(mm) coordinate to Right-hand Analyze voxcel coordinate
0003 %  Vspm = vb_vox_to_analyze_right(V)            : normal vector
0004 %  Vspm = vb_vox_to_analyze_right(V,Vdim,Vsize) : coordinate vector
0005 %  Vspm = vb_vox_to_analyze_right(V,Vdim,Vsize,nflag)
0006 % --- Input
0007 % V     : NV x 3 SBI-Voxcel(mm) 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 Right-hand voxcel coordinate
0013 %
0014 % --- MRI-Voxel(mm) 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 % [Right-hand coordinate]
0024 % X: Left(1)   -> Right(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 Vspm = zeros(NV,3);
0042 
0043 if nflag == 1
0044     Vspm(:,1) =   V(:,3);
0045     Vspm(:,2) = - V(:,1);
0046     Vspm(:,3) = - V(:,2);
0047 else
0048     Vspm(:,1) =   V(:,3)/Vsize(1);
0049     Vspm(:,2) = - V(:,1)/Vsize(2) + Vdim(2);
0050     Vspm(:,3) = - V(:,2)/Vsize(3) + Vdim(3);
0051 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005