# Closed form invertible displacement field function for testing toy problems

**URL:** <https://discourse.itk.org/t/closed-form-invertible-displacement-field-function-for-testing-toy-problems/7481>\
**Category:** Uncategorized\
**Created:** [March 27, 2025, 6:09am UTC](https://discourse.itk.org/t/closed-form-invertible-displacement-field-function-for-testing-toy-problems/7481 "2025-03-27T06:09:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![reox](https://discourse.itk.org/user_avatar/discourse.itk.org/reox/32/4490_2.png) [@reox](https://discourse.itk.org/u/reox)\
**Post date:** [March 27, 2025, 6:09am UTC](https://discourse.itk.org/t/closed-form-invertible-displacement-field-function-for-testing-toy-problems/7481/1 "2025-03-27T06:09:17Z")

</div>

I need to test some algorithm which does some inversion and interpolation of an image transformation using the displacement field.  
To get some baseline numbers, I would like to test it on a displacement field transformation, which is generated from an invertible function - so that I can calculate the inverted displacement field myself.  
My only requirements on the function are:

- Inversion can be given in closed form
- The deformation gradient can be calculated from the inverted function
- It should be a “non trivial” transformation, especially I require the rotational tensor of the deformation gradient to be dependent on the position in the image, i.e., it should not be constant.

I had a look for such functions, and would assume something like this exists for benchmark and toy problems, but so far I had no luck… Maybe I’m just searching for the wrong terms…  
I would be very grateful for any resource on that topic!

---

<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:** [March 27, 2025, 3:22pm UTC](https://discourse.itk.org/t/closed-form-invertible-displacement-field-function-for-testing-toy-problems/7481/2 "2025-03-27T15:22:41Z")

</div>

@ntustison @hjmjohnson @Niels_Dekker might have some advice.

---

<div class="post-metadata">

**Author:** ![reox](https://discourse.itk.org/user_avatar/discourse.itk.org/reox/32/4490_2.png) [@reox](https://discourse.itk.org/u/reox)\
**Post date:** [March 27, 2025, 4:00pm UTC](https://discourse.itk.org/t/closed-form-invertible-displacement-field-function-for-testing-toy-problems/7481/3 "2025-03-27T16:00:16Z")

</div>

Thanks! I would be glad to know if there is a neat function known in computer science especially for image trasnformation! To give some more context: Usually there is a b-spline transformation involved, which I need to invert by using the displacement field.

I remembered a poster I had seen on a conference regarding method of manufactured solutions for the verification of finite element solvers. The poster references Aycock _et al._ [[1]](https://doi.org/10.1016/j.compstruc.2019.106175) which used this displacement field:  
u(\mathbf{x}) = C\_i \sin (n\pi x\_1)\sin(n \pi x\_2)\sin(n\pi x\_3) in a unit cube with arbitrary constants C\_i and n.

I quickly implemented a function that creates a displacement field transformation from that function and calculates the rotational tensor at any point.  
~~I’m not sure though how I would go around and invert the displacement field to get the inverse transform… Uhm, do I have to do the Piola transformation to get the inverse of the displacement field? i.e. U=\text{det}(F) F^{-1}u? With Mathematica that gets me to the same equation 🤔 I also tried with some polynomial functions, where this is not the case… Are trig functions of advantage here, as they have this property?~~

edit: I think I have figured that part out. So actually, I apply a deformation \chi: X \mapsto x which can be described by a displacement field U(X) and get the points in the deformed configuration as x = U(X) + X. The inversion of the deformation \chi^{-1}: x \mapsto X is simply given by negating the displacement field - is that correct?

---

<div class="post-metadata">

**Author:** ![reox](https://discourse.itk.org/user_avatar/discourse.itk.org/reox/32/4490_2.png) [@reox](https://discourse.itk.org/u/reox)\
**Post date:** [March 29, 2025, 9:04am UTC](https://discourse.itk.org/t/closed-form-invertible-displacement-field-function-for-testing-toy-problems/7481/4 "2025-03-29T09:04:35Z")

</div>

> simply given by negating the displacement field - is that correct?

no 😃 That would only be the case for a simple translation.

I have tested a few things without the inversion step, which looked promising so far. I still haven’t figured out yet a function that isn’t too hard to invert in closed form and gives a deformation field that is “interesting”. But I also haven’t found any benchmark/toy problems either. How is that done in practice, if you, for example, want to verify a numerical inversion is correct?
