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

demo_vol2mesh_ex1

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 [node,elem,face]=vol2mesh(volimage>0.05,1:size(volimage,1),1:size(volimage,2),...
0020                            1:size(volimage,3),2,2,1);
0021 
0022 %% alternatively, one can use the following cmd as a less robust approach
0023 % [node,elem,face]=vol2mesh(volimage>0.05,1:size(volimage,1),1:size(volimage,2),...
0024 %                           1:size(volimage,3),0.2,2,1,'simplify');
0025 
0026 %% visualize the resulting mesh
0027 
0028 plotmesh(node,face);
0029 axis equal;

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