Make upsample coordinate to 1mm from vertex in 2mm voxel size [xyz, Z] = vb_make_upsample_vertex(XYZ, Z) XYZ : vertex coordinate of mask point [Npoint x 3] Z : mask value for XYZ xyz : upsample coordinate of mask point [Npoint*8 x 3] 2007/06/09 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [xyz, Z] = vb_make_upsample_vertex(XYZ, Z, upmode) 0002 % Make upsample coordinate to 1mm from vertex in 2mm voxel size 0003 % [xyz, Z] = vb_make_upsample_vertex(XYZ, Z) 0004 % XYZ : vertex coordinate of mask point [Npoint x 3] 0005 % Z : mask value for XYZ 0006 % xyz : upsample coordinate of mask point [Npoint*8 x 3] 0007 % 0008 % 2007/06/09 Masa-aki Sato 0009 % 0010 % Copyright (C) 2011, ATR All Rights Reserved. 0011 % License : New BSD License(see VBMEG_LICENSE.txt) 0012 0013 x = XYZ(:,1); 0014 y = XYZ(:,2); 0015 z = XYZ(:,3); 0016 0017 if exist('upmode','var') & upmode == 1, 0018 xp = x - sign(x); 0019 yp = y - sign(y); 0020 zp = z - sign(z); 0021 else 0022 xp = x + 1; 0023 yp = y + 1; 0024 zp = z + 1; 0025 end 0026 0027 xyz = [... 0028 x, y, z; ... 0029 xp, y, z; ... 0030 x, yp, z; ... 0031 xp,yp, z; ... 0032 x, y,zp; ... 0033 xp, y,zp; ... 0034 x, yp,zp; ... 0035 xp,yp,zp]; 0036 0037 if nargout == 1, return; end 0038 0039 if exist('Z','var'), 0040 Z = repmat(Z, [8 1]); 0041 else 0042 Z = []; 0043 end; 0044