Home > vbmeg > external > iso2mesh > sample > demo_vol2mesh_ex2.m

demo_vol2mesh_ex2

PURPOSE ^

sample script to create volumetric mesh from

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 sample script to create volumetric mesh from 
 multiple levelsets of a binary segmented head image.

 Author: Qianqian Fang <fangq at nmr.mgh.harvard.edu>

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % sample script to create volumetric mesh from
0002 % multiple levelsets of a binary segmented head image.
0003 %
0004 % Author: Qianqian Fang <fangq at nmr.mgh.harvard.edu>
0005 
0006 % load iso2mesh image
0007 
0008 img=imread('iso2mesh_bar.tif');
0009 img=fliplr(img);
0010 fullimg=repmat(1-img,[1,1,30]);
0011 fullimg(:,:,31:60)=repmat(ones(size(img)),[1,1,30]);
0012 
0013 % create volumetric tetrahedral mesh from the two-layer 3D images
0014 % this may take another few minutes for a 256x256x256 volume
0015 clear opt
0016 opt.keepratio=0.1; % this option is only useful when vol2mesh uses 'simplify' method
0017 opt.radbound=3;    % set the target surface mesh element bounding sphere be <3 pixels in radius.
0018 tic
0019 [node,elem,face]=vol2mesh(fullimg,1:size(fullimg,1),1:size(fullimg,2),1:size(fullimg,3),opt,100,1);
0020 toc
0021 
0022 hb=plotmesh(node,face);
0023 axis equal
0024 view(-90.5,-72);

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