Get relative translation and rotation of two models

You can get Euler angles orientation matrix using this code snippet:

transformNode = getNode('LinearTransform_3')
transformMatrix = vtk.vtkMatrix4x4()
transformNode.GetMatrixTransformToParent(transformMatrix)
transform = vtk.vtkTransform()
transform.SetMatrix(transformMatrix)
orientation = transform.GetOrientation()
print(orientation)

Note that the same orientation can be encoded using many different combinations of rotations, even Euler angles have many variants.

If you need to use a particular convention then you can implement the angle computations from the corresponding mathematical formulae directly you can access orientation matrix element in the transformMatrix object in the example above.

1 Like