# Module 'slicer.util' has no attribute 'updateSegmentBinaryLabelmapFromArray'

**URL:** <https://discourse.slicer.org/t/module-slicer-util-has-no-attribute-updatesegmentbinarylabelmapfromarray/21949>\
**Category:** Development\
**Tags:** segmentation, python\
**Created:** [February 13, 2022, 1:23pm UTC](https://discourse.slicer.org/t/module-slicer-util-has-no-attribute-updatesegmentbinarylabelmapfromarray/21949 "2022-02-13T13:23:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saebiryx](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/saebiryx/32/14285_2.png) [@Saebiryx](https://discourse.slicer.org/u/Saebiryx)\
**Post date:** [February 13, 2022, 1:23pm UTC](https://discourse.slicer.org/t/module-slicer-util-has-no-attribute-updatesegmentbinarylabelmapfromarray/21949/1 "2022-02-13T13:23:37Z")

</div>

**Operating system:** Windows 10  
**Slicer version:** 4.11.20210226  
**Behavior:**  
Using the python interactor, i’m unable to change a labelmap.

> > > slicer.util.updateSegmentBinaryLabelmapFromArray(segmentArray, segmentationNode, segmentId)  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > AttributeError: module ‘slicer.util’ has no attribute ‘updateSegmentBinaryLabelmapFromArray’

or

> > > updateSegmentBinaryLabelmapFromArray(segmentArray, segmentationNode, segmentId)  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > NameError: name ‘updateSegmentBinaryLabelmapFromArray’ is not defined

Although ‘updateSegmentBinaryLabelmapFromArray’ is mentioned in the docs, it doesn’t seem to work. Am I missing something? import slicer and import vtk didn’t solve the issue.

Example (marking all pixels in a specific slice):

> > > volumeNode = getNode(‘AB’)  
> > > segmentationNode = getNode(‘test’)  
> > > segmentId = segmentationNode.GetSegmentation().GetSegmentIdBySegmentName(‘Segment\_1’)  
> > > segment = segmentationNode.GetSegmentation().GetSegment(segmentId)  
> > > segmentArray = slicer.util.arrayFromSegmentBinaryLabelmap(segmentationNode, segmentId)  
> > > segmentArray[61,:,:] = 1  
> > > slicer.util.updateSegmentBinaryLabelmapFromArray(segmentArray, segmentationNode, segmentId)

---

<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:** [February 13, 2022, 1:31pm UTC](https://discourse.slicer.org/t/module-slicer-util-has-no-attribute-updatesegmentbinarylabelmapfromarray/21949/2 "2022-02-13T13:31:02Z")

</div>

Currently on readthedocs the only documentation version is [https://slicer.readthedocs.io/en/latest/](https://slicer.readthedocs.io/en/latest/)

“latest” refers to the very latest Slicer Preview Release that is updated every day. Older versions are documented on the old Slicer wiki, for example [https://www.slicer.org/wiki/Documentation/4.10/ScriptRepository](https://www.slicer.org/wiki/Documentation/4.10/ScriptRepository)

Since we plan to release the current Slicer Preview Release as the new stable version very soon, I would recommend you to switch to the latest Slicer Preview Release now.
