Transform Matrix calculated by GetMatrixTransformBetweenNodes

Hi!

I am new for 3D Slicer, and when I want to use GetMatrixTransformBetweenNodes to calculate transform matrix from source to target, I found that the input “source”&“target” are both vtkMRMLTransformNode.

However, I usually use
source = getNode(’’)
target = getNode(’’), which are vtkMRMLScalarVolumeNode.

I am wondering how to change vtkMRMLScalarVolumeNode to vtkMRMLTransformNode.
Any inference is welcomed!

Thank you!

Best regards,
xxzhou

GetMatrixTransformBetweenNodes() needs parent transform nodes of your nodes, so you need to use source.GetParentTransformNode() and target.GetParentTransformNode(). See details in this related post: Transformation graph for quick calculation of concatenated transforms

@xxzhou Please do not post the same question more than once. You won’t have a higher chance for it to be answered. Thanks.

Hi, sorry for this problem! I will not do that again.
Thank you for your remind!

Thanks for understanding.

As a side note, if you have idea how we could update the forum to better convey the idea of “one post → one question”. Do not hesitate to create a new topic for discussing it.

Sure, thank you :grin:
Appreciate 3D Slicer Forum that you provide very efficient help for us. I am working on the information you provide for me. Thanks a lot!
If solved, I will come back to post it.

1 Like