Get label map node from segmentation node



Is there a way to create a label map node from a segmentation node? I know I can go the other way (from a label map to a segmentation), but I can’t seem to find a way to do the opposite. If this is not possible is there a way to at least get the array underlying the segmentation node? I know I can get an oriented image data, but if I do slicer.util.array on the oriented image data, nothing is returned.


(Csaba Pinter) #2

Answered in

You can also reach this function (i.e. Segmentations module import/export) from the Data module (right-click the segmentation), and in Segment Editor as an option for the Segmentations button.


Awesome! Do you know how I might do this through the python code?

Found it:



Do you know what the inputs for this function is or where the documentation is for the segments?


(Csaba Pinter) #5

These are the available signatures

A few examples of usage


Are there examples in python?

(Andras Lasso) #7

You can always use help() function in Python to get documentation, for example:

Example where it is used:

To create a custom Segment Editor effect, use ExtensionWizard module and choose ScriptedSegmentEditorEffect module template. It creates a fully functional effect that uses SimpleITK and you just have to replace the core of it to do what you need.

(Csaba Pinter) #8

@snvl The first two results in the search that was the second link in my post above are python examples.