Meshing a gray-scale volumetric image: an example

1. Step 1: Load your raw 3D image
2. Step 2: Extract surfaces at arbitrary isovalues
3. Step 3: Create volumetric mesh for the surfaces

Iso2mesh v0.8 or later is able to mesh a gray-scale 3D image directly. Here is an example to demonstrate how this works.

1. Step 1: Load your raw 3D image

The sample dataset used here is from CGAL library, under the path of CGAL-3.4/examples/Surface_mesher/data/, the file name is skull_2.9.inr. The following plot shows a few slices across the image. The values of each voxel are real numbers between 0 and 6.

upload:skullvol.png

2. Step 2: Extract surfaces at arbitrary isovalues

Instead of segmenting the volume first and making a image with finite labels (material indices), we can do the surface extraction directly from the gray-scale image. A list of isovalues needs to be specified when calling vol2surf. We added a short-hand version of vol2surf, and the command line to extract the level-set at v=1 is

 [node1,face1]=v2s(dat,1,2);

the created surface is

upload:skullsurf1.png

Similarly, one can extract a set of surfaces at a list of specified thresholds. The following command will extract two surfaces, one at v=1, one at v=2.9:

 [node2,face2]=v2s(dat,[1, 2.9],1); 

the mesh overlay is shown below:

upload:skullsurfboth.png

3. Step 3: Create volumetric mesh for the surfaces

The rest of the meshing task is straightforward, like others. One can use surf2mesh (or s2m) to convert the above surface set to a mesh, or call vol2mesh (or v2m) directly to do the whole process (including the previous 2 steps).

 opt(1).radbound=2; % the surface at the first levelset has resolution of 2
 opt(2).radbound=1; % the surface at the first levelset has resolution of 1
 [node,elem,face]=v2m(dat,[1,2.9],opt,10);

wala, you now have your mesh!

upload:skull_mesh.png

isn't that easy ? :)

Powered by Habitat