# Apply deformation field on source image to get the target image

**URL:** <https://discourse.itk.org/t/apply-deformation-field-on-source-image-to-get-the-target-image/5821>\
**Category:** Beginner Questions\
**Tags:** simpleitk, python\
**Created:** [March 22, 2023, 5:34pm UTC](https://discourse.itk.org/t/apply-deformation-field-on-source-image-to-get-the-target-image/5821 "2023-03-22T17:34:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xinyue](https://discourse.itk.org/user_avatar/discourse.itk.org/xinyue/32/3339_2.png) [@Xinyue](https://discourse.itk.org/u/Xinyue)\
**Post date:** [March 22, 2023, 5:34pm UTC](https://discourse.itk.org/t/apply-deformation-field-on-source-image-to-get-the-target-image/5821/1 "2023-03-22T17:34:40Z")

</div>

Hi all,

I am working on generating my own data, I have the deformation fired and the source image, and try to generate the target image. I found somewhere mentioned that it should be done with DisplacementFieldTransform (to make the deformation field) and resample (apply deformation field on source), but the process is really vague. It would be great if I could find more detail here.

Thank you

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [March 22, 2023, 5:45pm UTC](https://discourse.itk.org/t/apply-deformation-field-on-source-image-to-get-the-target-image/5821/2 "2023-03-22T17:45:24Z")

</div>

Hello @Xinyue,

Please read about transformations in general and the displacement field transform in particular in [this jupyter notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/22_Transforms.ipynb). The details about resampling are describe in [this notebook](https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Python/21_Transforms_and_Resampling.ipynb).

You may need to invert the transformation, depending on how you created it (details in the transformation notebook).
