# Apply deformation to the 3D-CT image volume from mesh displacement

**URL:** https://discourse.itk.org/t/apply-deformation-to-the-3d-ct-image-volume-from-mesh-displacement/5338
**Category:** Beginner Questions
**Tags:** itk, python, simpleitk
**Created:** [September 16, 2022, 2:42pm UTC](https://discourse.itk.org/t/apply-deformation-to-the-3d-ct-image-volume-from-mesh-displacement/5338 "2022-09-16T14:42:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lakmy](https://discourse.itk.org/user_avatar/discourse.itk.org/lakmy/32/2938_2.png) [@lakmy](https://discourse.itk.org/u/lakmy)
#### Post date: [September 16, 2022, 2:42pm UTC](https://discourse.itk.org/t/apply-deformation-to-the-3d-ct-image-volume-from-mesh-displacement/5338/1 "2022-09-16T14:42:18Z")

</div>

I have a reference mesh and a deformed version of it (they are unstrcuted grid saved in vtk file format). The reference mesh was acquired from a 3D-CT volume.  
I would want to apply the same deformation to the reference 3D-CT volume so that it align with the deformed mesh configuration.

Any help/code would be appreciated.

I have herewith shared a sample reference mesh, deformed mesh and corresponding reference CT volume in the link given below for your further consideration.

> **[sample\_data.zip](https://drive.google.com/file/d/1opb2Hz85RoHrCqrfWtZ-EsjHoEkwIhLd/view?usp=sharing)**
>
> Google Drive file.

---

<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: [September 16, 2022, 3:30pm UTC](https://discourse.itk.org/t/apply-deformation-to-the-3d-ct-image-volume-from-mesh-displacement/5338/2 "2022-09-16T15:30:23Z")

</div>

Hello @lakmy,

To allow you to resample the reference CT on which the reference mesh is defined you need to estimate the transformation between the deformed mesh to the reference mesh, it maps the points from the deformed mesh onto the reference mesh. The only option in SimpleITK is to use the [LandmarkBasedTransformInitializerFilter](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1LandmarkBasedTransformInitializerFilter.html) to compute a [BSplineTransform](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1BSplineTransform.html).

In your case the points from the reference mesh are the `MovingLandmarks` and the corresponding points from the deformed mesh are the `FixedLandmarks`. Once you compute the BSplineTransform you can resample the reference CT using the [ResampleImageFilter](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ResampleImageFilter.html).

Before starting to write any code I would recommend looking into the use of [3D Slicer](https://www.slicer.org/) for this task.
