Calculate mask image size for subsampling step size Dim = vb_mask_image_size(Vdim,Vsize,step) [Dim, Vorigin] = vb_mask_image_size(Vdim,Vsize,step) --- Input Vdim : Voxel dimension of Analyze image Vsize : Voxel size of Analyze image in [mm] step : step size for image voxel in [mm] --- Output Dim : mask image size when voxel size is step [mm] 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)
0001 function [Dim, Vorigin] = vb_mask_image_size(Vdim,Vsize,step) 0002 % Calculate mask image size for subsampling step size 0003 % Dim = vb_mask_image_size(Vdim,Vsize,step) 0004 % [Dim, Vorigin] = vb_mask_image_size(Vdim,Vsize,step) 0005 % --- Input 0006 % Vdim : Voxel dimension of Analyze image 0007 % Vsize : Voxel size of Analyze image in [mm] 0008 % step : step size for image voxel in [mm] 0009 % --- Output 0010 % Dim : mask image size when voxel size is step [mm] 0011 % Vorigin : Origin of Analyze Right [mm] coord. in SPM [mm] coord. 0012 % --- Analyze mm coordinate 0013 % 0014 % [Right-hand coordinate] 0015 % X: Left(1) -> Right(191) 0016 % Y: Back(1) -> Front(256) 0017 % Z: Bottom(1) -> Top(256) 0018 % 0019 % --- SPM coordinate 0020 % 0021 % [Right-hand coordinate] 0022 % X: Left(-191/2) -> Right(191/2) 0023 % Y: Back(-256/2) -> Front(256/2) 0024 % Z: Bottom(-256/2) -> Top(256/2) 0025 % 0026 % written by M. Sato 2007-3-14 0027 % 0028 % Copyright (C) 2011, ATR All Rights Reserved. 0029 % License : New BSD License(see VBMEG_LICENSE.txt) 0030 0031 if ~exist('step','var'), step = 1; end; 0032 0033 Vorigin = - 0.5 * Vdim .* Vsize; 0034 Dim = ceil((Vdim .* Vsize)/step);