# How to use Transforms module in Python

**URL:** <https://discourse.slicer.org/t/how-to-use-transforms-module-in-python/31171>\
**Category:** Development\
**Created:** [August 16, 2023, 12:08pm UTC](https://discourse.slicer.org/t/how-to-use-transforms-module-in-python/31171 "2023-08-16T12:08:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xinyue](https://avatars.discourse-cdn.com/v4/letter/x/ed655f/32.png) [@Xinyue](https://discourse.slicer.org/u/Xinyue)\
**Post date:** [August 16, 2023, 12:08pm UTC](https://discourse.slicer.org/t/how-to-use-transforms-module-in-python/31171/1 "2023-08-16T12:08:37Z")

</div>

Hi,

I was trying to deform a image and I have my image and deformation vector field in mhd files. I am wondering if there is anyway I could use python to do exactly like the Slicer does in its GUI.

It would be great appreciate if there is any sample code I could learn from.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/a/ba92b2155eb76c999c902c477f9951904b65ea41.png)

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [August 17, 2023, 1:18pm UTC](https://discourse.slicer.org/t/how-to-use-transforms-module-in-python/31171/2 "2023-08-17T13:18:15Z")

</div>

> [@Xinyue](#):
>
> Hi,
> 
> I was trying to deform a image and I have my image and deformation vector field in mhd files. I am wondering if there is anyway I could use python to do exactly like the Slicer does in its GUI.
> 
> It would be great appreciate if there is any sample code I could learn from.

Here is what GPT-4 with the VoxScript plugin enabled suggests:

[https://chat.openai.com/share/8edc1d2f-9e7e-4677-8940-54d9806b82ad](https://chat.openai.com/share/8edc1d2f-9e7e-4677-8940-54d9806b82ad)

The [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html) is also a good place to start searching for Transform code.
