Home > functions > common > coordinate > vb_spm_right_to_analyze_right_mm.m

vb_spm_right_to_analyze_right_mm

PURPOSE ^

change Right-hand SPM [m] coordinate to Analyze Right-hand [mm] coord.

SYNOPSIS ^

function [Vana,Vorigin] = vb_spm_right_to_analyze_right_mm(Vspm,Vdim,Vsize)

DESCRIPTION ^

 change Right-hand SPM [m] coordinate to Analyze Right-hand [mm] coord.
  [Vana,Vorigin] = vb_spm_right_to_analyze_right_mm(Vspm,Vdim,Vsize)
 --- Input
 Vspm  : NV x 3 Right-hand SPM [m] coord.
 Vdim  : Voxel dimension of Analyze image
 Vsize : Voxel size of Analyze image
 --- Output
 Vana  : NV x 3 Analyze Right-hand mm coordinate
 Vorigin : Origin of Analyze Right [mm] coord. in SPM [mm] 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  2007-3-14

 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,Vorigin] = vb_spm_right_to_analyze_right_mm(Vspm,Vdim,Vsize)
0002 % change Right-hand SPM [m] coordinate to Analyze Right-hand [mm] coord.
0003 %  [Vana,Vorigin] = vb_spm_right_to_analyze_right_mm(Vspm,Vdim,Vsize)
0004 % --- Input
0005 % Vspm  : NV x 3 Right-hand SPM [m] coord.
0006 % Vdim  : Voxel dimension of Analyze image
0007 % Vsize : Voxel size of Analyze image
0008 % --- Output
0009 % Vana  : NV x 3 Analyze Right-hand mm coordinate
0010 % Vorigin : Origin of Analyze Right [mm] coord. in SPM [mm] coord.
0011 % --- Analyze mm coordinate
0012 %
0013 % [Right-hand coordinate]
0014 % X: Left(1)   -> Right(191)
0015 % Y: Back(1)   -> Front(256)
0016 % Z: Bottom(1) -> Top(256)
0017 %
0018 % --- SPM coordinate
0019 %
0020 % [Right-hand coordinate]
0021 % X: Left(-191/2)   -> Right(191/2)
0022 % Y: Back(-256/2)   -> Front(256/2)
0023 % Z: Bottom(-256/2) -> Top(256/2)
0024 %
0025 % written by M. Sato  2007-3-14
0026 %
0027 % Copyright (C) 2011, ATR All Rights Reserved.
0028 % License : New BSD License(see VBMEG_LICENSE.txt)
0029 
0030 NV   = size(Vspm,1);
0031 Vana = zeros(NV,3);
0032 
0033 % Change [m] to [mm]
0034 Vspm = Vspm*1000;
0035 
0036 Vorigin   = - 0.5 * Vdim .* Vsize;
0037 
0038 Vana(:,1) =  ( Vspm(:,1) - Vorigin(1) );
0039 Vana(:,2) =  ( Vspm(:,2) - Vorigin(2) );
0040 Vana(:,3) =  ( Vspm(:,3) - Vorigin(3) );

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