# Register axial 3d to STIR sequence space

**URL:** <https://discourse.itk.org/t/register-axial-3d-to-stir-sequence-space/4758>\
**Category:** Algorithms\
**Tags:** simpleitk, registration, python\
**Created:** [January 27, 2022, 9:54am UTC](https://discourse.itk.org/t/register-axial-3d-to-stir-sequence-space/4758 "2022-01-27T09:54:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmericaBG](https://discourse.itk.org/user_avatar/discourse.itk.org/americabg/32/1925_2.png) [@AmericaBG](https://discourse.itk.org/u/AmericaBG)\
**Post date:** [January 27, 2022, 9:54am UTC](https://discourse.itk.org/t/register-axial-3d-to-stir-sequence-space/4758/1 "2022-01-27T09:54:50Z")

</div>

Hi!  
There’s go my doubt:

I have a spinal cord mask in axial 3d sequence and I want to locate this mask in STIR sequence (same day/moment acquisition):

I have done some tries (first I’ve tried with the axial image where I marked the mask):

STIR slice:  
 ![image](https://discourse.itk.org/uploads/default/original/2X/1/1d01acb78814aac577aa5d4b57a5cb988cff345b.jpeg)

New image registered over STIR:  
 ![image](https://discourse.itk.org/uploads/default/original/2X/9/9bc1626b3542737a50d87608b6555ffe8c945ea7.jpeg)

Registered mask. As you can see, the spinal cord not correctly match with the medular canal:  
 ![image](https://discourse.itk.org/uploads/default/original/2X/7/718d671277d0e1b7804c170077f5eaf1cd1480d2.jpeg)

The codes that i’ve used:

1st try:  
mask\_itk=sitk.Resample(mask,stir\_itk, sitk.Transform(), sitk.sitkNearestNeighbor, 0,mask.GetPixelID())

2nd try:

 ![image](https://discourse.itk.org/uploads/default/original/2X/3/34c024287e631681a65186de4c3df525117364b5.png)

Could you help me, please? 🙂  
Thank you very much in advance!

---

<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:** [January 27, 2022, 2:50pm UTC](https://discourse.itk.org/t/register-axial-3d-to-stir-sequence-space/4758/2 "2022-01-27T14:50:27Z")

</div>

Hello @AmericaBG,

The inaccurate overlap is likely due to an inaccurate registration. The latter can be due to multiple reasons:

1. Premature convergence. You are printing the optimizer’s stopping condition, what is it?
2. The transformation type is not appropriate for modeling the actual transformation. Is an affine transformation sufficient? If not, try `BSplineTransform`.
3. This is a slice from a 3D volume, what is the actual overlap between the mask and spinal cord segmented in the STIR image (Dice coefficient between a reference/ground truth 3D segmentation and the computed one).

Minor comments about the post: Please [share code using triple backtick](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) and not screenshots. The images are displayed upside down as compared to standard anatomical display, took me a second to recognize what I was looking at. Clinicians are very unforgiving about this. They have strong feelings about what is and what is not a correct visualization of the anatomy.
