Register axial 3d to STIR sequence space

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:

New image registered over STIR:

Registered mask. As you can see, the spinal cord not correctly match with the medular canal:

The codes that i’ve used:

1st try:
mask_itk=sitk.Resample(mask,stir_itk, sitk.Transform(), sitk.sitkNearestNeighbor, 0,mask.GetPixelID())

2nd try:

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

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 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.