Difference between revisions of "Documentation/Labs/Segmentations"
From Slicer Wiki
Line 6: | Line 6: | ||
= Features = | = Features = | ||
− | * | + | * New Segmentation MRML node that can contain multiple segments and multiple representations for segments |
+ | * Automatic conversion between representations | ||
+ | * Visualization of lablemap and model representations simultaneously in 2D or 3D views | ||
+ | * Copy/move segments between segmentations | ||
+ | * Import/export representations into labelmap ormodel nodes | ||
= Design and implementation = | = Design and implementation = | ||
− | * | + | * New Segmentation MRML node that can contain multiple segments and multiple representations for all segments |
+ | ** Each segment has the same set of representations. This means that if segments are copied/moved between segmentations, then conversion will take place if possible (if not then copy will fail) | ||
+ | ** Supported representations (initially) are | ||
+ | *** Binary lablemap (vtkOrientedImageData) | ||
+ | *** Closed surface (vtkPolyData) | ||
+ | *** Planar contour (vtkPolyData) | ||
+ | ** Additional representations can be added, such as Ribbon model or Fractional labelmap that can be found in SlicerRT | ||
+ | * Conversion between representations are driven by a conversion graph in which the nodes are the representations and the edges are conversion rules | ||
+ | ** When converting with the default method (Create: 'Default' button), then the path with the lowest cost is used (rules have a cost field that gives a ballpark value for the conversion cost) | ||
+ | |||
{| | {| | ||
|[[Image:20150529_Segmentations.png|thumb|right|961px|Segmentations module, Visualizing model in 2D and 3D, also showing merged labelmap in 2D]] | |[[Image:20150529_Segmentations.png|thumb|right|961px|Segmentations module, Visualizing model in 2D and 3D, also showing merged labelmap in 2D]] |
Revision as of 17:10, 21 October 2015
Home < Documentation < Labs < SegmentationsContents
Motivation
See
- https://www.assembla.com/spaces/slicerrt/wiki/Segmentation
- http://www.na-mic.org/Wiki/index.php/2014_Project_Week_Breakout_Session:_Contours
- http://www.na-mic.org/Wiki/index.php/2015_Winter_Project_Week_Segmentations_Breakout
Features
- New Segmentation MRML node that can contain multiple segments and multiple representations for segments
- Automatic conversion between representations
- Visualization of lablemap and model representations simultaneously in 2D or 3D views
- Copy/move segments between segmentations
- Import/export representations into labelmap ormodel nodes
Design and implementation
- New Segmentation MRML node that can contain multiple segments and multiple representations for all segments
- Each segment has the same set of representations. This means that if segments are copied/moved between segmentations, then conversion will take place if possible (if not then copy will fail)
- Supported representations (initially) are
- Binary lablemap (vtkOrientedImageData)
- Closed surface (vtkPolyData)
- Planar contour (vtkPolyData)
- Additional representations can be added, such as Ribbon model or Fractional labelmap that can be found in SlicerRT
- Conversion between representations are driven by a conversion graph in which the nodes are the representations and the edges are conversion rules
- When converting with the default method (Create: 'Default' button), then the path with the lowest cost is used (rules have a cost field that gives a ballpark value for the conversion cost)
Code
Segmentation modules is part of the SlicerRT extension during development and will be moved to Slicer core when the developments are complete:
- SlicerRT trunk modules:
- SegmentationCore containing the base VTK container and conversion classes: https://subversion.assembla.com/svn/slicerrt/trunk/SlicerRt/src/SegmentationCore/
- Segmentations module: https://subversion.assembla.com/svn/slicerrt/trunk/SlicerRt/src/Segmentations/
- Original topic branch in SlicerRT: https://subversion.assembla.com/svn/slicerrt/branches/SegmentationObject/
Slicer core changes
https://github.com/SlicerRT/Slicer/tree/segmentation-node
Future features
- TODO
Issues
- TODO
Topics to discuss
- TODO
Notes
- TODO
vtkMRMLLabelMapVolumeNode integration
Slicer core updated, see this commit: https://github.com/Slicer/Slicer/commit/e4ffa1f6dcfafc1ca8f0015ecf02a0c23a8bd503
Module update instructions
Module selectors that expect a labelmap volume should be changed
From:
self.outputSelector.nodeTypes = ( ("vtkMRMLScalarVolumeNode"), "" ) self.outputSelector.addAttribute( "vtkMRMLScalarVolumeNode", "LabelMap", 1)
to
self.outputSelector.nodeTypes = ["vtkMRMLLabelMapVolumeNode"]
From:
self.outputSelector.nodeTypes = ( ("vtkMRMLScalarVolumeNode"), "" ) self.outputSelector.addAttribute( "vtkMRMLScalarVolumeNode", "LabelMap", 0)
to
self.outputSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
- Note: This changes the value assigned to nodeTypes from a Tuple with 2 elements to a List with only one element. Additional information on the Tuple syntax can be found here: https://wiki.python.org/moin/TupleSyntax
CLI modules
CLI modules are not impacted. No change is needed in interface definition XML files or in the module implementation.
Switch between scalar/labelmap volume
Previously it was possible to switch between scalar/labelmap type by changing an attribute value. Now scalar/labelmap volumes are stored in different classes, therefore a new node has to be created for the converted volume. Conversion options:
- Use the Cast Scalar Volume module to convert between scalar/labelmap volumes.
- Create a new node for the target representation and pass the image data of the source node to the target node. For example, conversion to labelmap volume:
scalarVolume = slicer.util.getNode('MRHead') labelVolume = slicer.modules.volumes.logic().CreateAndAddLabelVolume(scalarVolume,scalarVolume.GetName()+'-label') labelVolume.SetAndObserveImageData(scalarVolume.GetImageData()) slicer.mrmlScene.RemoveNode(scalarVolume)