MeshGen
MeshGen generates separate mesh files for each label present in a segmentation volume. The generation employs a variant of Constrained Elastic Surface Nets [CESN], which has been modified in order to avoid intersection between neighboring meshes.
Supported input formats:
- NIfTI for segmentation volume, with integer elements (8/16/32 bits, signed/unsigned)
- ITK label file (ITK-Snap compatible, does not contain hierarchy)
- ILF - Integrated Label File (MBAT compatible, hierarchical)
- Brain-Map XML file (ontology from brain-map.org, hierarchical)
When label hierarchy is available, MeshGen can follow containment relations, e.g. eliminating generation of extra inner contours around contained labels. The tool can optionally eliminate contained labels if their colour matches with the colour of their parent, e.g. when rendering or not rendering the meshes using their original colours would make no visual difference.
In order to provide compact mesh output, MeshGen can apply edge elimination algorithms on generated data.One algorithm eliminates edges based on the curvature of neighboring surface patch. A second algorithm eliminates edges based on their length.
Contents
Usage
java -jar MeshGen.jar nifti=input.nii[.gz] label=input.lbl|ilf=input.ilf|bmxml=bmxml.xml [options, see below]
Mandatory arguments
nifti [NIfTI] volume containing segmentation values. 8-16-32-bit integer and unsigned integer formats are supported, both uncompressed (filename.nii) and gzip compressed (filename.nii.gz).
Segmentation labels One of
- label: ITK label file (ITK-Snap compatible, does not contain hierarchy)
- ilf: Integrated Label File (MBAT compatible, hierarchical
- bmxml: Brain-Map XML file (ontology from BrainMap.org, hierarchical
Options, with default values
- smoothlevel=5
- number of smoothing iterations. 0 iterations produce "LEGO" output built from cubes
- range=0.49
- movement radius of mesh coordinates during smoothing operation, in voxels
- pruningpolicy=color|off
- pruning of mesh hierarchy. Off or color-based (sub-meshes are not generated if their color matches the color of their parent)
- compounds=on|off
- generation of hierarchical mesh compounds, where containing (outer) structures have no additional borders around contained (inner) structures. This results in simpler and smaller meshes for viewing, and also means there will be no "holes" in the container object when a contained structure is toggled off
- Warning: in order to ensure containment, the contained structure is explicitly shrinked by a voxel where border of the contained structure is co-located with the border of the container structure. In case of multi-level hierarchy this may result in structures becoming several voxels thinner or even disappear completely.
- simplify=flatter[,closer]|closer|off
- simplification methods to be applied. Flatter and/or closer, off
- Flatter eliminates triangle pairs representing curvature below a specified limit
- Closer eliminates edges below a specified limit
- flatterlimit=0.9
- curvature limit around endpoints of the edge to be collapsed. Expressed in (a kind of, accumulated) cosine value (0.9 is around ~25.8 degrees)
- flattertrilimit=0.9
- rotation limit of triangle normals in "flatter" simplification. Expressed in cosine value (0.9 is around ~25.8 degrees)
- closerlimit=2
- edge length limit for collapsing. Expressed in voxels
- closertrilimit=0.9
- rotation limit of triangle normals in "closer" simplification. Expressed in cosine value (0.9 is around ~25.8 degrees)
Examples
Example command line
WHS Rat v2 [WHSv2] files generating "LEGO" meshes:
java -jar MeshGen.jar nifti=WHS_SD_rat_atlas_v2.nii label=WHS_SD_rat_atlas_v2.lbl smoothlevel=0
Example meshes
Online results using the companion viewer tool, MeshView (requires FlashPlayer support):
- WHS Rat - Waxholm Space Atlas of the Sprague Dawley rat brain (meshes for 79 anatomical structures - 80 with inner ear) [WHSv2]
- WHS Mouse - Waxholm Space Atlas of the adult C57BL/6J mouse brain (meshes for 26 anatomical structures - 27 with inner ear) [WHSMouse]
- ABA Mouse - Allen Mouse Brain Atlas reference atlas version 2 (hierarchical meshes for 106 anatomical structures after color-based pruning) [ABAv2]
References
CESN Sarah F. F. Gibson: Constrained Elastic Surface Nets. Mitsubishi Electric Research Laboratories, 1999.
WHSv2 Waxholm Space Atlas of the Sprague Dawley rat brain, version 2
WHSMouse Waxholm Space Atlas of the adult C57BL/6J mouse brain
ABAv2 Allen Mouse Brain Atlas reference atlas version 2