GM-informed registration between the PAM50 template and T2* data

Dear SCT Team:
“I am performing GM-informed registration between the PAM50 template and T2* data, but the spinal cord positions in the output PAM50_t2s_reg.nii.gz and the T2* data in the QC reports did not align properly. What should I do?”
The command I used is as follows:

sct_register_multimodal -i "${SCT_DIR}/data/PAM50/template/PAM50_t2s.nii.gz" \
                        -iseg "${SCT_DIR}/data/PAM50/template/PAM50_wm.nii.gz" \
                        -d t2s_reg_resampled.nii.gz \-dseg t2s_reg_resampled_wmseg.nii.gz  \
                        -initwarp ../../t2/warp_template2anat.nii.gz \
                        -initwarpinv ../../t2/warp_anat2template.nii.gz \
                        -owarp warp_template2t2s.nii.gz \
                        -owarpinv warp_t2s2template.nii.gz \
                        -param step=1,type=seg,algo=rigid:step=2,type=seg,metric=CC,algo=bsplinesyn,slicewise=1,iter=3:step=3,type=im,metric=CC,algo=syn,slicewise=1,iter=2 \
                        -qc ~/qc_singleSubj

And this is the data:
t2.nii.zip (4.6 MB)
t2s_reg_resampled.nii.zip (967.2 KB)
t2s_reg_resampled_wmseg.nii.zip (2.3 KB)

Hi @ryu,

Thank you kindly for your question! I would be happy to help. :slight_smile:

When I take a look at the 3 files you’ve provided in an image viewer (e.g. FSLeyes), it seems like the T2* images are well-registered with the T2 image (grey=T2, copper=T2*, red=T2* wmseg):

ezgif-3-368b4c2533

Is the issue with the QC report specifically? If so, could you please provide the QC report itself (the full ~/sc_singleSubj folder can be zipped up and shared)? I ask because I am missing the necessary files to reproduce the QC report myself (e.g. the warp files).

Kind regards,
Joshua

Ah, wait! I see that you have edited the command you used. (Before, it was t2s.nii.gz and t2s_wmseg.nii.gz, now it is t2s_reg_resampled.nii.gz and t2s_reg_resampled_wmseg.nii.gz.)

I am a bit confused now. Are you saying that you ran the registration command a second time on these t2s_reg files?

Kind regards,
Joshua

Here is the QC report. I also provide the T2*-weighted image data (t2s.nii.gz), which is the original image of the T2*-weighted image registered to the T2-weighted image (t2s_reg_resampled.nii.gz). Could it be possible to correctly perform GM-informed registration between the PAM50 template and the T2* data using t2s.nii.gz and t2.nii.gz?

this is the data:
qc_image.zip (65.2 KB)
t2s.nii.zip (1.2 MB)

Dear @ryu,

Thank you for the updated data. :slight_smile:

To make sure I am understanding correctly: You are following the GM-informed registration tutorial, right?

In that case, let me summarize the steps needed to complete this tutorial.

  1. Template registration with the T2 image (Tutorials: Segmentation, Labeling, Registration)
  2. GM/WM seg of the T2* image (Tutorial)
  3. GM-informed registration (Tutorial)

I am assuming that you have probably done step 1 and 2 already. But, just to make sure, I will repeat all of the commands that are necessary.


I am assuming that the data is organized like this:

.
├── t2
│   └── t2.nii.gz
└── t2s
    └── t2s.nii.gz

Then I would run the following commands:

# 1. Register the T2 data to the template
cd t2
sct_deepseg_sc -i t2.nii.gz -c t2 -qc ~/qc_singleSubj
sct_label_vertebrae -i t2.nii.gz -s t2_seg.nii.gz -c t2 -qc ~/qc_singleSubj
sct_label_utils -i t2_seg_labeled.nii.gz -vert-body 3,9 -o t2_labels_vert.nii.gz
sct_register_to_template -i t2.nii.gz -s t2_seg.nii.gz -l t2_labels_vert.nii.gz -c t2 -qc ~/qc_singleSubj

