Segmentation MRML node function names/arguments changed

This example doesn’t work anymore:

What is the recommended new way to get the segmentation labelmaps?
Just change GetBinaryLabelmapRepresentation to GetBinaryLabelmapInternalRepresentation?

Probably you want to use GetBinaryLabelmapRepresentation, which returns a binary labelmap that only has non-zero voxels in the requested segment’s region.

GetBinaryLabelmapInternalRepresentation is for advanced use cases (mainly for internal use by editor effects). It returns the internal labelmap that is potentially shared by multiple segments (so that you need to threshold it with the segment’s label value to get the segment’s binary labelmap).

@Sunderlandkyl will write a forum post about the new features of Editor that made this API change necessary, and update the migration guide with instructions.

What I am doing is clear the segmentation canvas. (Getting the labelmap, setting all pixels to zero, then setting it back in the segmentation node.)
If the new API will include a function to clear the segmentation, then I will use that.
Of course, the example script will need to be fixed regardless.

The simplest way to clear a segment is to call vtkSegmentation::ClearSegment.

1 Like