I am trying to write a function that is triggered when the user selects a different segmentation in the segment editor module. I searched for such event methods but could not find the right one. My guess is that there is an event for the DisplayNode of the corresponding segmentation that is triggered when selecting a different segmentation. I tried to add an observer to each segmentation node like this without success.
# I tried this
segmentationNode.AddObserver(slicer.vtkMRMLSegmentationNode.SegmentationChangedEvent, self.onSegChanged)
# and this
segmentationNode.AddObserver(slicer.vtkMRMLSegmentationDisplayNode.MenuEvent, self.onSegChanged)
Here is a screenshot to further illustrate what I want to achieve.
I want to create an event method that triggers when “Segmentation_1” is changed to a different segmentation.
Thanks for the help in advance