%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% demo script for mesh generation from binary volumetric image %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0002 % demo script for mesh generation from binary volumetric image 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 0005 %% preparation 0006 % user must add the path of iso2mesh to matlab path list 0007 % addpath('../'); 0008 0009 % user need to add the full path to .../iso2mesh/bin directory 0010 % to windows/Linux/Unix PATH environment variable 0011 0012 %% load the sample data 0013 load rat_head.mat 0014 0015 % volimage is a volumetric image such as an X-ray or MRI image 0016 % A,b are registration matrix and vector, respectively 0017 %% perform mesh generation 0018 0019 %% use the alternative 'cgalmesh' method. This will call 0020 % cgalmesher to process labled volume to produce surfaces 0021 % and tetrahedral mesh in a single run. 0022 clear opt 0023 opt.radbound=2; 0024 [node,elem,face]=v2m(uint8(volimage),0.5,opt,100,'cgalmesh'); 0025 0026 0027 %% visualize the resulting mesh 0028 0029 plotmesh(node,face(:,1:3)); 0030 axis equal;