Question re: template registration and GM/WM inaccuracy for MTR analysis (SCT v7.2)

Dear SCT team,

I hope you’re doing well.

I’m using SCT v7.2 to process PSIR (named t1.nii.gz), T2w (named t2.nii.gz), and MT images to compute MTR in the whole SC, WM, GM between C2-C4 in people with MS. Ideally, I’d like to use PSIR (t1.nii.gz) since it’s available for all participants. However, I’ve also tested using T2w (t2.nii.gz) although T2w data is available for only half of the participants. I’m closely following the batch_single_subject_v7.2.sh pipeline from the December 2025 SCT course.

I had a question regarding sct_register_to_template and sct_warp_template using t1.nii.gz or t2.nii.gz and the impact on downstream MTR analysis.

In my pipeline, I perform the following:

sct_register_to_template -i t1.nii.gz -s t1_seg.nii.gz -ldisc t1_labels_vert.nii.gz -c t1 -qc $qc_dir
sct_warp_template -d t1.nii.gz -w warp_template2anat.nii.gz -a 0 -qc $qc_dir

(and similarly for t2.nii.gz).

I then use the resulting warp (warp_template2anat.nii.gz) to initialize MT registration and extract MTR metrics (whole SC, GM, WM between C2-C4).

However, in the QC outputs from sct_warp_template (see attached), I consistently observe that the warped atlas (GM/WM) is not accurate. The SC segmentation itself looks fine.

My understanding is that this misalignment will lead to inaccurate WM/GM MTR estimates in later steps:

sct_register_multimodal -i "${SCT_DIR}"/data/PAM50/template/PAM50_t2.nii.gz -iseg "${SCT_DIR}"/data/PAM50/template/PAM50_cord.nii.gz -d mt_on.nii.gz -dseg mt_on_seg.nii.gz -m mask_mt_on.nii.gz -initwarp ../t1/warp_template2anat.nii.gz -param step=1,type=seg,algo=centermass:step=2,type=seg,algo=bsplinesyn,slicewise=1,iter=3 -owarp warp_template2mt.nii.gz -qc $qc_dir
sct_warp_template -d mt_on.nii.gz -w warp_template2mt.nii.gz -a 1 -qc $qc_dir

The final step in computing MTR is:

sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 50 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:16 -o csv/mtr_sc.csv -append 0
sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 51 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:16 -o csv/mtr_wm.csv -append 0
sct_extract_metric -i mtr.nii.gz -f label/atlas -method map -l 52 -vert 2:4 -vertfile label/template/PAM50_levels.nii.gz -z 3:16 -o csv/mtr_gm.csv -append 0

Questions

  1. Is it correct to assume that GM/WM atlas misalignment will affect the MT registration step, given that the T1/T2-derived warp will be used for initialization? If so, are there specific parameter adjustments that could improve GM/WM segmentation? Or do you recommend to limit the analysis to whole SC MTR only?

  2. Is whole SC MTR (using -l 50) still reliable in this situation?

  3. As an alternative approach, could I simply use MT-on image to segment GM/WM, or is this not recommended due to still relative noise for MT sequence and the fact that SCT relies on template warping for GM/WM?

I’d be happy to share example data, script (draft, work in progress), and full QC report privately to your email, if helpful (following hospital data-sharing policies).

Thank you so much for your help in advance. I appreciate your support!

Lisa



Hi Lisa,

Thank you so much for your post! We would be happy to help answer your (very thoughtful!) questions. :blush:

Question 1.

Looking at all of the steps you’ve shared (PSIR reg, T2 reg, MTR warp, etc.), it looks like the entire pipeline is based solely on SC segmentation masks. (For example, the use of -iseg PAM50_cord.nii.gz + -dseg mt_on_seg.nii.gz, as well as the -initwarp ../t1/warp_template2anat.nii.gz step, which was also based solely on the SC seg of the PSIR data.)

So, even though the intermediate “warped PAM50 WM” files look very poor, as long as those specific masks are not directly used in any further steps, there isn’t an immediate risk. (See also: My “Aside” at the very end of this reply.)

Question 2.

Assuming the warped SC seg for PSIR looks okay (and I believe you’ve indicated that it does!), the subsequent registration steps could still work well. The initwarp is used only as a coarse initial registration step – all of the refinement of the registration (e.g. slicewise deformation) is done purely using the MT data anyway. So, assuming sufficient detail in the MT image/mask, I don’t think there is too much to be concerned about.

Note: The use of -initwarp is largely useful for adding landmark alignment (e.g. disc/vertebral labels) for images that do not have easy-to-distinguish landmarks. So, it would be worth double-checking the SI-axis alignment for the PAM50->PSIR warped data (e.g. by looking at the warped PAM50_levels.nii.gz file), and making sure that the alignment adds information that the MT data alone would lack).

Question 3.

This sample image is of the MT data, right? (I ask because the screenshot is captioned sct_register_multimodal - MT, so I wanted to make sure.)

