Hierarchical Combination of Individual Volumes to Form a Combined Model
From NCRR Biomedical Software Development, Engineering, and Dissemination Wiki
Subproject Status
As below we have a working method for combining label maps created in 3D Slicer using unu.
Segmentation
Introduction to Combining Label Maps(NRRDs)
In order for the individual label maps of a given tissue to be useful in SCIRun it must be combined with the other label maps represtenting other tissues into a model which has all of the tissues. This must be done in such a way that every voxel is uniquely defined and every voxel is defined. Failure to to this would reak havoc at the meshing and modeling stages.
In order to achieve the previosly defined criteria a hierarchical approach to defining every voxel uniquely must be used. To do this think of a bunch of cutouts of construction paper. Our application utilizes torso datasets and this will be used as an example. The botton page is a rectangular sheet onto which you put a piece which is the shape of a torso. Onto the torso you put on each of the individual organs, with the organs you glue down last overlapping on top of the organs put down before it. In this way the entire sheet has every point defined and a defined hierarchy of what to do when two organs overlap in the segmentation.
Fortunately Dr. Kindlmann and his collaborators have created a powerful set of tools to manipulate NRRDs called unu which is part of the larger TEEM library. We use unu to combine NRRDs as if we were stacking construction paper only in 3D. If you need to do something to a NRRD file you can probably do it with unu, which is why the NRRD format is utilized for this project.
Combining NRRDs
You will need to make the following label maps, or analogous ones, in 3D Slicer. We use the example of the torso:
1. A bounding box, easily done by using the threshold command in 3D Slicer and setting the boundaries to extremes
2. Torso shadow
3. All of the individual organs to put into the torso
Each of these label maps should be defined as 1, with a background of 0. This is not essential for any reason other than the unu scipt we use below depends on the label maps being defined as 1 to hierarchically combine the label maps.
Those who are astute will note that another "tissue type" is created in this process, namely all the torso minus all the organs which is undefined. For our purposes we called this "soft tissue" which represents connective tissue etc. For other applications this may be more difficult to define or problematic.
Using unu scripts to combine the individual organs
Obtain Teem and familiarize yourself with the various unu commands. There are various ways to combine NRRDs hierarchically by piping the unu commands together. Given the large size of the files and potential memory requirements we have found the best, albeight slightly slower method is to use a script like:
unu 2op x 0 bbox.nrrd -o max.nrrd
unu 2op x 1 torso.nrrd | unu 2op max max.nrrd - -o max.nrrd
unu 2op x 2 lungs.nrrd | unu 2op max max.nrrd - -o max.nrrd
unu 2op x 3 myocardium.nrrd | unu 2op max max.nrrd - -o combined.nrrd
This script uses the unu 2op command to assign values to the various tissues by multiplying their original values by a number which determines their hierarchy in the "stacking" of the label maps. At the end a "combined.nrrd" file is created which represents the hierarchical combination of all the label maps while maintaining registration relative to one another. Those tissues which should have the highest hierarchical values should have the greatest integers assigned.
This combined.nrrd file is then ready to be read into SCIRun utilizing the NRRDReader module in SCIRun.
Subproject Requirements/Improvements
- Once formalized the unu script above could be built into a GUI within 3D Slicer to obviate need for command line script. Alternatively this could be done with a SCIRun net.
- We currently lack a smoothing/premeshing opimization step for the NRRDs prior to export from 3D Slicer.
- Improve unu algorithms
--MJ 09:41, 25 Jan 2006 (MST)
