Hello,
Is it possible to create two Transform handles for one model?
I have tried to make it work with the video using the code below, but only one handle works while the other does not function properly.
Am I missing something? Any advice would be greatly appreciated.
scanNode = slicer.util.getNode("scan")
lowerNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformNode', 'lower')
upperNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformNode', 'upper')
def applyUpper(*_unused):
scanNode.SetAndObserveTransformNodeID(None)
lowerNode.SetAndObserveTransformNodeID(upperNode.GetID())
scanNode.SetAndObserveTransformNodeID(lowerNode.GetID())
def applyLower(*_unused):
scanNode.SetAndObserveTransformNodeID(None)
upperNode.SetAndObserveTransformNodeID(lowerNode.GetID())
scanNode.SetAndObserveTransformNodeID(upperNode.GetID())
lowerNode.CreateDefaultDisplayNodes()
lowerNode.SetCenterOfTransformation(0,0,-12)
lowerNode.GetDisplayNode().SetEditorVisibility(True)
lowerNode.AddObserver(slicer.vtkMRMLTransformNode.TransformModifiedEvent, applyLower)
upperNode.CreateDefaultDisplayNodes()
upperNode.SetCenterOfTransformation(0,0,2)
upperNode.GetDisplayNode().SetEditorVisibility(True)
upperNode.AddObserver(slicer.vtkMRMLTransformNode.TransformModifiedEvent, applyUpper)
P.S. The Transform handle added in Slicer 5.7 is fantastic.