# 2. Compute GM/WM segmentation of the T2* image
cd ../t2s
sct_deepseg_gm -i t2s.nii.gz -qc ~/qc_singleSubj
sct_deepseg_sc -i t2s.nii.gz -c t2s -qc ~/qc_singleSubj
sct_maths -i t2s_seg.nii.gz -sub t2s_gmseg.nii.gz -o t2s_wmseg.nii.gz

# 3. GM-informed registration
sct_register_multimodal -i "${SCT_DIR}/data/PAM50/template/PAM50_t2s.nii.gz" \
                        -iseg "${SCT_DIR}/data/PAM50/template/PAM50_wm.nii.gz" \
                        -d t2s.nii.gz \
                        -dseg t2s_wmseg.nii.gz \
                        -initwarp ../t2/warp_template2anat.nii.gz \
                        -initwarpinv ../t2/warp_anat2template.nii.gz \
                        -owarp warp_template2t2s.nii.gz \
                        -owarpinv warp_t2s2template.nii.gz \
                        -param step=1,type=seg,algo=rigid:step=2,type=seg,metric=CC,algo=bsplinesyn,slicewise=1,iter=3:step=3,type=im,metric=CC,algo=syn,slicewise=1,iter=2 \
                        -qc ~/qc_singleSubj

Step 1 looks good. Step 2 looks okay (there is some mis-segmentation but it is not too bad for the purposes of registration). Step 3, however, looks very bad (as you have noticed):

It is not just the QC report, either. Overlaying the images in FSLeyes shows the same large translation.


To fix this, I tried debugging the Step 3 sct_register_multimodal command:

  • I edited -param to remove step=2 and step=3. The large translation still occurs, meaning that it is likely due to step=1.
  • I tested the commands against sct_example_data, and things are okay with our sample data.
  • I tested the -initwarp warping field using sct_warp_template (PAM50_t2s.nii.gz looks OK when warped) and the -initwarpinv warping field on t2s.nii.gz (and that looks OK too)
  • I changed the step=1 command to use translation instead of rigid. A large translation still occurs, but in the other direction (strange!):

  • I tried removing step 1 entirely, and changed the steps 2 -> 1 and 3 -> 2.

So, something is definitely going wrong with the -param step=1,type=seg,algo=rigid part of the command. I will experiment more with the algo options, but I also will invite my colleagues to provide their insight into why rigid and translation may be producing such dramatic translations.

Thank you kindly for your patience and understanding,
Joshua

Dear @ryu,

My supervisor @jcohenadad took some time to modify the commands, and came up with a solution that produces good results:

# Use the new "seg_sc_contrast_agnostic" model to perform the T2* SC seg
sct_deepseg_gm -i t2s.nii.gz -qc qc
sct_deepseg -task seg_sc_contrast_agnostic -i t2s.nii.gz -qc qc
sct_maths -i t2s_seg.nii.gz -sub t2s_gmseg.nii.gz -o t2s_wmseg.nii.gz

# Use "algo=centermass" for `-param` Step 1
sct_register_multimodal -i "${SCT_DIR}/data/PAM50/template/PAM50_t2s.nii.gz" \
                        -iseg "${SCT_DIR}/data/PAM50/template/PAM50_wm.nii.gz" \
                        -d t2s.nii.gz \
                        -dseg t2s_wmseg.nii.gz \
                        -initwarp ../t2/warp_template2anat.nii.gz \
                        -initwarpinv ../t2/warp_anat2template.nii.gz \
                        -owarp warp_template2t2s.nii.gz \
                        -owarpinv warp_t2s2template.nii.gz \
                        -param step=1,type=seg,algo=centermass:step=2,type=seg,metric=CC,algo=bsplinesyn,slicewise=1,iter=3:step=3,type=im,metric=CC,algo=syn,slicewise=1,iter=2 \
                        -qc ~/qc_singleSubj

QC report: qc.zip (1.9 MB)

Kind regards,
Joshua

Thank you for your various considerations and solutions.

1 Like