Difference between revisions of "Documentation/Labs/Segmentations"

From Slicer Wiki
Jump to: navigation, search
m (Text replacement - "\[https:\/\/www\.slicer\.org\/slicerWiki\/index.php\/([^ ]+) ([^]]+)]" to "$2")
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
= Motivation =
 
= Motivation =
* TODO
+
* See '''[[File:20160526_Segmentations.pptx|these slides]]''' for motivation, features, and details of the infrastructure.
 +
* For further details see [https://www.assembla.com/spaces/slicerrt/wiki/Segmentation original project page], [http://www.na-mic.org/Wiki/index.php/2014_Project_Week_Breakout_Session:_Contours 2014 NA-MIC week contours breakout session page], [http://www.na-mic.org/Wiki/index.php/2015_Winter_Project_Week_Segmentations_Breakout 2015 NA-MIC week segmentations breakout session page]
 +
* Main issues to solve
 +
** Automatic conversion is preferred because of user interaction (and knowledge) need
 +
** Relationships between the converted objects need to be preserved to be able to determine their origin and identity
 +
** When a segment representation changes, the others must follow so that no outdated data is used
 +
** The structures (referred to as segments) that belong together must be converted together to preserve coherence
  
 
= Features =
 
= Features =
* TODO
+
* 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
 +
* Drastic improvement in memory usage compared to labelmaps and conversion speed compared to [[Documentation/4.4/Modules/Contours|Contours]] (the previous SlicerRT mechanism for the same purpose, predecessor of Segmentations) due to only allocating the effective extent
 +
* Segment Editor module that can edit segmentation labelmap representations the same way as Editor module currently can [https://www.assembla.com/spaces/slicerrt/tickets/757-create-editor-module-to-edit-segmentations/details Assembla ticket #757]
 +
 
  
 
= Design and implementation =
 
= Design and implementation =
* TODO
+
* 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)
 +
** Representation types can be defined by registering conversion algorithms (rules) that specify their source and target representations, and an estimated cost metric
 +
* Master representation
 +
** Privileged representation type. Can be any of the available representations, but usually it's the original representation of the data (binary labelmap for editing, planar contour for RT)
 +
** Properties: (a) all conversions use it as source, (b) when changed all other representations are invalidated, and (c) it is the representation that is saved to disk
 +
** Using the proper master representation ensures that no information is lost, which is crucial to avoid discrepancies that can never be solved when data is permanently lost in conversion
 +
 
 
{|
 
{|
 
|[[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]]
 
|}
 
|}
  
= Code =
+
{|
 +
|[[Image:20150710_Segmentation_Design.png|thumb|right|961px|Class diagram]]
 +
|}
  
Segmentation modules is part of the SlicerRT extension during development and will be moved to trunk when the developments are complete:
 
  
https://subversion.assembla.com/svn/slicerrt/branches/SegmentationObject/
+
= 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 =
 
= Slicer core changes =
Line 21: Line 54:
  
 
= Future features =
 
= Future features =
* TODO
+
* CLI support for vtkMRMLSegmentationNode
  
 
= Issues =
 
= Issues =
* TODO
+
* Opacity spinbox does not update until done
  
 
= Topics to discuss =
 
= Topics to discuss =
* TODO
+
* Ability to support potential use cases
 +
** Huge number of segments vs memory (compressed representation and/or on-demand loading)
 +
** SceneViews (states are defined basically by display node visibility on/off)
 +
** FiberTract support
 +
* Partial SH visibility for segmentation that tracks segment visibility? What happens when the segmentation visibility is set? All show/hide?
  
 
= Notes =
 
= Notes =
* TODO
+
* [[Documentation/Nightly/Modules/Segmentations|Module page]]
  
 
= vtkMRMLLabelMapVolumeNode integration =
 
= vtkMRMLLabelMapVolumeNode integration =
 +
 +
Slicer core updated, see this commit:
 +
https://github.com/Slicer/Slicer/commit/e4ffa1f6dcfafc1ca8f0015ecf02a0c23a8bd503
  
 
== Module update instructions ==
 
== Module update instructions ==
Line 45: Line 85:
 
to
 
to
  
     self.outputSelector.nodeTypes = ( ("vtkMRMLLabelMapVolumeNode"), "" )
+
     self.outputSelector.nodeTypes = ["vtkMRMLLabelMapVolumeNode"]
  
  
Line 55: Line 95:
 
to
 
to
  
     self.outputSelector.nodeTypes = ( ("vtkMRMLScalarVolumeNode"), "" )
+
     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 ===
  
 
CLI modules are not impacted. No change is needed in interface definition XML files or in the module implementation.
 
CLI modules are not impacted. No change is needed in interface definition XML files or in the module implementation.
 +
 +
== Switch between scalar/labelmap volume ==
 +
 +
See [[Documentation/Nightly/FAQ#How_to_switch_between_scalar.2Flabelmap_volume_.3F]]

Latest revision as of 02:42, 27 November 2019

Home < Documentation < Labs < Segmentations

Motivation

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
  • Drastic improvement in memory usage compared to labelmaps and conversion speed compared to Contours (the previous SlicerRT mechanism for the same purpose, predecessor of Segmentations) due to only allocating the effective extent
  • Segment Editor module that can edit segmentation labelmap representations the same way as Editor module currently can Assembla ticket #757


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)
    • Representation types can be defined by registering conversion algorithms (rules) that specify their source and target representations, and an estimated cost metric
  • Master representation
    • Privileged representation type. Can be any of the available representations, but usually it's the original representation of the data (binary labelmap for editing, planar contour for RT)
    • Properties: (a) all conversions use it as source, (b) when changed all other representations are invalidated, and (c) it is the representation that is saved to disk
    • Using the proper master representation ensures that no information is lost, which is crucial to avoid discrepancies that can never be solved when data is permanently lost in conversion
Segmentations module, Visualizing model in 2D and 3D, also showing merged labelmap in 2D
Class diagram


Code

Segmentation modules is part of the SlicerRT extension during development and will be moved to Slicer core when the developments are complete:

Slicer core changes

https://github.com/SlicerRT/Slicer/tree/segmentation-node

Future features

  • CLI support for vtkMRMLSegmentationNode

Issues

  • Opacity spinbox does not update until done

Topics to discuss

  • Ability to support potential use cases
    • Huge number of segments vs memory (compressed representation and/or on-demand loading)
    • SceneViews (states are defined basically by display node visibility on/off)
    • FiberTract support
  • Partial SH visibility for segmentation that tracks segment visibility? What happens when the segmentation visibility is set? All show/hide?

Notes

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

See Documentation/Nightly/FAQ#How_to_switch_between_scalar.2Flabelmap_volume_.3F