I have an issue where indeed I can set the entire segmentation to not be visible via vtkMRMLSegmentationNode by doing:
display = segmentation.GetDisplayNode()
However, whenever I attempt to set a particular segment to not be visible by doing:
The segment is still visible to me. When I attempt accessing the node through Python I indeed see that the Visibility for the segment has been set to false, however why is the segment still appearing on my views?
Am I missing some code here?
What Slicer version do you use?
I tried a recent nightly, and the same code works for me. Is it possible that you try to use the name of the segment and not its ID? If you rename a segment then its ID will still be the original ‘Segment_1’ for example, and GetSegmentVisibility will return a simple False on invalid ID as well (but an error appears in the log saying “GetSegmentVisibility: No display properties found for segment with ID artery”).
What if you do this instead?