# Labelmap volume visibility toggle in Python

**URL:** <https://discourse.slicer.org/t/labelmap-volume-visibility-toggle-in-python/33783>\
**Category:** Support\
**Tags:** python\
**Created:** [January 15, 2024, 4:31pm UTC](https://discourse.slicer.org/t/labelmap-volume-visibility-toggle-in-python/33783 "2024-01-15T16:31:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Djennifer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/djennifer/32/68978_2.png) [@Djennifer](https://discourse.slicer.org/u/Djennifer)\
**Post date:** [January 15, 2024, 4:31pm UTC](https://discourse.slicer.org/t/labelmap-volume-visibility-toggle-in-python/33783/1 "2024-01-15T16:31:35Z")

</div>

I’d like to be able to toggle a labelmap volume in the slicer viewer. I thought it would work the same like with a segmentation.  
`laNode = slicer.util.getNodesByClass("vtkMRMLLabelMapVolumeNode")[0] laNode.GetDisplayNode().SetVisibility(False)`

However the display still shows the labelmap volume although laNode.GetDisplayNode().GetVisibility() does return 0. Am I doing something wrong here?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 15, 2024, 4:37pm UTC](https://discourse.slicer.org/t/labelmap-volume-visibility-toggle-in-python/33783/2 "2024-01-15T16:37:33Z")

</div>

Volume layers work differently. You can use this method instead:

[https://slicer.readthedocs.io/en/latest/developer\_guide/slicer.html#slicer.util.setSliceViewerLayers](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.util.setSliceViewerLayers)
