# Transformation graph for quick calculation of concatenated transforms

**URL:** https://discourse.slicer.org/t/transformation-graph-for-quick-calculation-of-concatenated-transforms/326
**Category:** Development
**Created:** [May 16, 2017, 5:23pm UTC](https://discourse.slicer.org/t/transformation-graph-for-quick-calculation-of-concatenated-transforms/326 "2017-05-16T17:23:41Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![mangotee](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@mangotee](https://discourse.slicer.org/u/mangotee)
#### Post date: [May 16, 2017, 7:43pm UTC](https://discourse.slicer.org/t/transformation-graph-for-quick-calculation-of-concatenated-transforms/326/3 "2017-05-16T19:43:11Z")

</div>

> [@lassoan](#):
>
> slicer.vtkMRMLTransformNode.GetTransformBetweenNodes

Thanks a lot! This looks exactly like what I need. However, I have problems with executing the command. Given the example above, I tried the following:  
slicer.vtkMRMLTransformNode.GetTransformBetweenNodes(nT2SToT2.SafeDownCast(vtk.vtkGeneralTransform()), nHRToT1.SafeDownCast(vtk.vtkGeneralTransform()), T.SafeDownCast(vtk.vtkGeneralTransform()))

(note: I had to SafeDownCast() - all transforms are linear - to a vtkGeneralTransform. I could have tried the matrix4x4 version you mentioned, but I wanted to try the general approach for more complex scenarios later).  
The command runs, but the result is wrong as I receive the identity matrix.  
I also received the following warning in the log:  
Generic Warning: In /Users/kitware/Dashboards/Package/Slicer-462/Libs/MRML/Core/vtkMRMLTransformNode.cxx, line 472 vtkMRMLTransformNode::GetTransformToNode failed: transformSourceToTarget is invalid

Could you give a hint regarding the syntax?  
Thanks!

---

_[View the full topic](https://discourse.slicer.org/t/transformation-graph-for-quick-calculation-of-concatenated-transforms/326)._
