%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% demo script for surface repairing using surf2vol and remeshsurf %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0002 % demo script for surface repairing using surf2vol and remeshsurf 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,face]=v2s(volimage,0.5,2,'cgalmesh'); 0020 0021 node=node(:,1:3); 0022 face=face(:,1:3); 0023 0024 plotmesh(node,face); 0025 axis equal 0026 0027 [newno,newfc]=remeshsurf(node,face,1); 0028 0029 newno=sms(newno,newfc(:,1:3),3,0.5); 0030 0031 figure; 0032 plotmesh(newno,newfc(:,1:3)); 0033 axis equal