How to register DTIs

Hi all, I am kind of new in this topics, so I I apologize in advance for the questions.

I am trying to do a registration of DTIs with mrregister, and I am using as a template the one provided by fsl (data/standard/MNI152_T1_1mm.nii.gz), but the result image shows nothing (everything is black).
I also did some preprocessing in the images (dwidenoise, dwipreproc and dwibiascorrect, in that order), and after the registration I want to do the segmentation of the images; and after that, I want to perform the global tractography (tckglobal). Here are my questions:

1. Is it ok to use that template to register the DTIs?
2. I also read that is better to register the structural image to the diffusion image, so, should I register fsl’s template to the DTIs I have? Or do I need another image to use as a template?
3. Is it recommended to first register the images and after do the segmentation?
4. If the answere of question 3 is “yes”, should I use that template or the one that only have the brain in the image (skull stripped)(data/standard/MNI152_T1_1mm_brain.nii.gz) ?
5. In the segmentation, should I provide the anatomical image registered to the DTIs? or viceversa?
6. The same of question 5 but for global tractography.

Thanks a lot.

Hola Carolina! :smiley: :colombia: :smiley:

I only can give you some answers because I don’t understand really well what are you trying to do, it sounds like at the end you want the a connectome but I cannot be sure :woman_shrugging:

I think it depends on your goal, If you will compare subjects you probably need to work in a common space (standard template o population specific template).

That is in case you have the structural image of the same subject, in that case it is desirable to align the structural and the diffusion image. As far as I know mrregister is designed to register FODs so it is not a good option to register different modalities, in those cases fsl flirt command gives quite good results (with mutual information as cost function) and you only need a rigid transformation because it is supposed to be the same brain.

Hope it helps!

1 Like

Holaaa :colombia: :colombia: :blush:

Thanks for your answers :smiley: I am kind of confuse with all this topics (as shown in my questions). Yes, my goal is to generate a tractography using tckglobal, but I was wondering if it could be more standard, for any DTIs uploaded (that’s why I was thinking I could use the fsl’s template).

I am doing the question about registration because after that, I should perform segmentation with 5ttgen (which says that the image should be co-registered) and after that I will call tckglobal with the segmented images.

Isn’t it necessary to perform registration if I do not have the structural image then?

Thanks a lot :ok_woman:

P.S: I apologize for my english

I am in the midst of (attempting) to register DWI images to MNI space. While I would like to employ ANTS, but I have yet to figure out that pathway. (I use MRtrix for the transformation step because I assume MRtrix rotates the B table during the transformation. Can anyone confirm?) That said, I use FSL’s FLIRT pretty heavily. For my pipeline, I intend to register T1w images to an MNI image. For instance,

# Register T1w to MNI space
flirt -in "${t1w}" -ref "${mni}" -dof 12 -omat "affine.mat" -o "t1w2mni_temp.nii.gz"
transformconvert "affine.mat" "${t1w}" "${mni}" flirt_import "affine-mrtrixformat.txt"
mrtransform "${t1w}" "$t1w2mni.nii.gz" -linear "affine-mrtrixformat.txt"

# Register DWI to T1w space
flirt -in "${b0}" -ref "${t1w}" -dof 6 -omat "tmp.mat" -o "b02t1w.nii.gz"
flirt -in "${b0}" -ref "${t1w}" -dof 6 -cost bbr -wmseg "${t1w_wmseg}" -init "tmp.mat" \
-omat "b02t1-bbr.mat" -schedule "${FSLDIR}/etc/flirtsch/bbr.sch" -o "$b02t1w_temp.nii.gz"
transformconvert "b02t1-bbr.mat" "${b0}" "${t1w}" flirt_import "b02t1w-bbr-mrtrixformat.txt"
mrtransform "dwi.mif" "dwi2t1w.mif" -linear "b02t1w-bbr-mrtrixformat.txt"

See this link for why I use two FLIRTs in the DWI registration:

The last step would be to apply the T1w-MNI affine to the registered DWI

# Register DWI to T1w-MNI space
mrtransform "dwi2t1w.mif" "dwi2mni" -linear "affine-mrtrixformat.txt"

After re-reading your post, I see my entry was not very helpful. (I am no expert, here are my answers - anyone else please correct me.)

  1. Is it ok to use that template to register the DTIs? Of course, if you get reasonably good registrations - go nuts.

  2. I also read that is better to register the structural image to the diffusion image, so, should I register fsl’s template to the DTIs I have? Or do I need another image to use as a template? If you register the structural to the diffusion, you would not need to worry about rotating/transforming the gradient table. I don’t know if MRtrix handles this in it’s transformation commands or not. For me, it’s an unknown.

  3. Is it recommended to first register the images and after do the segmentation? I’d say register first, therefore you won’t have to register each of the segmentations afterwards.

  4. If the answere of question 3 is “yes”, should I use that template or the one that only have the brain in the image (skull stripped)(data/standard/MNI152_T1_1mm_brain.nii.gz) ?* I use skull-stripped images in all my registrations, it seems to produce better overlap. However, I’d recommend trial and error for your data.

  5. In the segmentation, should I provide the anatomical image registered to the DTIs? or viceversa?* I don’t use MRtrix’s segmentation :confused:

