I am trying to add an observer to a segmentation node to keep track of any modifications to any segment (by modifications I mean manual changes to the contouring). The idea is to have a marker of any modifications so if the user changes subject (for which I have a QComboBox in my module), I can prompt the user to save before changing patients. This is to avoid any accidental subject changes and losing unsaved work.
I have been trying many different things. Something close is this:
segmentationNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLSegmentationNode') segmentationNode.AddObserver(segmentationNode.GetSegmentation().SegmentModified,onSegmentModified)
But this only activates onSegmentModified() when I add, remove, rename, change color of, etc… a Segment. What is the signal produced when the actual contouring changes? Is this something that can be done?