I have solved by forcing the view to display another node
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
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.
The old behavior is still available: right-click on the eye icon and choose “Show all children” or “Hide all children”.
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)?
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.