Bad registration result when running sct_register_multimodal

Continuing the discussion from Account temporarily on hold:

Dear SCT team:
I am currently working on the processing of spinal cord DTI data. Before the processing of spinal cord data, I first preprocessed the DTI data (including Topup, eddycorrect, DTIFIT), and then processed the spinal cord data according to the tutorial in Beijing in August 2019. The steps are as follows:
1:spinalcord segment;
2:create a mask;
3:crop image;
4:motion correction;
5:After doing the four steps above I perform the final segmentation of the spinal cord:
command: sct_deepseg_sc -i dmri_crop_moco_dwi_mean.nii.gz -c dwi -qc qc_deepseg ~~~
but my segment result was not very good,this is my first question and i will attach it in attachments.
the second question is when I conducted spinal cord registration, and the order of spinal cord registration was as follows:
Sct_register_multimodal -i $SCT_DIR/data/PAM50 / template/PAM50_t1 nii. Gz iseg - $SCT_DIR/data/PAM50 / template/PAM50_cord nii. Gz - d dmri_crop_moco_dwi_mean. Nii. Gz - dseg dmri_crop_moco_dwi_mean_seg. nii. gz- param step = 1, type = seg, algo = centermass: step = 2, type = seg, algo = bsplinesyn, slicewise = 1, 3 - initwarp iter =…/ t1 / warp_template2anat. Nii. Gz - initwarpinv…/ t1 / warp_anat2template. nii. gz - qc qc_reg
The result of registration is completely distorted, I suspect the reason is warp, could you please help me solve this problem,I will put the required documents in the attachment.A thousand thanks.
my version is SCT_v4.0.0 in ubuntu 16.04,because the attachment is too big ,may i have your email and email it to you for your convenience to find the problem
Sincerely!

dmri_crop_moco_dwi_mean.nii.gz (162.5 KB) dmri_crop_moco_dwi_mean_reg.nii.gz (2.6 MB) dmri_crop_moco_dwi_mean_seg.nii.gz (905 Bytes)

hi,

thank you for reaching out.

first question (segmentation): please describe what you mean by “my segment result was not very good”. If you meant that the segmentation looks “pixelated” when looking at the QC report, then please note that your native resolution is 1.2mm in-plane (which is fairly coarse-- the generic protocol suggests 0.9mm in-plane), so it is expected that the interpolated view of the QC report would give you an apparent “pixelated” shape. If you are referring to an overall under-segmentation, then please note that with the new SCT v4.2.0. release, it is now possible to set a threshold for the binarization (flag -thr). I don’t recommend playing with it though, as it has been optimize across contrasts (more info here).

second question (registration): it is not possible for me to assess what went wrong in your processing as I need all your intermediate results as input files. The easiest way would be to send me your input images (dmri + t1), in nii.gz format, and list in your response all the commands you used from the beginning so I can reproduce your intermediate results. When you write terminal commands, please use the code formatting characters for better clarity: Example: writing “~~~ [next line] code [next line] ~~~” will give you this nice formatting:

code

best,
julien

hi:
Dear Prof Julien ,first time when i email my question to u ,i try to attach my dmri.nii.gz and t1.nii to u ,but it’s size is too big even about 200M. So how can i give it you?Thank you for your help ,could you please give me your personal email address,then i could email my data to u!
best,
mario

the easiest is to upload your zipped data into a cloud server (dropbox, gdrive or equivalent) and then include the link here

hey :
Prof Julien ,i have upload my data to the dropbox,including dmri.nii.gz ,t1.nii.gz ,bvec,and bval .and the following is commands in my proccess:

First i process T1 image

(1):sct_deepseg_sc -i t1.nii.gz -c t1 -qc qc_deepseg
(2):sct_label_vertebrae -i t1.nii.gz -s t1_seg.nii.gz -qc qc_label
(3):sct_label_utils -i t1_seg._label.nii.gz -vert-body 3,9 -o t1_labels_vert.nii.gz
(4)sct_register_to_template -i t1.nii.gz -s t1_seg.nii.gz -l t1_labels_vert.nii.gz -c t1 -qc qc_reg

Then process dmri image

(1):sct_maths -i dmri.nii.gz -mean t  -o dmri_mean.nii.gz
(2):sct_propseg -i dmri_mean.nii.gz -c dwi -qc qc_propseg_1
(3):sct_create_mask -i dmri_mean.nii.gz -p centerline,dmri_seg.nii.gz -size 35mm
(4):sct_crop_image -i dmri.nii.gz -o dmri_crop.nii.gz
(5):sct_dmri_moco -i dmri_crop.nii.gz -bvec bvecs2
(6):sct_deepseg_sc -i dmri_crop_moco_dwi_mean.nii.gz -c dwi -qc qc_deepseg_2
(7):sct_register_multimodal -i $SCT_DIR/data/PAM50/template/PAM50_t1.nii.gz -iseg SCT_DIR/data/PAM50/template/PAM50_cord.nii.gz -d dmri_crop_moco_dwi_mean.nii.gz -dseg dmri_crop_moco_dwi_mean_seg.nii.gz -param step=1,type=seg,algo=centermass:step2,type=seg,algo=bsplinesyn,slicewise=1,iter=3 -initwarp ../t1/warp_template2anat.nii.gz -initwarpinv ../t1/warp_anat2template.nii.gz
(8):mv warp_dmri_crop_moco_dwi_mean2PAM50_t1.nii.gz warp_dmri2template.nii.gz
(9):mv warp_PAM50_t12dmri_crop_moco_dwi_mean.nii.gz warp_template2dmri.nii.gz
(10):sct_warp_template -d dmri_crop_moco_dwi_mean.nii.gz -w warp_template2dmri.nii.gz
(11):sct_dmri_compute_dti -i dmri_crop_moco.nii.gz -bval bvals2 -bvec bvecs2

