Issue when enabling the new interaction transform handler using script

Hi,

I met a strange issue when I tried to enable interaction transform handler using script using the newest preview Slicer 5.7.0-2024-05-28 in Mac.

The command interactionTransformNode.GetDisplayNode().SetEditorVisibility(True) can only enable the interaction transform handler when I switched to the Transforms module.

If I just created a blank vtkMRMLTransform node in the Data module, add the volume to the transform, then do interactionTransformNode.GetDisplayNode().SetEditorVisibility(True), it would not find SetEditorVisibility attribute. For example:

headNode = slicer.util.getNode('MRHead')
interactionTransformNode =  slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformNode', "interaction_transform")
headNode.SetAndObserveTransformNodeID(self.interactionTransformNode.GetID())
interactionTransformNode.GetDisplayNode().SetEditorVisibility(True)

It would report:

Switching to the Transform module and the SetEditorVisibility(True) ran well to enable the interaction handle (see Python console).

I do not currently have access to Windows, but I believe I did not encounter an error in Windows.

You need to create the display node before trying to access it.

interactionTransformNode.CreateDefaultDisplayNodes()
1 Like

Thank you! It’s been solved!