# Visualization bug in subject hierarchy

**URL:** <https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647>\
**Category:** Support\
**Tags:** bug\
**Created:** [October 2, 2019, 7:40am UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647 "2019-10-02T07:40:49Z")\
**Posts on this page:** 7\
**Page:** 2

<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 23, 2019, 10:02am UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647/21 "2019-10-23T10:02:20Z")

</div>

I have solved by forcing the view to display another node

```python
    for color in ['Red', 'Yellow', 'Green']:
        slicer.app.layoutManager().sliceWidget(color).sliceLogic().GetSliceCompositeNode().SetBackgroundVolumeID(minCTID)
        slicer.app.layoutManager().sliceWidget(color).sliceLogic().GetSliceCompositeNode().SetForegroundVolumeID(minSPECTID)

```

This way the shnode is forced to refresh, I still don’t know how to do that but this trick worked out

---

<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 23, 2019, 11:43am UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647/22 "2019-10-23T11:43:46Z")

</div>

The above does not work for tables, charts and plots, actually now is even worse than before:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/3/2381877a27d036a4c35a94b6f25338be12abb408.png)

So How can I create Display nodes for tables, charts and plots to be handled by the folder display node?

---

<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 23, 2019, 1:19pm UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647/23 "2019-10-23T13:19:42Z")

</div>

Thanks for the feedback.

> [@Alex\_Vergara](#):
>
> pluginHandler = slicer.qSlicerSubjectHierarchyPluginHandler().instance() folderPlugin = pluginHandler.pluginByName(‘Folder’) folderPlugin.setDisplayVisibility(folderID, 1)

Why did you need to add this?

---

<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 23, 2019, 1:31pm UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647/24 "2019-10-23T13:31:59Z")

</div>

Because otherwise the folder is created without a Display node, (No eye in the view)

---

<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 23, 2019, 1:33pm UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647/25 "2019-10-23T13:33:46Z")

</div>

Currently this is how you can set the folder visibility from code. The generic setItemVisibility uses CreateDefaultDisplayNodes in the displayable node and since the folder does not have a displayable node, it uses a function in the plugin that creates the special folder display node that is needed. I have not found a solution for this yet (and was not a high priority either).

@Alex_Vergara The folder visibility is considered by the displayable managers, so to fix show/hiding certain types of nodes in folders this has to be added to the corresponding displayable manager.

---

<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 23, 2019, 1:45pm UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647/26 "2019-10-23T13:45:11Z")

</div>

> [@Alex\_Vergara](#):
>
> The above does not work for tables, charts and plots, actually now is even worse than before:

The old behavior is still available: right-click on the eye icon and choose “Show all children” or “Hide all children”.

> [@cpinter](#):
>
> fix show/hiding certain types of nodes in folders this has to be added to the corresponding displayable manager.

How could we apply this to for example volumes, tables, and plots? They do not have displayable managers. Should the volumes plugin observe the parent folder visibility and change visibility accordingly (perform the same action when clicking on the eye icon of the individual SH item)?

---

<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 23, 2019, 1:59pm UTC](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647/27 "2019-10-23T13:59:19Z")

</div>

> [@lassoan](#):
>
> The old behavior is still available: right-click on the eye icon and choose “Show all children” or “Hide all children”

Very good point.

> [@lassoan](#):
>
> Should the volumes plugin observe the parent folder visibility and change visibility accordingly (perform the same action when clicking on the eye icon of the individual SH item)

Something like this would work. However I probably wouldn’t include volumes in this. Volumes did not change visibility in the past based on folder visibility, because they are so differently visualized. There is a ‘Show volumes in study’ option for this if I remember correctly.

[Previous page](https://discourse.slicer.org/t/visualization-bug-in-subject-hierarchy/8647.md?page=1)