The above content is my process.In order to make it easier for you to understand my description, I want to describe my problem in more detailmy question is:
(1):my image’s voxelsize is 1.2,1.2,4 ,when i did sct_deepseg_sc for dmri ,
yo can see some result is not good enough ,like a small circle in a big circle ,how can i improve my result;

(2);when i did sct_deepseg_sc for dmri image ,i overlay dmri_crop_moco_dwi_mean_reg,nii,gz to the template ,the result sames like two images were not in the same spce ,i want to know where was my mistake ,and how to correct it .(i attch it in a .png

)

the following link is my data in dropbox,it’s my first time use dropbox ,i don’t know whether can it works ,if dosen’t,please inform me at your convenience,and i hope your reply.
best;
mario

hello:
Prof,could u please help me solve this problem?

Sorry I’ve been extremely busy— I’ll have a look hopefully today

P.s. next time please post in the forum, not direct message. You’ll have a quicker answer

It dosen’t matter Prof, I’m very sorry for troubling u .in case my data was broken ,i upload it agian.Here is the link:https://www.dropbox.com/sh/ad7s045oof0gwbi/AAAQrAbPPjqzwnEu3gYG4fT9a?dl=0

hi,
i’ve had a look at your data. For info, you did not send me nii.gz files, but nii files, so the syntax you listed in your post above does not work. Also, there are errors in the syntax, e.g.:

  • (2) for the t1 file is missing the “-c” argument
  • (3) the file “t1_seg._label.nii.gz” does not exist.
  • (3) you listed levels 3 (C3) and 9 (T2), but your FOV stops at C7, so your processing could not work.
  • you can use the same qc folder output and then use the search module to distinguish between SCT functions
  • for dmri processing, at (7):sct_register_multimodal, there is a typo: “step2” instead of “step=2”

I strongly recommend that you create a batch file where you list the exact syntax to make it easier for others (and you) to reproduce your analysis.

I’ve updated the syntax, see below:

# segment cord
sct_deepseg_sc -i t1.nii -c t1 -qc qc
# label vertebrae
sct_label_vertebrae -i t1.nii -s t1_seg.nii -c t1 -qc qc
# get vertebral labels at C3 and C7
sct_label_utils -i t1_seg_labeled.nii -vert-body 3,7 -o t1_labels_vert.nii.gz
# register T1 with template
sct_register_to_template -i t1.nii -s t1_seg.nii -l t1_labels_vert.nii.gz -c t1 -qc qc
# processing DWI data
sct_maths -i dmri.nii -mean t -o dmri_mean.nii.gz
sct_propseg -i dmri_mean.nii.gz -c dwi -qc qc
sct_create_mask -i dmri_mean.nii.gz -p centerline,dmri_mean_seg.nii.gz -size 35mm
sct_crop_image -i dmri.nii -o dmri_crop.nii.gz
sct_dmri_moco -i dmri_crop.nii.gz -bvec bvecs2
sct_deepseg_sc -i dmri_crop_moco_dwi_mean.nii.gz -c dwi -qc qc
sct_register_multimodal -i /Users/julien/code/sct/data/PAM50/template/PAM50_t1.nii.gz -iseg /Users/julien/code/sct/data/PAM50/template/PAM50_cord.nii.gz -d dmri_crop_moco_dwi_mean.nii.gz -dseg dmri_crop_moco_dwi_mean_seg.nii.gz -param step=1,type=seg,algo=centermass:step=2,type=seg,algo=bsplinesyn,slicewise=1,iter=3 -initwarp warp_template2anat.nii.gz -initwarpinv warp_anat2template.nii.gz -qc qc
mv warp_dmri_crop_moco_dwi_mean2PAM50_t1.nii.gz warp_dmri2template.nii.gz
mv warp_PAM50_t12dmri_crop_moco_dwi_mean.nii.gz warp_template2dmri.nii.gz
sct_warp_template -d dmri_crop_moco_dwi_mean.nii.gz -w warp_template2dmri.nii.gz

Now, one of the reason you experienced registration issues, is because either the subject moved a lot between the T1 and the DMRI scan, or the MR tech had to reposition the subject (thereby loosing the same coordinate space between the two images). As you can see in the image below, the DMRI is highly shifted compared to the T1. You can try to manually realign the images using a fiducial marker (and then use step=0 to to a pre-registration), but in the future, make sure to acquire both images without repositioning.

1 Like

hi Julien:
For the question above,with your help i have solved it.thanks for reaching out .

1 Like