# Transform does not match VTM matrix array

**URL:** https://discourse.slicer.org/t/transform-does-not-match-vtm-matrix-array/12370
**Category:** Development
**Created:** [July 4, 2020, 2:49am UTC](https://discourse.slicer.org/t/transform-does-not-match-vtm-matrix-array/12370 "2020-07-04T02:49:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![talmazov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/talmazov/32/3966_2.png) [@talmazov](https://discourse.slicer.org/u/talmazov)
#### Post date: [July 4, 2020, 2:49am UTC](https://discourse.slicer.org/t/transform-does-not-match-vtm-matrix-array/12370/1 "2020-07-04T02:49:35Z")

</div>

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](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/f/1f839a512b013cf7e34c190b2daded916190db4a.png)

while VTK returns  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/7/47784d4473629db8d1ffcf5d894d41734fc6891a.png)

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

not sure what is going

---

<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: [July 4, 2020, 2:51am UTC](https://discourse.slicer.org/t/transform-does-not-match-vtm-matrix-array/12370/2 "2020-07-04T02:51:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![talmazov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/talmazov/32/3966_2.png) [@talmazov](https://discourse.slicer.org/u/talmazov)
#### Post date: [July 4, 2020, 3:25am UTC](https://discourse.slicer.org/t/transform-does-not-match-vtm-matrix-array/12370/3 "2020-07-04T03:25:24Z")

</div>

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

thanks!
