Change Vivid Right-hand mm coordinate to Right-hand SPM (m) coord. V : NV x 3 Vivid Right-hand [mm] coordinate Vspm : NV x 3 SPM Right-hand [m] coordinate mode = 0 : No coordinate transform & Unit change [mm] -> [m] mode = 1 : Vivid -> SPM-R transform & Unit change [mm] -> [m] Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function Vspm = vb_vivid_mm_to_spm_right(V,mode) 0002 % Change Vivid Right-hand mm coordinate to Right-hand SPM (m) coord. 0003 % 0004 % V : NV x 3 Vivid Right-hand [mm] coordinate 0005 % Vspm : NV x 3 SPM Right-hand [m] coordinate 0006 % mode = 0 : No coordinate transform & Unit change [mm] -> [m] 0007 % mode = 1 : Vivid -> SPM-R transform & Unit change [mm] -> [m] 0008 % 0009 % Copyright (C) 2011, ATR All Rights Reserved. 0010 % License : New BSD License(see VBMEG_LICENSE.txt) 0011 0012 % --- Vivid (mm) coordinate 0013 % [Right-hand coordinate] 0014 % X: Right -> Left 0015 % Y: Bottom -> Top 0016 % Z: Back -> Front 0017 0018 % --- SPM coordinate 0019 % [Right-hand coordinate] 0020 % X: Left -> Right 0021 % Y: Back -> Front 0022 % Z: Bottom -> Top 0023 0024 % written by M. Sato 2005-12-15 0025 0026 if nargin < 2, mode=1; end; 0027 0028 NV = size(V,1); 0029 Vspm = zeros(NV,3); 0030 0031 switch mode 0032 case 0 0033 Vspm = V*0.001; 0034 case 1 0035 Vspm(:,1) = -V(:,1)*0.001; 0036 Vspm(:,2) = V(:,3)*0.001; 0037 Vspm(:,3) = V(:,2)*0.001; 0038 end