Hi, I am testing out the repository script “Get a notification if a markup point position is modified”. It is working (stuff being printed in python console) in Slicer 4.10.1, but I am getting no notifications in the version I just compiled early this week. Any idea what is going on?
Below is the script.
def onMarkupsNodeModified(markupsNode, unusedArg2=None, unusedArg3=None):
sliceView = markupsNode.GetAttribute('Markups.MovingInSliceView')
if not sliceView:
print("Markup list was modified")
return
movingMarkupIndex = markupsNode.GetAttribute('Markups.MovingMarkupIndex')
pos = [0,0,0]
markupsNode.GetNthFiducialPosition(int(movingMarkupIndex), pos)
print("Markup {0} was moved in slice view {1} to {2}".format(movingMarkupIndex, sliceView, pos))
markupsNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode")
markupsNode.CreateDefaultDisplayNodes()
markupsNode.AddFiducial(0,0,0)
markupsNode.AddObserver(vtk.vtkCommand.ModifiedEvent, onMarkupsNodeModified)
There is still a problem for me that when I add the marksup in a transform, and this seems naver change unless ‘harden’ the transform.
So, is there any method to find wheater a marksup was in a transform already?
If you want to get notification about transform changes, you can observe vtkMRMLTransformableNode::TransformModifiedEvent.
For performance reasons, it is important to be able to observe point coordinates changes from node transform changes, but if we find that observing two events instead of only one puts unreasonable burden on developers then we can add a new “PointModifiedWorld” event.