# Transform Matrix calculated by GetMatrixTransformBetweenNodes

**URL:** <https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069>\
**Category:** Development\
**Created:** [September 11, 2018, 3:42pm UTC](https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069 "2018-09-11T15:42:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxzhou](https://avatars.discourse-cdn.com/v4/letter/x/13edae/32.png) [@xxzhou](https://discourse.slicer.org/u/xxzhou)\
**Post date:** [September 11, 2018, 3:42pm UTC](https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069/1 "2018-09-11T15:42:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 11, 2018, 6:04pm UTC](https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069/2 "2018-09-11T18:04:45Z")

</div>

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](https://discourse.slicer.org/t/transformation-graph-for-quick-calculation-of-concatenated-transforms/326/5?u=lassoan)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [September 11, 2018, 6:10pm UTC](https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069/3 "2018-09-11T18:10:39Z")

</div>

@xxzhou Please do not post the same question [more than once](https://discourse.slicer.org/t/transformation-graph-for-quick-calculation-of-concatenated-transforms/326/10?u=cpinter). You won’t have a higher chance for it to be answered. Thanks.

---

<div class="post-metadata">

**Author:** ![xxzhou](https://avatars.discourse-cdn.com/v4/letter/x/13edae/32.png) [@xxzhou](https://discourse.slicer.org/u/xxzhou)\
**Post date:** [September 11, 2018, 6:48pm UTC](https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069/4 "2018-09-11T18:48:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [September 11, 2018, 6:53pm UTC](https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069/5 "2018-09-11T18:53:22Z")

</div>

> [@xxzhou](#):
>
> sorry for this problem! I will not do that again.

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.

---

<div class="post-metadata">

**Author:** ![xxzhou](https://avatars.discourse-cdn.com/v4/letter/x/13edae/32.png) [@xxzhou](https://discourse.slicer.org/u/xxzhou)\
**Post date:** [September 11, 2018, 6:56pm UTC](https://discourse.slicer.org/t/transform-matrix-calculated-by-getmatrixtransformbetweennodes/4069/6 "2018-09-11T18:56:23Z")

</div>

Sure, thank you 😁  
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.