If so, then I think there is at least enough detail here to try segmenting the GM seg. From there, this GM seg could be used create a WM seg, which could then inform the template registration, via the steps in the Segmenting the gray and white matter and Improving registration results using white and gray matter segmentations tutorials.

Note: SCT has a new contrast-agnostic gray matter model (sct_deepseg graymatter), and so you may wish to substitute in this model for the existing sct_deepseg_gm step in the first tutorial above. We are currently in progress for updating the documentation! :slight_smile:

WM-informed template registration allows you to largely keep the registration the same (due to the same SC segmentation used as the outer boundary for -iseg and -dseg), while also slightly tweaking the registration to match the inner boundary of the GM. This may result in more accurate registration / atlas warping, and the end result may be improved even if the GM segmentation alone was not sufficient for computing metrics.

Feel free to try this approach on a sample subject and share the GM seg + registration results, and we would be happy to assess whether the approach is worth pursuing.

Kind regards,
Joshua


Aside: Returning back to Question 1, if you wish to dig more deeply into why the intermediate warped PAM50->PSIR/T2 white matter masks look so misaligned, we can definitely do that (for the sake of building shared understanding – I’m interested too!).

Investigation into poor warped WM masks from QC

This is a very good observation. While there will typically be some GM/WM inaccuracies when registering T1 data using only the SC mask, the inaccuracies generally should not be as severe as what you’ve shown in your sample QC report. (I mention this because the SC mask does not encode the shape of the GM/WM, but despite this, using the SC mask shouldn’t create the broken WM masks you see in the QC.)

I am wondering about the resolution of your data, and whether the sct_warp_template step loses its accuracy when trying to warp the PAM50 WM mask to the PSIR space. When looking at a sample slice of the source image in the PAM50 space, we see a rather detailed mask:

image

And checking the original PAM50 T1 resolution, we see that the template is 0.5mm isotropic:

$ [~/repos/spinalcordtoolbox/data/PAM50/template] # sct_image -header -i PAM50_t1.nii.gz 

--
Spinal Cord Toolbox (git-master-1a608486b84a46e25bf8e452f699bc2af67b13fe*)

sct_image -header -i PAM50_t1.nii.gz
--

sizeof_hdr	348
data_type	UINT16
dim		[3, 141, 141, 991, 1, 1, 1, 1]
vox_units	mm
time_units	Unknown
datatype	512
nbyper		2
bitpix		16
pixdim		[-1.0, 0.5, 0.5, 0.5, 1.0, 1.0, 1.0, 1.0]

If we are warping this mask to a suitably detailed destination image, the details should be largely preserved. For example, on our test T2 data, we see:

And the T2 test data has the following header:

$ [~/repos/spinalcordtoolbox/data/sct_testing_data/t2] # sct_image -header -i t2.nii.gz 

--
Spinal Cord Toolbox (git-master-1a608486b84a46e25bf8e452f699bc2af67b13fe*)

sct_image -header -i t2.nii.gz
--

sizeof_hdr	348
data_type	INT16
dim		[3, 60, 55, 52, 1, 1, 1, 1]
vox_units	mm
time_units	s
datatype	4
nbyper		2
bitpix		16
pixdim		[-1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

If instead we were to warp this mask to a coarser-resolution image (such as – I am guessing – your PSIR data), however, the finer details would inevitably be lost.

Just as an initial step, you can try sharing the output of the debugging command (sct_image -header -i [YOUR_IMAGE]) for both the PSIR and T2 data, and compare what you see to our sample data above?

(NB: I have also asked my colleagues to look over this thread and make sure that I haven’t missed anything. So, there should be a follow-up reply later when they have a moment.)

hi Lisa

we only see the static PNG-- would be useful to see the PNG with overlay that can be toggled-- pls share QC report-- easier for us-- from the PNG where we see the overlaid WM mask, I don’t see anything shocking-- can you elaborate on what concerns you?

now your questions:

  1. Is it correct to assume that GM/WM atlas misalignment will affect the MT registration step, given that the T1/T2-derived warp will be used for initialization? If so, are there specific parameter adjustments that could improve GM/WM segmentation? Or do you recommend to limit the analysis to whole SC MTR only?

only slightly-- obv it depends on your reg param for the MT phase-- if you share qc report which includes syntax it,s easier for us to review-- i have no time to review an entire script–

  1. Is whole SC MTR (using -l 50) still reliable in this situation?

depends what you mean by reliable-- you’ll get a mix of WM and GM since -l 50 is the whole cord-- so not reliable if you only care about WM–

  1. As an alternative approach, could I simply use MT-on image to segment GM/WM, or is this not recommended due to still relative noise for MT sequence and the fact that SCT relies on template warping for GM/WM?

not a question of noise but of contrast-- based on your 3rd PNG contrast seems ok-- did you try the latest GM seg model? regardless you’ll need information about disc level