# ThinPlateSplineWarp using landmarks

**URL:** https://discourse.itk.org/t/thinplatesplinewarp-using-landmarks/5413
**Category:** Beginner Questions
**Tags:** registration, cpp, transformfileread
**Created:** [October 13, 2022, 3:42pm UTC](https://discourse.itk.org/t/thinplatesplinewarp-using-landmarks/5413 "2022-10-13T15:42:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nicolas\_Loiseau](https://discourse.itk.org/user_avatar/discourse.itk.org/nicolas_loiseau/32/2994_2.png) [@Nicolas\_Loiseau](https://discourse.itk.org/u/Nicolas_Loiseau)
#### Post date: [October 13, 2022, 3:42pm UTC](https://discourse.itk.org/t/thinplatesplinewarp-using-landmarks/5413/1 "2022-10-13T15:42:46Z")

</div>

Hello everything,  
I am new to this forum, so please forgive me if my post is not consistent.  
I’m using itk c++. My goal is to register two volumes with non rigid transformation (nifti volumes, from a medical dataset), I have two volumes and two sets of landmarks, one for each volumes.

Firstly I tried to use [https://itk.org/Doxygen413/html/WikiExamples\_2Registration\_2LandmarkBasedTransformInitializer\_8cxx-example.html#\_a5](https://itk.org/Doxygen413/html/WikiExamples_2Registration_2LandmarkBasedTransformInitializer_8cxx-example.html#_a5) this example, but it give me nothing really good.

So i tried to use this example:  
[https://itk.org/Doxygen/html/Examples\_2RegistrationITKv4\_2ThinPlateSplineWarp\_8cxx-example.html#\_a4](https://itk.org/Doxygen/html/Examples_2RegistrationITKv4_2ThinPlateSplineWarp_8cxx-example.html#_a4)  
And here is the result, the moved image (called FixedImageReader in my code) and the fixed image.

 ![Screenshot from 2022-10-13 17-40-09](https://discourse.itk.org/uploads/default/original/2X/4/4e98d76c53b9a0d4272fe2610e4a6ecdd9ed834a.png)

Can you help me to understand where i made a mistake ?  
Probably in the origin when i write the resampled image ?  
Thank you for your help.

[Code.cxx](https://discourse.itk.org/uploads/short-url/b6Ffcqlf7W2VCNKOlMwUNPss4jT.cxx) (10.5 KB)  
[pts.txt](https://discourse.itk.org/uploads/short-url/rEvEO6aLwyioJaOsTl6gDTkOsNU.txt) (1.6 KB)  
I put my code and my landmarks file.
