# Induce deformation

**URL:** <https://discourse.slicer.org/t/induce-deformation/17446>\
**Category:** Development\
**Created:** [May 4, 2021, 4:00pm UTC](https://discourse.slicer.org/t/induce-deformation/17446 "2021-05-04T16:00:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jakub_mitura/32/8858_2.png) [@Jakub\_Mitura](https://discourse.slicer.org/u/Jakub_Mitura)\
**Post date:** [May 4, 2021, 4:00pm UTC](https://discourse.slicer.org/t/induce-deformation/17446/1 "2021-05-04T16:00:28Z")

</div>

Hello I would like to induce some deformation and changes in an PET/CT image preferably programmatically for example elastically deform aorta , add some gas bubbles, change size of the inflammatory infiltration … I want to use it for some data augmentation.  
How best to approach this (for example what library to use, better in C+ or python - as far as i know there is/was limitad capability to load external libraries in python, some extension … ?)

Thank You for help !

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 4, 2021, 4:53pm UTC](https://discourse.slicer.org/t/induce-deformation/17446/2 "2021-05-04T16:53:00Z")

</div>

Some of that can already be done with TorchIO, and maybe you can expand it to add some extra features.

> **[fepegar/SlicerTorchIO](https://github.com/fepegar/SlicerTorchIO)**
>
> 3D Slicer module for TorchIO. Contribute to fepegar/SlicerTorchIO development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jakub_mitura/32/8858_2.png) [@Jakub\_Mitura](https://discourse.slicer.org/u/Jakub_Mitura)\
**Post date:** [May 4, 2021, 4:59pm UTC](https://discourse.slicer.org/t/induce-deformation/17446/3 "2021-05-04T16:59:24Z")

</div>

Thank you! Yes I would like to contribute in case you would have some clues where to start, you can let me know 🙂

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 4, 2021, 5:01pm UTC](https://discourse.slicer.org/t/induce-deformation/17446/4 "2021-05-04T17:01:02Z")

</div>

I’m hoping @Fernando can jump in with more details.

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [May 4, 2021, 5:08pm UTC](https://discourse.slicer.org/t/induce-deformation/17446/5 "2021-05-04T17:08:26Z")

</div>

Thanks, Steve.

@Jakub_Mitura, I suggest you use Python for data augmentation. As @pieper said, TorchIO can be used for e.g. random elastic deformations. The transforms you’re after are quite level and problem-specific, so they would require some work. You can start by checking the [tutorials](https://github.com/fepegar/torchio/tree/master/notebooks) that demonstrate how to use some of the transforms during training.

You can use Slicer to visualize your results or try the transforms parameters. If you have more questions that unrelated to Slicer, you can [open a discussion in the TorchIO repository](https://github.com/fepegar/torchio/discussions).

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jakub_mitura/32/8858_2.png) [@Jakub\_Mitura](https://discourse.slicer.org/u/Jakub_Mitura)\
**Post date:** [May 4, 2021, 5:11pm UTC](https://discourse.slicer.org/t/induce-deformation/17446/6 "2021-05-04T17:11:30Z")

</div>

Ok thanks ! So i will dive into it slowly and when I will achieve sth i will share the results with you, in case i will get stuck i will post as you suggested, thanks!
