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

demo_vol2mesh_ex1b

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   demo script for mesh generation from binarized volumetric image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0002 %   demo script for mesh generation from binarized 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 'simplify' method: first create voxel-based
0020 % surface mesh, and then resample it to desired density.
0021 % this method does not guarantee to be free of self-intersecting
0022 % element, as 'cgalsurf' promises.
0023 
0024 [node,elem,face]=vol2mesh(volimage>0.05,1:size(volimage,1),1:size(volimage,2),...
0025                           1:size(volimage,3),0.1,2,1,'simplify');
0026 
0027 %% visualize the resulting mesh
0028 
0029 plotmesh(node,face);
0030 axis equal;

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