# Disable the display of a segmentation in a specific view programmatically.

**URL:** <https://discourse.slicer.org/t/disable-the-display-of-a-segmentation-in-a-specific-view-programmatically/31669>\
**Category:** Development\
**Tags:** segmentation, python\
**Created:** [September 13, 2023, 4:11am UTC](https://discourse.slicer.org/t/disable-the-display-of-a-segmentation-in-a-specific-view-programmatically/31669 "2023-09-13T04:11:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![waromero](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/waromero/32/68278_2.png) [@waromero](https://discourse.slicer.org/u/waromero)\
**Post date:** [September 13, 2023, 4:11am UTC](https://discourse.slicer.org/t/disable-the-display-of-a-segmentation-in-a-specific-view-programmatically/31669/1 "2023-09-13T04:11:23Z")

</div>

Hello!

In the UI of the _Segmentations_ module it is possible to configure per-view visibility of a segmentation.  
(Segmentations / Advanced / Views → uncheck view of interest ).

I am interested in doing the same thing programmatically.

I could not find out the class/attribute that contains the method to enable/disable the display of segmentation in a specific view.

Thanks !

---

<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:** [September 13, 2023, 10:26pm UTC](https://discourse.slicer.org/t/disable-the-display-of-a-segmentation-in-a-specific-view-programmatically/31669/2 "2023-09-13T22:26:47Z")

</div>

Hi, display nodes usually have this function called SetViewNodeIDs(…), which expects a list of view IDs where the visibility will apply.

E.g., if you make a segmentation with the default name “Segmentation” then this is how you would make sure the segmentation is only visible in the green 2D view, but not in the red or yellow:

```auto
displayNode = slicer.util.getNode("Segmentation").GetDisplayNode()
displayNode.SetViewNodeIDs(["vtkMRMLSliceNodeGreen"])

```
