Multimodal Registration Difficulties

I found an optical rat spinal cord atlas (RatAtlas.nii.gz) that contains one spinal cord segment per slice.
This I would like to register to MR scans (e.g. here T2.nii.gz). (The mentioned example files are all in this zip file )

What I tried so far:

Some preprocessing is needed just to get any registration without error. RatAtlas_refit.nii.gz is a version shifted in space to have the same geometry as T2.nii.gz (using AFNI 3drefit), so that they at least roughly overlap (otherwise ants produces an error).

T2_straight.nii.gz is the straightened cord after using sct_straighten_spinalcord, to hopefully simplify the registration a bit.

For both the atlas and target scan there are also the spinal cord segmentations (*_seg.nii.gz) available (binary mask of the sc).

With sct_register_multimodal I got a registration, but when looking more closely, the individual segments don’t really correspond. Since the atlas goes from C1 all the way to L4, but the MR scan only from ~C5 to ~T6, the result should’t contain all atlas slices in the first place.

I don’t know if registration of partially overlapping images is even possible with sct_register_multimodal.

1 Like

Hi @Felix,

Assuming that the rat atlas you are referring to is this one, I am currently updating the folder to add more information needed for your analysis (WM and cord segmentation, information about metrics, etc.).

Once done, I will generate a batch script that will perform the analysis you wish.

It will take me a few days.

Best,
Julien

1 Like

Hi @Felix,

We’ve updated the AtlasRat repository to include cord and WM mask, which is useful for the registration. Below is the code which will produce the results you are looking for (I hope):

# Go to T2 folder
cd Coreg
# Download rat atlas
curl -o AtlasRat.zip -L https://osf.io/g7kx8/download
unzip AtlasRat.zip
# Binarize image (to get rough centerline for segmentation)
sct_maths -i T2.nii.gz -bin 1 -o T2_bin.nii.gz
# Segment T2 image (here we use -rescale 2 because the cord is approximately 2x smaller than that in humans)
sct_propseg -i T2.nii.gz -c t1 -init-centerline T2_bin.nii.gz -rescale 2
# Create label at the top/bottom part with prior info about spinal levels (14:T6, 5:C5)
sct_label_utils -i T2_seg.nii.gz -create-seg 0,14:29,5 -o T2_labels.nii.gz
# Create the associated labels for the atlas
sct_label_utils -i AtlasRat/AtlasRat_spinal_levels.nii.gz -vert-body 5,14 -o AtlasRat/AtlasRat_labels.nii.gz
# Register the rat atlas to the T2 image.
# Tips 1: we set the atlas as the source and the T2 as the destination because the atlas only has one slice per level, while the T2 has more, so that way we avoid compressing (i.e. loosing) information along Z direction
# Tips 2: we use the generated labels as step=0 in order to bring the two images in the same physical space coordinate
# Tips 3: we use algo=columnwise in order to account for large deformations
# Tips 4: we use AtlasRat_MVF as the source image because it has excellent WM/GM contrast
sct_register_multimodal -i AtlasRat/AtlasRat_MVF.nii.gz -iseg AtlasRat/AtlasRat_mask_cord.nii.gz -ilabel AtlasRat/AtlasRat_labels.nii.gz -d T2.nii.gz -dseg T2_seg.nii.gz -dlabel T2_labels.nii.gz -param step=0,type=label,dof=Tx_Ty_Tz_Sz:step=1,type=seg,algo=centermassrot:step=2,type=seg,algo=columnwise:step=3,type=im,algo=syn,metric=CC,iter=5,slicewise=1

Below is an animation showing your T2 image and the registered atlas:
registration_atlasRat

Note: it would be pretty awesome to also include the Paxinos atlas in the atlas rat. We are working on it.

Cheers,
Julien

2 Likes

Thats great, I completely missed that update. This solves a lot of problems for me, thanks.