Home > functions > common > coordinate > vb_bvoyger_to_spm_right.m

vb_bvoyger_to_spm_right

PURPOSE ^

change BrainVoyger coordinate to SPM Right coordinate

SYNOPSIS ^

function Vspm = vb_bvoyger_to_spm_right(V,nflag)

DESCRIPTION ^

 change BrainVoyger coordinate to SPM Right coordinate
  Vspm = bvoyger_spm_right(V)   : coordinate vector
  Vspm = bvoyger_spm_right(V,1) : normal vector
 --- Input
 V     : NV x 3 BrainVoyger coordinate
 nflag = 0 : SBI-compatible-version ( before vbmeg ver 0.5)
       = 1 : normal vector : no translation and scaling is applied
       = 2 : Adjust origin of BV and SPM coordinate
 --- Output
 Vspm   : NV x 3 SPM Right coordinate

 --- Brain-Voyager coordinate (1 voxcel size = mm)

 [Left-hand coordinate]
 X:Front(0) -> Back(255)
 Y:Top(0)   -> Bottom(255)
 Z:Right(0) -> Left(255)

  Analyze image is imported to BV (256x256x256 mm) space
  such that the center of image is aligned
      Center of image in BV        : [255/2. 255/2. 255/2]
  <-> Center of image in SPM space : [ 0, 0, 0]

 --- Right-hand SPM coordinate  [mm] 

 [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  2006-7-20

 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_bvoyger_to_spm_right(V,nflag)
0002 % change BrainVoyger coordinate to SPM Right coordinate
0003 %  Vspm = bvoyger_spm_right(V)   : coordinate vector
0004 %  Vspm = bvoyger_spm_right(V,1) : normal vector
0005 % --- Input
0006 % V     : NV x 3 BrainVoyger coordinate
0007 % nflag = 0 : SBI-compatible-version ( before vbmeg ver 0.5)
0008 %       = 1 : normal vector : no translation and scaling is applied
0009 %       = 2 : Adjust origin of BV and SPM coordinate
0010 % --- Output
0011 % Vspm   : NV x 3 SPM Right coordinate
0012 %
0013 % --- Brain-Voyager coordinate (1 voxcel size = mm)
0014 %
0015 % [Left-hand coordinate]
0016 % X:Front(0) -> Back(255)
0017 % Y:Top(0)   -> Bottom(255)
0018 % Z:Right(0) -> Left(255)
0019 %
0020 %  Analyze image is imported to BV (256x256x256 mm) space
0021 %  such that the center of image is aligned
0022 %      Center of image in BV        : [255/2. 255/2. 255/2]
0023 %  <-> Center of image in SPM space : [ 0, 0, 0]
0024 %
0025 % --- Right-hand SPM coordinate  [mm]
0026 %
0027 % [Right-hand coordinate]
0028 % X: Left(-191/2)   -> Right(191/2)
0029 % Y: Back(-256/2)   -> Front(256/2)
0030 % Z: Bottom(-256/2) -> Top(256/2)
0031 %
0032 %
0033 % written by M. Sato  2006-7-20
0034 %
0035 % Copyright (C) 2011, ATR All Rights Reserved.
0036 % License : New BSD License(see VBMEG_LICENSE.txt)
0037 
0038 if nargin == 1,
0039     nflag = 0;
0040 end;
0041 
0042 NV   = size(V,1);
0043 Vspm = zeros(NV,3);
0044 
0045 switch nflag
0046 case    0
0047     %  SBI-compatible-version ( before vbmeg ver 0.5)
0048     Vspm(:,1) = 255/2 - V(:,3) + 1  ;
0049     Vspm(:,2) = 255/2 - V(:,1) - 1/2;
0050     Vspm(:,3) = 255/2 - V(:,2) - 1/2;
0051 case    2
0052     %  Modified version
0053     %      Center of image in BV        : [255/2. 255/2. 255/2]
0054     %  <-> Center of image in SPM space : [ 0, 0, 0]
0055     Vspm(:,1) = 255/2 - V(:,3); 
0056     Vspm(:,2) = 255/2 - V(:,1); 
0057     Vspm(:,3) = 255/2 - V(:,2); 
0058 case    1
0059     %  normal vector
0060     Vspm(:,1) = - V(:,3);
0061     Vspm(:,2) = - V(:,1);
0062     Vspm(:,3) = - V(:,2);
0063 end

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