Home > vbmeg > external > iso2mesh > fillholes3d.m

fillholes3d

PURPOSE ^

SYNOPSIS ^

function resimg=fillholes3d(img,maxgap)

DESCRIPTION ^

 resimg=fillholes3d(img,maxgap)

 close a 3D image with the speicified gap size and then fill the holes

 author: Qianqian Fang, <q.fang at neu.edu>
 
 input:
    img: a 3D binary image
    maxgap: maximum gap size for image closing

 output:
    resimg: the image free of holes

 this function requires the image processing toolbox for matlab/octave

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function resimg=fillholes3d(img,maxgap)
0002 %
0003 % resimg=fillholes3d(img,maxgap)
0004 %
0005 % close a 3D image with the speicified gap size and then fill the holes
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 %
0009 % input:
0010 %    img: a 3D binary image
0011 %    maxgap: maximum gap size for image closing
0012 %
0013 % output:
0014 %    resimg: the image free of holes
0015 %
0016 % this function requires the image processing toolbox for matlab/octave
0017 %
0018 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0019 %
0020 
0021 if(maxgap)
0022   resimg = imclose(img,strel(ones(maxgap,maxgap,maxgap)));
0023 else
0024   resimg=img;
0025 end
0026 
0027 if(isoctavemesh)
0028   if(~exist('bwfill'))
0029     error('you need to install octave-image toolbox first');
0030   end
0031   for i=1:size(resimg,3)
0032     resimg(:,:,i)=bwfill(resimg(:,:,i),'holes');
0033   end
0034 else
0035   resimg=imfill(resimg,'holes');
0036 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005