%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% demo script for using short-hand version of the meshing wrappers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0002 % demo script for using short-hand version of the meshing wrappers 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 %% v2m is the short-hand version of vol2mesh 0017 0018 % mesh volimage at threshold level 0.05, max surface element size 3, 0019 % maximum tetrahedral element volume 2 0020 0021 [node,elem,face]=v2m(volimage,0.05,3,2); 0022 0023 %% visualize the resulting mesh 0024 subplot(211); 0025 plotmesh(node,face); 0026 axis equal; 0027 0028 %% alternatively, one can call vol2surf and surf2mesh separately 0029 0030 % v2s: shorthand version of vol2surf, s2m: shorthand version of surf2mesh 0031 0032 [node,face,regions,holes]=v2s(volimage,0.05,3); 0033 [node,elem,face]=s2m(node,face,1,2); 0034 0035 %% visualize the resulting mesh 0036 subplot(212) 0037 plotmesh(node,face); 0038 axis equal; 0039