# Transform processor module

**URL:** <https://discourse.slicer.org/t/transform-processor-module/12925>\
**Category:** Support\
**Tags:** transforms\
**Created:** [August 10, 2020, 12:52pm UTC](https://discourse.slicer.org/t/transform-processor-module/12925 "2020-08-10T12:52:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Selva](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Selva](https://discourse.slicer.org/u/Selva)\
**Post date:** [August 10, 2020, 12:52pm UTC](https://discourse.slicer.org/t/transform-processor-module/12925/1 "2020-08-10T12:52:58Z")

</div>

Hi,

I am trying to decompose a linear transformation into rotation and translation components.  
What could be the easiest way to do this please.  
I have tried the transform processor module, but I am not sure what are the two input transforms to enter. I only have one, that is generated from model registration. (model A to model b registration, generated linear transform 3). What I m interested is the the angular and translational difference between model a and b separated.

Thanks

---

<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:** [August 10, 2020, 1:15pm UTC](https://discourse.slicer.org/t/transform-processor-module/12925/2 "2020-08-10T13:15:49Z")

</div>

Transform processor provides translation vector and orientation matrix. If you need translation magnitude in a single mm value or representation of the total rotation in degrees (or rotation along specific axes) then you need to compute it from the transformation matrix using basic linear algebra. Note that rotation error in itself is often clinically not meaningful, as the error it causes depends on how far the coordinate system is from the region of interest.

If you write more about what exactly you want to evaluate, how the coordinate systems are defined, how transforms are computed between them, etc. then we may be able to give more specific advice.

---

<div class="post-metadata">

**Author:** ![Selva](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Selva](https://discourse.slicer.org/u/Selva)\
**Post date:** [August 11, 2020, 8:46am UTC](https://discourse.slicer.org/t/transform-processor-module/12925/3 "2020-08-11T08:46:51Z")

</div>

Thanks @lassoan

This helps

---

<div class="post-metadata">

**Author:** ![reddington.15](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reddington.15](https://discourse.slicer.org/u/reddington.15)\
**Post date:** [March 22, 2021, 1:56pm UTC](https://discourse.slicer.org/t/transform-processor-module/12925/4 "2021-03-22T13:56:09Z")

</div>

I know you aren’t a math professor, but how would one calculate the the translation magnitude or total rotation in degrees from the transformation matrix using linear algebra?

---

<div class="post-metadata">

**Author:** ![JBeninca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jbeninca/32/10039_2.png) [@JBeninca](https://discourse.slicer.org/u/JBeninca)\
**Post date:** [August 29, 2023, 6:24pm UTC](https://discourse.slicer.org/t/transform-processor-module/12925/5 "2023-08-29T18:24:28Z")

</div>

ok. the module works ok. but when its over, and i clear the scene, when the module is opened againg, by script, the 3dslice fails, and finally close  
the version i am using is 4.11.20210226 r29738 / 7a593c8

thanks for any suggestion.

ad:  
the code i am using is:

```python
def crea_nodo_Transform_Processor(nombre, transfo_in, transfo_out, param):
    transfo_in = slicer.util.getNode(transfo_in)
    transfo_out = slicer.util.getNode(transfo_out)
        
    transfoProcNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformProcessorNode')
    transfoProcNode.SetName(nombre)
    transfoProcNode.SetProcessingMode(transfoProcNode.PROCESSING_MODE_STABILIZE)
    transfoProcNode.SetStabilizationCutOffFrequency(param["filtro_transformada"])
    transfoProcNode.SetAndObserveInputUnstabilizedTransformNode(transfo_in)
    transfoProcNode.SetAndObserveOutputTransformNode(transfo_out)
    transfoProcNode.SetUpdateModeToAuto()

```

thanks
