# Slicer does not show segmentation if multiple segmentations exists

**URL:** <https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577>\
**Category:** Development\
**Tags:** bug\
**Created:** [September 26, 2019, 8:13am UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577 "2019-09-26T08:13:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [September 26, 2019, 8:13am UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577/1 "2019-09-26T08:13:31Z")

</div>

I have several volumes in a scene, each one with an own segmentation. When I try to visualize the corresponding segmentation it is not shown at all, see this picture

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/0/802c37867ba26497f7535a8a73899feab33e4d94.jpeg)

For reference, I created the different segmentations programmatically and use `shNode.SetDisplayVisibilityForBranch(segnodeID, 0)` to hide them temporarily. But when I want to show a single one, I open all the eyes (see picturre) and nothing happened, I know the segmentation is there (see the 3D view).

What is happening here?

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [September 26, 2019, 9:53am UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577/2 "2019-09-26T09:53:50Z")

</div>

Hmm, it turns out there is a problem in hiding the branch visibility inside the shNode. The only way that is currently working is by using `segmentationNode.GetDisplayNode().SetVisibility(0)`  
For those using the old wikis that still use the `SetDisplayVisibilityForBranch`, please note it does not work.  
Using the new DisplayNodes for segmentations:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/7/977de2ab5c3693b6aaa6958a6f518af46bd4ceed.jpeg)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [September 26, 2019, 11:51am UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577/3 "2019-09-26T11:51:08Z")

</div>

> [@Alex\_Vergara](#):
>
> old wikis that still use the `SetDisplayVisibilityForBranch`

If you know of a page for the latest version that contains this, please let me know. I just made this change a week or so ago (see [here](https://discourse.slicer.org/t/improvements-in-atlas-management-model-hierarchy-refactoring/8512) and specifically for folder visibility, [here](https://github.com/Slicer/Slicer/commit/1144f81c58bd7c0a4e90d417601d3e4bd803088d)), and probably some of the documentation is still not updated.

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [October 1, 2019, 12:46pm UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577/4 "2019-10-01T12:46:01Z")

</div>

You can start by [this script repository](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Manipulate_subject_hierarchy_item)

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [October 1, 2019, 1:47pm UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577/5 "2019-10-01T13:47:37Z")

</div>

There is also a “bug”? The tables, charts and plot nodes does not have DisplayNodes

```auto
AttributeError: 'MRMLCorePython.vtkMRMLPlotChartNode' object has no attribute 'GetDisplayNode'

```

and doing `shNode.SetDisplayVisibilityForBranch(itemID, 1)` for them does not display them in the sh view. They are now hidden in the view, only visible in the all nodes view. Is this behaviour intentional?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [October 1, 2019, 2:02pm UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577/6 "2019-10-01T14:02:37Z")

</div>

> [@Alex\_Vergara](#):
>
> and doing `shNode.SetDisplayVisibilityForBranch(itemID, 1)`

Please refer to the links in my comment above. The SetDisplayVisibilityForBranch function should not be used anymore.  
Or if you have this issue with a nightly that is older than two weeks then please update to the latest one, and use the new way of show/hiding branches.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [October 1, 2019, 2:03pm UTC](https://discourse.slicer.org/t/slicer-does-not-show-segmentation-if-multiple-segmentations-exists/8577/7 "2019-10-01T14:03:59Z")

</div>

> [@Alex\_Vergara](#):
>
> You can start by [this script repository](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Manipulate_subject_hierarchy_item)

I didn’t find mentions of SetDisplayVisibilityForBranch in the script repository so not sure what you refer to. Please be more specific in terms of what is outdated and I’ll fix it. Thanks!

Update: Sorry, wrong, I did find one. I updated the show/hide examples. Let me know if there is anything else.
