# make output deformation smooth

**URL:** https://discourse.itk.org/t/make-output-deformation-smooth/921
**Category:** Uncategorized
**Created:** [May 11, 2018, 1:20pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921 "2018-05-11T13:20:13Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Borda](https://discourse.itk.org/user_avatar/discourse.itk.org/borda/32/347_2.png) [@Borda](https://discourse.itk.org/u/Borda)
#### Post date: [May 11, 2018, 1:20pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/1 "2018-05-11T13:20:13Z")

</div>

Hello, I would like to ask if there is a way how to make output deformation smooth fro further image warping. I was using Demon registration which gives me quite a wild deformation… see [GitHub-SimpleITK](https://github.com/SimpleITK/SimpleITK/issues/465#issuecomment-388041447)

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [May 11, 2018, 5:26pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/4 "2018-05-11T17:26:07Z")

</div>

Have you tries the diffeomorphic version of demons registration: [https://itk.org/SimpleITKDoxygen/html/classitk\_1\_1simple\_1\_1DiffeomorphicDemonsRegistrationFilter.html](https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1DiffeomorphicDemonsRegistrationFilter.html)  
That version is guaranteed to be invertible.

---

<div class="post-metadata">

### Author: ![Borda](https://discourse.itk.org/user_avatar/discourse.itk.org/borda/32/347_2.png) [@Borda](https://discourse.itk.org/u/Borda)
#### Post date: [May 11, 2018, 5:46pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/5 "2018-05-11T17:46:52Z")

</div>

well, it is significantly better but still there is discontinuity… how can I upload an image to show it?

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [May 11, 2018, 6:09pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/6 "2018-05-11T18:09:18Z")

</div>

When you hit reply what does it say?  
Have you tried pasting an image?

---

<div class="post-metadata">

### Author: ![Borda](https://discourse.itk.org/user_avatar/discourse.itk.org/borda/32/347_2.png) [@Borda](https://discourse.itk.org/u/Borda)
#### Post date: [May 11, 2018, 9:12pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/7 "2018-05-11T21:12:33Z")

</div>

the original deformations  
 ![deform](https://discourse.itk.org/uploads/default/original/1X/0bd0bfbad3984f6eca6c9f200bd7a2f13fae759d.png)  
inverse using `InverseDisplacementField`  
 ![deform_inv1](https://discourse.itk.org/uploads/default/original/1X/260216916a1dc02c0f675dc485c53db0c74ae6d2.jpg)  
inverse using `InvertDisplacementFieldImageFilter`  
 ![deform_inv2](https://discourse.itk.org/uploads/default/original/1X/28dc96757ab321be882e84ddc9593e88f22f2c5d.jpg)

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [May 11, 2018, 9:29pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/8 "2018-05-11T21:29:49Z")

</div>

Could you also visualize these by resampling a grid? There should be a grid image source filter to help.

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [May 11, 2018, 9:41pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/9 "2018-05-11T21:41:20Z")

</div>

There is also the iterative inverse: [https://itk.org/SimpleITKDoxygen/html/classitk\_1\_1simple\_1\_1IterativeInverseDisplacementFieldImageFilter.html](https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1IterativeInverseDisplacementFieldImageFilter.html)

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [May 13, 2018, 12:47pm UTC](https://discourse.itk.org/t/make-output-deformation-smooth/921/10 "2018-05-13T12:47:18Z")

</div>

To assess displacement fields, you can drag-and-drop the image and ITK transform file to 3D Slicer, go to [Transforms module](https://www.slicer.org/wiki/Documentation/Nightly/Modules/Transforms#Transform_display_options), and enable 2D and/or 3D visibility in Display section.

![image](https://discourse.itk.org/uploads/default/original/1X/7e3c60bede68ee18b0452b423f8f2ae529a67207.jpg)
