Transform does not match VTM matrix array

I am obtaining a plane’s transform matrix then trying to use it elsewhere

transform = slicer.vtkMRMLTransformNode()
transform.SetName(model.GetName()+‘_trans’)
slicer.mrmlScene.AddNode(transform)
model.SetAndObserveTransformNodeID(transform.GetID())
my_matrix = transform.GetMatrixTransformFromParent()
xmlmx = slicer.util.arrayFromVTKMatrix(my_matrix)

the transform in slicer is
image

while VTK returns
image

it seems like we not only need to transpose the matrix but the location values do not match up

not sure what is going

TransformFromParent is the resampling transform (for transforming images). TransformToParent is the modeling transform (for transforming, points, meshes, etc.). Probably you are interested in TransformToParent.

changed to
transform.GetMatrixTransformToParent()
and it worked very well!

thanks!

1 Like