Home > vbmeg > external > iso2mesh > v2s.m

v2s

PURPOSE ^

SYNOPSIS ^

function [no,el,regions,holes]=v2s(img,isovalues,opt,method)

DESCRIPTION ^

 [no,el,regions,holes]=v2s(img,isovalues,opt,method)

 surface mesh generation from binary or gray-scale volumetric images
 shortcut for vol2surf

 author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)

 inputs and outputs are similar to those defined in vol2surf; In v2s, 
 method can be set to 'cgalmesh' in addition to those allowed by vol2surf.

 -- 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 [no,el,regions,holes]=v2s(img,isovalues,opt,method)
0002 %
0003 % [no,el,regions,holes]=v2s(img,isovalues,opt,method)
0004 %
0005 % surface mesh generation from binary or gray-scale volumetric images
0006 % shortcut for vol2surf
0007 %
0008 % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
0009 %
0010 % inputs and outputs are similar to those defined in vol2surf; In v2s,
0011 % method can be set to 'cgalmesh' in addition to those allowed by vol2surf.
0012 %
0013 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0014 %
0015 
0016 if(nargin==3)
0017    method='cgalsurf';
0018 end
0019 
0020 if(strcmp(method,'cgalmesh'))
0021    [no,tet,el]=v2m(uint8(img),isovalues,opt,1000,method);
0022    regions=[];
0023    fclist=unique(el(:,4));
0024    len=length(fclist);
0025    for i=1:len
0026        pt=surfinterior(no(:,1:3),el(find(el(:,4)==fclist(i)),1:3));
0027        if(~isempty(pt)) regions=[regions;pt]; end
0028    end
0029    el=unique(el(:,1:3),'rows');
0030    [no,el]=removeisolatednode(no(:,1:3),el(:,1:3));
0031    holes=[];
0032    return;
0033 end
0034 
0035 [no,el,regions,holes]=vol2surf(img,1:size(img,1),1:size(img,2),1:size(img,3),opt,1,method,isovalues);

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