For questions 1,2,4 and 5 - trial and error test the crap out of it. See what works, what creates (visually) good looking images. I don’t think there is one right pathway (though some pathways are better than others).

Thank you very much! Your answers help me a lot, really. Thanks for the clarifications, I am going to try again based on this replies. :blush:

I am trying to do a registration of DTIs with mrregister, and I am using as a template the one provided by fsl (data/standard/MNI152_T1_1mm.nii.gz),

Am I interpreting this correctly in that you are attempting to directly register diffusion-weighted images to a T1-weighted template? This won’t work with mrregister: It currently only has a squared-difference metric, which only works for images with highly comparable contrast and intensity ranges. One can either use an alternative software tool that supports more complex image similarity metrics for registration, or if you’re feeling adventurous, you could try this trick.

I also read that is better to register the structural image to the diffusion image, so, should I register fsl’s template to the DTIs I have? Or do I need another image to use as a template?

The primary justification for T1->DWI intra-subject transformation is that corresponding rotation of diffusion gradient directions is not required. THis is less of a concern now since mrtransform will do this automatically if the gradient table is provided / stored in the image header, but it’s a caveat worth being aware of nonetheless. If using some other registration tool, whether T1->DWI or DWI->T1 registration is preferable (including the caveat that one is an individual subject and one is a template image) will depend on the particular operation of that tool; mrregister is fully symmetric and order-agnostic (though the order of the input images to mrregister influences how you must use the data it produces subsequently).

Is the use of the FSL-provided FA template a valid alternative for registration? (Whether or not this question is even relevant will depend on the answer to some questions below)

@jimbo’s response #3 also applies here.

… after the registration I want to do the segmentation of the images …

There’s not enough information in this statement to know exactly what kind of image processing step you’re intending to perform. But if you’re referring to tissue segmentation of an anatomical image, this segmentation is subject-specific and is not performed on a template; see comment further below.

As far as I know mrregister is designed to register FODs so it is not a good option to register different modalities …

While mrregister has the capability to take FOD information into account during registration, it’s not restricted to only FOD-based registration. Its inability to deal with inter-modal registration comes specifically from only possessing the squared-difference metric, as opposed to more complex metrics such as mutual information.

I am doing the question about registration because after that, I should perform segmentation with 5ttgen (which says that the image should be co-registered) and after that I will call tckglobal with the segmented images.

This refers specifically to the fact that if tissue segmentation of an anatomical image is going to be used to select exemplar voxels for response function estimation (i.e. specifically the 5ttgen msmt_5tt algorithm), the anatomical image must be very well aligned with the diffusion image series. However this is an intra-subject registration requirement, and has nothing to do with a template image.

(I use MRtrix for the transformation step because I assume MRtrix rotates the B table during the transformation. Can anyone confirm?)

Correct. You do however need to perform the appropriate conversion via transformconvert, just as you have done in your flirt example, since the coordinate conventions used by different softwares to represent spatial transformations differ.

1 Like

Thanks!!! I finally understood haha :see_no_evil::see_no_evil:

Because I didn’t have the T1w image of the subject, I continue with the dwi2response dhollander to get the response functions (with the DTI preprocessed with dwidenoise and dwipreproc), and after that I passed those outputs to the tckglobal command, with the same DTI input image as the used for dwi2response, I got this result:

But the image is not skull-stripped. Is there an option to perform brain extraction in DTIs/DWIs? With MRtrix?
Or providing a mask of the image is enough?

Thanks

You can generate a brain mask from the DWI image using dwi2mask and apply this to the data in dwi2fod, tckgen or tckedit.

Here is a tutorial that goes through the processing steps.

@carolinajimenez26: always check the outputs of dwi2mask well though. In case of very severe (and uncorrected for) bias fields, dwi2mask can sometimes struggle. Edit the output mask manually in mrview's ROI tool if needed.

I created a image mask of the data (without preprocessing) and I passed it to the tckglobal with -mask option, but the result isn’t good either

Hmm, this is strange. What does your mask look like? I’m not surprised that one or two eyeballs could end up in the mask, or parts of the nasal sinuses, but the scalp should definitely not have ended up in the mask.

This is my input data without preprocessing (taken from ADNI):

And this is the mask created with dwi2mask:

The full command was:

dwi2mask in.mif mask.mif -grad grad_table

I am very sorry!!! I checked again the command I used in the historial in the terminal, and I realized that I didn’t pass the mask. I ran it again and this was the output:

thank you all for helping me, and excuse me again for my mistake.

No worries; the output makes much more sense now. :slightly_smiling_face: :+1:

Dear jimbo,

I want to register the image in the template space. I have the transformation and obtained the image in the template space using your code (mrtransform command). According to what you said, the B-table also rotates with this command. Now, how can I obtain the B-table in the new space?
If you have any information on this matter, I would appreciate it if you could guide me.

Respectfully,
Maryam Shapourjani