EMSegmenter Mini-Tutorials

From NAMIC

Jump to: navigation, search

Contents

Getting Help

  1. Read the Frequently Asked Questions from this page
  2. Post a querry to the slicer users email list
  3. Add a bug to the bug tracker

Getting Started

  1. Download a recent copy of the tutorial [link here]
  2. Build or download a recent copy of Slicer3 [link here]
  3. Create a playpen directory (e.g., $PLAYPEN_DIR=/playpen/EMSegmenterTesting)
  4. Locate tutorial parameter file and data on disk (e.g., $EM_TUTORIAL_DIR=/playpen/EMSegmentTutorial)
  5. Locate EMSegmenterCommandLine executable (e.g., $SLICER_BUILD_DIR/bin/EMSegmenterCommandLine)
  6. Locate your target image data (volumes to be segmented) on disk (e.g., $MY_DATA_DIR/T1Volume.mhd)

Preprocessing Questions

Should I use the default preprocessing?

If you want to use intensity normalization or image registration within your segmentation pipeline, it is best if you do this outside of the EMSegmenter tool. Default intensity normalization and registration methods are available. However, these steps are highly dependent on the type of data used---what will work for some applications will fail miserably for others.

Visualization

How do I view the tutorial input data?

  1. Start Slicer3
  2. File->Import Scene...; Select $EM_TUTORIAL_DIR/Data/EMSegmenterTutorial_New.mrml
  3. Use Slicer3 visualization tools to inspect images


How do I view segmentation results?

  1. Be sure to run the segmenter first to produce results (e.g., a volume named TutorialSegmentation)
  2. Select the first target volume for display
  3. Select the segmentation results volume in the Labelmap chooser
  4. Adjust opacity of the labelmap
  5. (Optional) Generate and display surfaces from the segmentation results
    1. Select the "Model Generation" -> "Model Maker" module
    2. For "Input Volume", select the TutorialSegmentation (or whatever the segmentation results are called) volume
    3. For "Output Directory", create and select $PLAYPEN_DIR/Models
    4. For "Model Scene File", select $PLAYPEN_DIR/Models.mrml
    5. Enable "Generate All Models"
    6. Set "End Label" to the highest label that you produced (e.g., 8 fro the tutorial)
    7. Enable "Joint Smoothing"
    8. Click on Apply (this will generate the models and will take approximately 5 minutes)
    9. Load the models into Slicer (File->Import Scene; select $PLAYPEN_DIR/Models.mrml)
    10. Use The Models module to manipulate display attributes


EMSegment Simple Module

How do I segment my target images using the tutorial parameters?

  1. Load Slicer
  2. Import the tutorial parameters (File->Import Scene...)
  3. Load your target volumes (File->Add Volumes...)
  4. Choose the Segmentation->EMSegment Simple Module
  5. Select the tutorial parameter set
  6. Select your images as the first two input channels (the tutorial is specifically for exactly two input channels)
  7. Click 'Run'

Note that the target volumes must be specified in the same order as they are specified in the parameter set.


Template Builder Module

Command Line Interface

How do I segment the tutorial data from the command line?

Segmenting the tutorial data is a good way to test that you have everything setup properly. It is also a good way to experiment with viewing segmentation results.

  1. Change to your playpen directory and run the segmentation. Specify the tutorial parameters using the mrmlSceneFileName flag. By default use the tutorial data. Specify the name of the segmentation result volume. (This step takes approximately 10 minutes on a dual-core 3GHz computer).
cd $PLAYPEN_DIR
$SLICER_BUILD_DIR/bin/EMSegmenterCommandLine                                  \
  --mrmlSceneFileName $EM_TUTORIAL_DIR/Data/EMSegmentTutorialTemlate_New.mrml \
  --resultVolumeFileName TutorialSegmentation.mhd
  1. Visualize the results
    1. Start Slicer3
    2. Import the tutorial MRML scene (File->Import Scene...)
    3. Load segmentation result (File->AddVolume; Select $PLAYPEN_DIR/TutorialSegmentation.mhd; Check "LabelMap")
    4. Use slicer visualization tools to compare first input channel with segmentation

How do I save and view intermediate results?

Saving intermediate results is a good way to troubleshoot image normalization and registration problems. To save intermediate results, simply add a flag to the command line specifying the output directory.

cd $PLAYPEN_DIR
mkdir IntermediateResults
$SLICER_BUILD_DIR/bin/EMSegmenterCommandLine                                  \
  --mrmlSceneFileName $EM_TUTORIAL_DIR/Data/EMSegmentTutorialTemlate_New.mrml \
  --resultVolumeFileName TutorialSegmentation.mhd                             \
  --intermediateResultsDirectory IntermediateResults

You can view the intermediate results by starting Slicer3 and loading the $PLAYPEN_DIR/IntermediateResults/EMSegmenterScene.mrml.

How do I segment my target images using the tutorial parameters?

By default, if you specify the tutorial parameters then the tutorial data is used. To use new data, specify your target input images on the command line.

cd $PLAYPEN_DIR
mkdir IntermediateResults
$SLICER_BUILD_DIR/bin/EMSegmenterCommandLine                                  \
  --mrmlSceneFileName $EM_TUTORIAL_DIR/Data/EMSegmentTutorialTemlate_New.mrml \
  --resultVolumeFileName TutorialSegmentation.mhd                             \
  --targetVolumeFileNames $MY_DATA_DIR/T1Volume.mhd,$MY_DATA_DIR/T2Volume.mhd

Note that the target volumes must be specified in the same order as they are specified in the parameter set.

How do I specify pre-aligned atlas (spatial prior) volumes?

The EMSegmenter can register the tutorial atlas to your data. If you do not want to use this default registration but instead use a specialized registration method to align the atlas (or use a new atlas that is already aligned), you can specify the aligned atlas images on the command line.

cd $PLAYPEN_DIR
mkdir IntermediateResults
$SLICER_BUILD_DIR/bin/EMSegmenterCommandLine                                  \
  --mrmlSceneFileName $EM_TUTORIAL_DIR/Data/EMSegmentTutorialTemlate_New.mrml \
  --resultVolumeFileName TutorialSegmentation.mhd                             \
  --targetVolumeFileNames $MY_DATA_DIR/T1Volume.mhd,$MY_DATA_DIR/T2Volume.mhd \
  --atlasVolumeFileNames                                                      \
    atlasBackgroundReg.mhd,atlasBackgroundReg.mhd,atlasCSFReg.mhd,atlasGreymatterReg.mhd,atlasWhitematterReg.mhd

Note that the atlas volumes must be specified in the same order as they are specified in the parameter set.

How do I change parameters from the command line?

You can specify full parameter sets on the command line using the --mrmlSceneFileName flag. The command line interface is not designed to allow changes of individual algorithm parameters. Use the EMSegment template builder if you want to alter individual parameters.

The segmentation results are compressed but I wanted an uncompressed volume, what should I do?

Add the --disableCompression flag.

Personal tools