Home > functions > common > coordinate > vb_spm_right_to_analyze_right.m

vb_spm_right_to_analyze_right

PURPOSE ^

change Right-hand SPM (m) coordinate to analyze Right-hand voxcel coord.

SYNOPSIS ^

function Vana = vb_spm_right_to_analyze_right(Vspm,Vdim,Vsize,nflag)

DESCRIPTION ^

 change Right-hand SPM (m) coordinate to analyze Right-hand voxcel coord.
  Vana = vb_spm_right_to_analyze_right(Vspm)            : normal vector
  Vana = vb_spm_right_to_analyze_right(Vspm,Vdim,Vsize) : coordinate vector
  Vana = vb_spm_right_to_analyze_right(Vspm,Vdim,Vsize,nflag)
 --- Input
 Vspm  : NV x 3 Right-hand SPM (m) coord.
 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

 --- Analyze voxcel 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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    Vana = vb_spm_right_to_analyze_right(Vspm,Vdim,Vsize,nflag)
0002 % change Right-hand SPM (m) coordinate to analyze Right-hand voxcel coord.
0003 %  Vana = vb_spm_right_to_analyze_right(Vspm)            : normal vector
0004 %  Vana = vb_spm_right_to_analyze_right(Vspm,Vdim,Vsize) : coordinate vector
0005 %  Vana = vb_spm_right_to_analyze_right(Vspm,Vdim,Vsize,nflag)
0006 % --- Input
0007 % Vspm  : NV x 3 Right-hand SPM (m) coord.
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 % --- Analyze voxcel 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 %
0022 % --- SPM coordinate
0023 %
0024 % [Right-hand coordinate]
0025 % X: Left(-191/2)   -> Right(191/2)
0026 % Y: Back(-256/2)   -> Front(256/2)
0027 % Z: Bottom(-256/2) -> Top(256/2)
0028 %
0029 % written by M. Sato  2005-8-1
0030 %
0031 % Copyright (C) 2011, ATR All Rights Reserved.
0032 % License : New BSD License(see VBMEG_LICENSE.txt)
0033 
0034 if nargin == 1,
0035     nflag = 1;
0036 elseif nargin < 4, 
0037     nflag = 0; 
0038 end;
0039 
0040 if nflag == 1, 
0041     return; 
0042 end;
0043 
0044 % Change [m] to [mm]
0045 Vspm = Vspm*1000;
0046 
0047 NV   = size(Vspm,1);
0048 Vana = zeros(NV,3);
0049 
0050 Vana(:,1) =  Vspm(:,1)/Vsize(1) + Vdim(1)*0.5;
0051 Vana(:,2) =  Vspm(:,2)/Vsize(2) + Vdim(2)*0.5;
0052 Vana(:,3) =  Vspm(:,3)/Vsize(3) + Vdim(3)*0.5;
0053

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005