[Amira 3D, Avizo 3D]
Context
For visualization, presentation, or use in other software applications, users may want to export each individual material from a segmented dataset as a unique mesh file. This article describes how to do so.
Process
1. Create a single surface object containing information from all materials:
1.1. Right-click your labeled data and create a Generate Surface.
1.2. Enable the Compactify checkbox to reduce the number of triangles in the generated surface.
1.3. You can adjust the following parameters:
- Triangle size: Adjust the Minimum edge length parameter.
- Smoothing: Set it to Constrained Smoothing and adjust Smoothing extent to be larger than Minimum edge length.
2. Connect a Surface View module to the generated surface.
This module allows you to display arbitrarily selected materials or patches.
3. Connect a Tcl Command module containing the following script to the Surface View module. When Apply is clicked, the script will:
- Cycle through all materials.
- Set the buffer of Surface View to display one material at a time.
- Export each displayed surface as a .obj files.
The output directory can be modified by changing the value of "outDir".
Before running, modify the output directory to an appropriate value by editing the value of "outDir".
set sv [$this input source]
set numMaterials [$sv materials getNum]
echo $numMaterials
for {set i 2} {$i < $numMaterials} {incr i} {
echo $i
$sv materials setValue 0 0
$sv materials setValue 1 0
$sv fire
$sv showBox
$sv fire
$sv buffer setValue 1
$sv fire
$sv materials setValue 0 $i
$sv fire
$sv showBox
$sv fire
$sv buffer setValue 0
$sv fire
set surf [$sv createSurface]
echo $surf
set outDir "c:/temp"
set outFile "$outDir/$surf.obj"
$surf exportData Wavefront $outFile
}
