Change data-transform hierarchy nodes

Hi there!
I’m trying to find how can I with python change transform hierarchy of the scene, and all I was able to find is only how to change subject hierarchy:
sceneItemID = shn.GetSceneItemID()
shn = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
subjectItemID = shn.GetItemChildWithName(sceneItemID, ‘volume3-TrackerToProbe’)
subjectItemID2 = shn.GetItemChildWithName(sceneItemID, ‘NeedleModel_1’)

Can someone please guide me how to change transform hierarchy nodes? Many thanks!

Subject hierarchy is for organizing your data, but it has no effect in terms of transforms. Here’s how you can apply the transform:

transformNode = slicer.util.getNode(‘volume3-TrackerToProbe’)
needleModelNode = slicer.util.getNode(‘NeedleModel_1’)
1 Like

Thank you so much, that worked!

1 Like