# How to create a composite transform

**URL:** <https://discourse.slicer.org/t/how-to-create-a-composite-transform/19416>\
**Category:** Development\
**Tags:** transforms, python\
**Created:** [August 30, 2021, 8:10pm UTC](https://discourse.slicer.org/t/how-to-create-a-composite-transform/19416 "2021-08-30T20:10:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atracsys-sbt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/atracsys-sbt/32/11434_2.png) [@atracsys-sbt](https://discourse.slicer.org/u/atracsys-sbt)\
**Post date:** [August 30, 2021, 8:10pm UTC](https://discourse.slicer.org/t/how-to-create-a-composite-transform/19416/1 "2021-08-30T20:10:12Z")

</div>

Hi,  
In my scripted module, up until now I have been using transform concatenation by applying a parent transform to another and then to a model. However, I would like to merge both transforms in a more permanent way and after some research, I saw that Slicer supports composite transforms, but I couldn’t find an example of this, even through the UI.  
Thanks for any help !

---

<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 30, 2021, 11:53pm UTC](https://discourse.slicer.org/t/how-to-create-a-composite-transform/19416/2 "2021-08-30T23:53:44Z")

</div>

You can create composite transform by hardening a transform on another.

---

<div class="post-metadata">

**Author:** ![atracsys-sbt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/atracsys-sbt/32/11434_2.png) [@atracsys-sbt](https://discourse.slicer.org/u/atracsys-sbt)\
**Post date:** [August 31, 2021, 8:20am UTC](https://discourse.slicer.org/t/how-to-create-a-composite-transform/19416/3 "2021-08-31T08:20:18Z")

</div>

Indeed, but apparently this does not work for a transform that changes constantly like one streamed from openIGTlink for example. If the streamed transform is the parent, it hardens the child transform given the values at the exact moment of the hardening. If it’s reverse, the hardening does not hold since the child transform is constantly updated.

---

<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 31, 2021, 1:29pm UTC](https://discourse.slicer.org/t/how-to-create-a-composite-transform/19416/4 "2021-08-31T13:29:04Z")

</div>

Yes, this is how it works. Hardening would not make sense for constantly changing transforms. You probably want to combine transforms (compute an output transform by combining input transforms) using “Combine transforms” module in SlicerIGT extension.

---

<div class="post-metadata">

**Author:** ![atracsys-sbt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/atracsys-sbt/32/11434_2.png) [@atracsys-sbt](https://discourse.slicer.org/u/atracsys-sbt)\
**Post date:** [August 31, 2021, 1:46pm UTC](https://discourse.slicer.org/t/how-to-create-a-composite-transform/19416/5 "2021-08-31T13:46:30Z")

</div>

All right, thanks for clarifying !
