Home > vbmeg > external > iso2mesh > vol2restrictedtri.m

vol2restrictedtri

PURPOSE ^

SYNOPSIS ^

function [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,maxnode)

DESCRIPTION ^

 [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,maxnode)

 surface mesh extraction using CGAL mesher

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/01/06

 input:
       vol: a 3D volumetric image
       thres: a scalar as the threshold of of the extraction
       cent: a 3d position (x,y,z) which locates inside the resulting
             mesh, this is automatically computed from vol2surf
       brad: maximum bounding sphere squared of the resulting mesh
       ang: minimum angular constrains of the resulting tranglar elements
            (in degrees)
       radbound: maximum triangle delaunay circle radius
       distbound: maximum delaunay sphere distances
       maxnode: maximum number of surface nodes (even radbound is not reached)
 output:
       node: the list of 3d nodes in the resulting surface (x,y,z)
       elem: the element list of the resulting mesh (3 columns of integers)

 -- 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 [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,maxnode)
0002 %
0003 % [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,maxnode)
0004 %
0005 % surface mesh extraction using CGAL mesher
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 % date: 2009/01/06
0009 %
0010 % input:
0011 %       vol: a 3D volumetric image
0012 %       thres: a scalar as the threshold of of the extraction
0013 %       cent: a 3d position (x,y,z) which locates inside the resulting
0014 %             mesh, this is automatically computed from vol2surf
0015 %       brad: maximum bounding sphere squared of the resulting mesh
0016 %       ang: minimum angular constrains of the resulting tranglar elements
0017 %            (in degrees)
0018 %       radbound: maximum triangle delaunay circle radius
0019 %       distbound: maximum delaunay sphere distances
0020 %       maxnode: maximum number of surface nodes (even radbound is not reached)
0021 % output:
0022 %       node: the list of 3d nodes in the resulting surface (x,y,z)
0023 %       elem: the element list of the resulting mesh (3 columns of integers)
0024 %
0025 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0026 %
0027 
0028 if(radbound<1)
0029     warning(['You are meshing the surface with sub-pixel size. If this ' ...
0030              'is not your your intent, please check if you set ' ...
0031              '"opt.radbound" correctly for the default meshing method.']);
0032 end
0033 
0034 exesuff=getexeext;
0035 exesuff=fallbackexeext(exesuff,'cgalsurf');
0036 
0037 saveinr(vol,mwpath('pre_extract.inr'));
0038 deletemeshfile(mwpath('post_extract.off'));
0039 
0040 randseed=hex2dec('623F9A9E'); % "U+623F U+9A9E"
0041 
0042 if(~isempty(getvarfrom({'caller','base'},'ISO2MESH_RANDSEED')))
0043     randseed=getvarfrom({'caller','base'},'ISO2MESH_RANDSEED');
0044 end
0045 
0046 initnum=50;
0047 if(~isempty(getvarfrom({'caller','base'},'ISO2MESH_INITSIZE')))
0048         initnum=getvarfrom({'caller','base'},'ISO2MESH_INITSIZE');
0049 end
0050 
0051 system([' "' mcpath('cgalsurf') exesuff '" "' mwpath('pre_extract.inr') ...
0052     '" ' sprintf('%.16f %.16f %.16f %.16f %.16f %.16f %.16f %.16f %d ',thres,cent,brad,ang,radbound,distbound,maxnode) ...
0053     ' "' mwpath('post_extract.off') '" ' sprintf('%.0f %d',randseed,initnum)]);
0054 [node,elem]=readoff(mwpath('post_extract.off'));
0055 
0056 % assuming the origin [0 0 0] is located at the lower-bottom corner of the image
0057 node=node+0.5;

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