Slicer does not show segmentation if multiple segmentations exists

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

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?

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:

1 Like

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 and specifically for folder visibility, here), and probably some of the documentation is still not updated.

1 Like

You can start by this script repository

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

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?

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.

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.

1 Like