# Segmentation MRML node function names/arguments changed

**URL:** <https://discourse.slicer.org/t/segmentation-mrml-node-function-names-arguments-changed/8776>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [October 14, 2019, 6:42pm UTC](https://discourse.slicer.org/t/segmentation-mrml-node-function-names-arguments-changed/8776 "2019-10-14T18:42:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ungi/32/78573_2.png) [@ungi](https://discourse.slicer.org/u/ungi)\
**Post date:** [October 14, 2019, 6:42pm UTC](https://discourse.slicer.org/t/segmentation-mrml-node-function-names-arguments-changed/8776/1 "2019-10-14T18:42:04Z")

</div>

This example doesn’t work anymore:  
[https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get\_a\_representation\_of\_a\_segment](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_a_representation_of_a_segment)

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 14, 2019, 6:58pm UTC](https://discourse.slicer.org/t/segmentation-mrml-node-function-names-arguments-changed/8776/2 "2019-10-14T18:58:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ungi](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ungi/32/78573_2.png) [@ungi](https://discourse.slicer.org/u/ungi)\
**Post date:** [October 14, 2019, 8:12pm UTC](https://discourse.slicer.org/t/segmentation-mrml-node-function-names-arguments-changed/8776/3 "2019-10-14T20:12:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 14, 2019, 10:07pm UTC](https://discourse.slicer.org/t/segmentation-mrml-node-function-names-arguments-changed/8776/4 "2019-10-14T22:07:55Z")

</div>

The simplest way to clear a segment is to call [vtkSegmentation::ClearSegment](https://apidocs.slicer.org/master/classvtkSegmentation.html#a73a66c23a2f2df7b465d5cd80b71373a).
