# Deformable registration between two CTs

**URL:** <https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564>\
**Category:** Support\
**Created:** [November 10, 2021, 1:57pm UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564 "2021-11-10T13:57:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![alan6690](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@alan6690](https://discourse.slicer.org/u/alan6690)\
**Post date:** [November 10, 2021, 1:57pm UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/1 "2021-11-10T13:57:12Z")

</div>

Hello. I am a new user of 3D slicer. I am trying to deformably register a set of CBCT with regular CT. However, the CBCT has a much smaller FOV so that there is a large dark region outside the FOV, in which regular CT does not have. And it seems that this incoherent region between the two image sets causes some undesirable deformation during registration.

I am looking for a way to circularly crop the regular CT so that both CT and CBCT have the same FOV. Or is there anyway to define a ROI to be used during registration so that only the anatomy within the ROI would be deformed?

Thank you.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 11, 2021, 3:48am UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/2 "2021-11-11T03:48:04Z")

</div>

To get started, have a look at [this documentation section](https://slicer.readthedocs.io/en/latest/user_guide/registration.html#automatic-image-registration). Align the volumes and crop the volumes to the same anatomical region. Additional mask can be defined to exclude small region, such as screws, implants, fiducial markers, etc.

---

<div class="post-metadata">

**Author:** ![alan6690](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@alan6690](https://discourse.slicer.org/u/alan6690)\
**Post date:** [November 12, 2021, 12:14am UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/3 "2021-11-12T00:14:19Z")

</div>

I tried create mask by scissors tool in segment editor module. But it seems that I can only apply the mask directly onto the volume and crop it, instead of applying on the the registration aglorithm. Would you mind give me some lead? Thank you.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 12, 2021, 1:35am UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/4 "2021-11-12T01:35:33Z")

</div>

Registration algorithms usually require the mask to be specified as a labelmap volume. You can export the segmentation to labelmap by right-clicking on it in Data module.

---

<div class="post-metadata">

**Author:** ![alan6690](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@alan6690](https://discourse.slicer.org/u/alan6690)\
**Post date:** [November 13, 2021, 5:38am UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/5 "2021-11-13T05:38:02Z")

</div>

Thank you so much. Exporting as a labelmap works well for my case.

---

<div class="post-metadata">

**Author:** ![alan6690](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@alan6690](https://discourse.slicer.org/u/alan6690)\
**Post date:** [November 16, 2021, 3:16am UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/6 "2021-11-16T03:16:18Z")

</div>

The deformation is performed very well now. However, I don’t know why after every deformation the moving image is shifted longitudinally for a bit (inf-sup direction) and I have to manually adjust the IS transformtion so that two images are matched slice-to-slice. Not a big problem though. I just wonder what causes this transformation. Very much appreciated if you can give some suggestion. Thank you.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 16, 2021, 6:22am UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/7 "2021-11-16T06:22:21Z")

</div>

Which module did you end up using for registration?  
Can you attach a screenshot that demonstrates the image shift?

---

<div class="post-metadata">

**Author:** ![alan6690](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@alan6690](https://discourse.slicer.org/u/alan6690)\
**Post date:** [November 16, 2021, 2:56pm UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/8 "2021-11-16T14:56:18Z")

</div>

![CB](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/a/3af775b795c1ac7c3ffaeff2e2ba92524aecd3ee.jpeg)  
 ![PL](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/0/3028ae953032c4e3f824a6ebec56f5eb38d79787.jpeg)

I am using the preset of “generic (all)” of general registration (Elastix) to do the deformation. The picture shows the translational error between the fixed image(53\_CB\_spacing\_lung) and already deformed image (53\_PL\_CB\_deformed). The segment in green is what I applied as a labelmap for the deformation, whereas the ROI boxes in two pictures outlines the border of two images respectively.

As both images have the same dimension, I wonder if this translational error would persist if I export the images as DICOM for further usage? Or it only appears when I view the image in the 3D slicer application?

Thank you.

---

<div class="post-metadata">

**Author:** ![alan6690](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@alan6690](https://discourse.slicer.org/u/alan6690)\
**Post date:** [November 16, 2021, 3:32pm UTC](https://discourse.slicer.org/t/deformable-registration-between-two-cts/20564/9 "2021-11-16T15:32:13Z")

</div>

The problem seems to come from that the output deformed volume is not automatically centered in the application after the deformation. But it does not affect the exported DICOM image. The visually mismatch in the application can be simply solved by manual centering in the Volume module. I would suggest automatic centering of the output deformed volume to be enabled in the future for convenience. Thank you for you help.
