# Linear transforms to displacement field

**URL:** https://discourse.itk.org/t/linear-transforms-to-displacement-field/2992
**Category:** Beginner Questions
**Tags:** python
**Created:** [April 22, 2020, 3:08pm UTC](https://discourse.itk.org/t/linear-transforms-to-displacement-field/2992 "2020-04-22T15:08:33Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [April 22, 2020, 6:27pm UTC](https://discourse.itk.org/t/linear-transforms-to-displacement-field/2992/2 "2020-04-22T18:27:32Z")

</div>

You could [iterate](https://itk.org/ITKExamples/src/Core/Common/IterateRegionWithAccessToIndexWithWriteAccess/Documentation.html) through your desired deformation field image, and for each pixel check whether it belongs to one of the masks, and if so calculate displacement for it using [TransformContinuousIndexToPhysicalPoint and TransformPhysicalPointToIndex from image](https://discourse.itk.org/t/solved-transformindextophysicalpoint-manually/1031/10) and [TransformPoint](https://itk.org/Doxygen/html/classitk_1_1Transform.html#a4e2ff88e9abbf728d7320be5df203de0) from the corresponding linear transform. Pay attention to the direction of transform (moving to registered). Good luck!

---

_[View the full topic](https://discourse.itk.org/t/linear-transforms-to-displacement-field/2992)._
