Hi all,
I would like to set and control a linear transformation from python.
I created a linear transformation via the module GUI and then I changed a parameter (just to do a test).
If I run this code nothing changes in the GUI (I would expect a reset to an identity matrix):
t = slicer.mrmlScene.GetFirstNodeByName(“LinearTransform”)
m = vtk.vtkMatrix4x4()
t.SetMatrixTransformToParent(m)
Maybe slicer.mrmlScene.GetFirstNodeByName() does not return you the transform that you expect because you have multiple transforms by that name in the scene.
By default, 3 transforms are created for some built-in nodes (cameras or slices). But other modules can create transforms by using any names any time, so GetFirstNodeByName is only recommended for debugging or testing.