I am trying to execute a function after a fiducial marker is placed. I was trying to implement it with this:
def onMarkupEndInteraction(caller, event):
# Do stuff
pass
interactionNode = slicer.app.applicationLogic().GetInteractionNode()
selectionNode = slicer.app.applicationLogic().GetSelectionNode()
selectionNode.SetReferenceActivePlaceNodeClassName("vtkMRMLMarkupsFiducialNode")
pointListNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode")
pointListNode.AddObserver(interactionNode.EndPlacementEvent, onMarkupEndInteraction)
selectionNode.SetActivePlaceNodeID(pointListNode.GetID())
interactionNode.SetCurrentInteractionMode(1)
however, it seems to be executing onMarkupEndInteration
before the fiducial marker is placed. I have been trying many different methods (as there are many different ways to initialize and place fiducial markers), but none seem to properly execute the observer
for the fiducial marker.