From Slicer Wiki
Jump to: navigation, search
Home < Documentation < 4.5 < Modules < Contours

For the latest Slicer documentation, visit the 4.10 page.

Introduction and Acknowledgements

This work is part of the SparKit project, funded by An Applied Cancer Research Unit of Cancer Care Ontario with funds provided by the Ministry of Health and Long-Term Care and the Ontario Consortium for Adaptive Interventions in Radiation Oncology (OCAIRO) to provide free, open-source toolset for radiotherapy and related image-guided interventions.
Author: Csaba Pinter (PerkLab, Queen's University)
Contact: Csaba Pinter, <email></email>
Back to SlicerRT home

Cancer Care Ontario  
Software Platform and Adaptive Radiotherapy Kit  
Ontario Consortium for Adaptive Interventions in Radiation Oncology  

Module Description

The Contours module manages contours and contour hierarchies.

NOTE: There are some inconveniences and unsupported features in the current state of this module. Instead of addressing these issues, we re-implement the whole mechanism. It will be called Segmentations, and will be available around summer of 2015. Until then, please see FAQ section on this page, or contact us with questions.
Further information about the Segmentation effort on the related Assembla ticket and wiki page, and the links pointing from these pages.

Use Cases

  • Load as ribbon, then compute DVH; the user wants to see the contours in 3D
  • Edit contour 1, edit contour 2; see contour 1 while editing contour 2
  • Create contour node, convert it to (empty) labelmap; do contouring on the labelmapo representation; convert to model
  • Create/load labelmap or surface, create Contour node from that in Subject Hierarchy module
Contours module GUI
Contours representations



How to

Create contour from scratch
In Contours module select 'Create new Contour' in the contour selector drop-down to create a new contour
In Subject Hierarchy module drag&drop new contour to under a contour set in the tree
The default representation is an empty Ribbon model. It can be converted to Indexed labelmap in the Contours module, then the labelmap extracted in SH, which can be edited in the Editor module
Note: this feature is quite inconvenient right now, a full overhaul is coming up soon
Create contour from labelmap volume or model
In Contours module use the Create contour from representation section
In Subject Hierarchy module drag&drop the existing representation (labelmap or model) to under a contour set in the tree. This way an encapsulating Contour node gets created and associated to the corresponding color table
Create new Contour set from scratch
Right-click on an existing Study node and select 'Create child contour set'. This menu item is only available for Study level nodes
Extract labelmap representation from a contour (for editing or display).
First make sure labelmap representation is present, if not sure see Change active representation section in Contours module
In Contours module click Extract in Contour functions section
In Subject hierarchy right-click the contour and select the Extract labelmap to volume node option
Edit an existing contour
See page via link above

Panels and their use

  • Current contour(s): Currently selected contour node (vtkMRMLContourNode) or conotur hierarchy node (vtkMRMLContourHierarchyNode)
  • Representations: The active representation (Ribbon model / Indexed labelmap / Closed surface model) of the selected contour. If a hierarchy is selected in which the active representations of the contained contours do not match, Various is indicated
  • Change active representation: This box contains controls to convert from one representation to another
  • Create contour from representation: see above
  • Contour functions: see above

Similar Modules



  • Issue for original Contours effort on SlicerRT Assembla ticketing system here
  • Issue for Segmentations (complete Contours overhaul, expected delivery 2015 summer) here

Information for Developers



  • Extract model from a contour
There is currently no UI solution to extract a model node from a contour node, but it can be done via the python console:
>>> contour = getNode('Bladder_Contour')
>>> points = contour.GetDicomRtRoiPoints() # This extracts the planar contour points, but you may want to extract the RibbonModel or ClosedSurfaceModel
>>> pointsCopy = vtk.vtkPolyData()
>>> pointsCopy.DeepCopy(points)
>>> pointsCopy.GetNumberOfPoints()
>>> modelNode = slicer.vtkMRMLModelNode()
>>> modelNode.SetName(contour.GetStructureName())
>>> modelNode = slicer.mrmlScene.AddNode(modelNode)
>>> polyDataProducer = vtk.vtkTrivialProducer()
>>> polyDataProducer.SetOutput(pointsCopy)
>>> modelNode.SetPolyDataConnection(polyDataProducer.GetOutputPort())
>>> displayNode = slicer.vtkMRMLModelDisplayNode()
>>> slicer.mrmlScene.AddNode(displayNode)
>>> displayNode.VisibilityOn()
>>> modelNode.SetAndObserveDisplayNodeID(displayNode.GetID())
This script uses a contour node with a specific name. If you want to do this for all contours, then just iterate over the vtkMRMLContourNode nodes in the scene, like this:
>>> allContours = slicer.util.getNodes('vtkMRMLContourNode*')
>>> for contour in allContours.values():
>>>   points = contour.GetDicomRtRoiPoints()
>>> ...