Documentation/4.5/FAQ/Segmentation

From Slicer Wiki
Jump to: navigation, search
Home < Documentation < 4.5 < FAQ < Segmentation


For the latest Slicer documentation, visit the read-the-docs.


Segmentation

How to 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)