Home > functions > common > morphology > vb_remove_vertex_by_mask.m

vb_remove_vertex_by_mask

PURPOSE ^

remove mask region from vertex 'V'

SYNOPSIS ^

function indx = vb_remove_vertex_by_mask(V,B,step);

DESCRIPTION ^

 remove mask region from vertex 'V'
  indx = vb_remove_vertex_by_mask(V,B,step)
 --- Input
 V    : 3D surface coordinate in [mm]
 B    : 3D mask image
 step : voxcel size of mask image in [mm]
 --- Output
  indx : selected index of V after removing masked region

 Made by M. Sato 2004-3-28
 Made by M. Sato 2007-3-16

 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  indx = vb_remove_vertex_by_mask(V,B,step);
0002 % remove mask region from vertex 'V'
0003 %  indx = vb_remove_vertex_by_mask(V,B,step)
0004 % --- Input
0005 % V    : 3D surface coordinate in [mm]
0006 % B    : 3D mask image
0007 % step : voxcel size of mask image in [mm]
0008 % --- Output
0009 %  indx : selected index of V after removing masked region
0010 %
0011 % Made by M. Sato 2004-3-28
0012 % Made by M. Sato 2007-3-16
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 % change coordinate to index
0018 %     V = [-1/2,-1/2,-1/2] - [1/2,1/2,1/2]
0019 % <=> J = [1,1,1]
0020 
0021 %J  = floor(V) + 1;
0022 J  = floor(V/step + 0.5) + 1;
0023 
0024 % change 3D-subscript to 1D-index
0025 [NX,NY,NZ] = size(B);
0026 NXY = NX*NY;
0027 
0028 ix = J(:,1)+ NX*(J(:,2) - 1)+ NXY*(J(:,3) - 1);
0029 
0030 indx = find( B(ix) == 0 );
0031

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