Registration of structural and diffusion weighted data

Thanks for that too, @rsmith. Unfortunately, we did not have another acquisition of reversed phase-encoding to correct for those distortions which seem to be highly localised in the frontal regions from my dataset. From the SIFT page, it is recommended that SIFT be used with ACT if distortion correction is not available? Could you elaborate on how this work and how the processing mask is automatically derived in SIFT? I’ll take another look at the SIFT paper over the next few days too!

No DWI distortion correction available

SIFT should ideally be used in conjunction with ACT; by passing the ACT 5TT image to tcksift using the -act option, the command will automatically derive a processing mask that will limit the contribution of non-pure-white-matter voxels toward the model. Without this information, non-pure-white-matter voxels adversely affect both streamlines tractography, and the construction of the SIFT model.

Reviving an old thread so I don’t need to make a new one -

This is a basic question - do I need to skullstrip my T1 images before rigid-body registration to the DWI series? I’m not quite clear on how registration will be accurate if one of the inputs has a skull surrounding the brain & the other has already been preprocessed & skullstripped.

Thank you kindly!

If the skull stripping works reliably then I would definitely recommend it. However, much more important is to make sure that the intensity ranges of the DWI and T1 images are similar and that there is a positive linear correlation between the intensity values across modalities as mrregister uses a sum of squared differences metric.

Thank you for the response. How do I go about checking the similarity of intensity ranges? As of now I’m using FSL’s flirt to do the rigid transformation, but will experiment with mrregister.

Looking at mrregister’s page & under Rigid Registration Options, I see the option -rigid_metric; would this be a relevant option to use in terms of variation in intensity ranges?

Hi @aszymanski,

Currently, you won’t be able to succesfully register a DWI dataset with a T1 image via mrregister, since the latter uses an SSD metric. For this task, you’ll currently have to resort to another package or tool, such as FSL’s flirt (see some people earlier in this thread using it succesfully for this purpose). I have been working with @Dave and @rtabbara on a solution for this particular problem, that will also incorporate optional EPI distortion correction (in case you would not have reverse phase encoded b=0 pairs). It’s not publicly available yet, but will likely become available at some point in the future!

Cheers,
Thijs

1 Like

Hi all

Thanks for providing so much information.
I’m trying to reproduce Kerstins above mentioned protocol for image registration.
Unfortunately I get an error message after the 2nd command:

Could not open matrix file tmp.nii.gz

I can run the command without the -init part and continue, but after mrtransform, I receive a non-registered and quite distorted t1 (see image at the end). Flirt registration from within the fsl gui works fine, but there I end up with such a low quality t1 image which is not useful at all :confused:
I tried it with skull stripped images as well - also not successful.
Does anyone have suggestions for a better registration?

I appreciate any help and I am sorry for my naive question.
Best regards, Lucius

Unfortunately I get an error message after the 2nd command:

Pretty sure tmp.nii.gz should be replaced with tmp.mat: This is the transformation estimate generated by the first command, that is then being fed back to flirt as the “initial” transform estimate via the -init option.

Flirt registration from within the fsl gui works fine, but there I end up with such a low quality t1 image which is not useful at all

This is because with default usage, flirt provides an output image that is both transformed and re-gridded to the target image. The trick is to have flirt output the transformation matrix, then apply that transformation in a way that alters only the image transformation matrix in the header, and doesn’t resample the image onto a new voxel grid. I really need to add this one to the FAQ…

Does anyone have suggestions for a better registration?

It’s hard to tell from a single-slice image, but one suggestion I will make is that if your T1 image contains a lot of neck, the image intensities in that region may contribute to calculation of the cost function that drives the registration; hence when flirt does its initial “coarse” search to find an approximate overlap, it could align the brain in the FA image with the middle of the neck in the T1. This is just a matter of understanding that registration algorithms are not magic black boxes, and sometimes need a bit of help; for instance, you could crop the neck out of the image, or if the images are intrinsically nearly-aligned you could instruct flirt to not perform the coarse search (where it e.g. tests to see if one image is rotated 90 degrees with respect to the other), and focus on fine improvement of the established near-algnment.

Rob

Dear Rob

Thank you very much for your helpful answer!
Yes, I’m certain, that this information provided in the FAQ will help a lot of users.

I’m in the process of implementing mrtrix at our neurosurgical department and use it as a more detailed, second opinion tool to Brainlab’s Elements program, to support op-planning and op-navigation.
If in the future the mrregister command is able to perform successful t1-dti/dwi registrations it would be much more comfortable and from our perspective even easier to integrate mrtrix in a clinical setting…

Thanks again, Lucius

Hi, Lucius,

Have you solved the mismatch problem yet? I meet the same problem when I do co-registration (register DTI image to T1 image of the same subject).
I firstly do recon-all with T1 image, it will transfer T1 image to Talairach space, I named it t1_freesurfer.nii.gz

flirt -in DTI.nii.gz -ref t1_freesurfer.nii.gz -out DTI_flirtto_t1_freesurfer_tmp.nii.gz -omat DTI_flirtto_t1_freesurfer_tmp.mat -dof 6

flirt -in DTI.nii.gz -ref t1_freesufer.nii.gz -out DTI_flirtto_t1_freesurfer.nii.gz -init DTI_flirtto_t1_freesurfer_tmp.mat -omat DTI_flirtto_t1_freesurfer.mat -dof 6

transformconvert DTI_flirtto_t1_freesurfer.mat DTI.nii.gz t1_freesurfer.nii.gz flirt_import DTI_flirtto_t1_freesurfer_mrtrixformat.txt

mrtransform DTI.nii.gz -linear DTI_flirtto_t1_freesurfer_mrtrixformat.txt DTI_in_t1_freesurfer.nii.gz

However, The result:


Then I tried to use epi_reg (a script designed to register EPI images (typically functional or diffusion) to structural (e.g. T1-weighted) images) :

It seems works, but the outpur file is extremely large( original DTI->61.8 MB , output DTI->519.4 MB ),which brings a lot of pressure when I do fiber tracking. So I have to give up this method.


Finally, I find dt_recon will register the current diffusion data to the structural data in its process. As announced by FreeSurfer, Input the bvalue and direction information using bvec and bval text files with the same format as the files used in FSL diffusion processing.

It works. Register DTI image to T1 image in(talairach ? MNI305) space. In fact, I’m not sure it is talairach or MNI 305 as FreeSurfer announced.

Before run dt_recon, I have to run recon-all command, which takes more than 10 hours with even my machine is quite nice (8 CPU cores and Titan Graphic Cards).

I sincerely hope Mrtrix developers can provide some functions on intra-subject registraion, registration from functional/diffusion image to structual image. It will really be very convenience for the users.

Many Thanks,
Chaoqing

Hi Superclear,

Maybe try the skull-stripped version of the T1 image. It seems the frontal CSF part of the b0 image is registered to the skull here.
This post can also be of interest to you: Distortion correction using T1

Cheers,

Thibo

1 Like

Hi @SuperClear,

yes, in the end it worked.
Are both your images 3d and not one 3d and the dwi 4d?
You can use the command provided by @maxpietsch here: ants reg.

You could use this to get get a 3d dwi before using above mentioned command:

ExtractSliceFromImage 4 anonym_b0.nii anonym_b0_volume0.nii.gz 3 0

then it should work.

With epi_reg I got as well huge data-sets, so I didn’t continue to use that.

For registration from t1 to mni152 i use the betted t1 (skullstrip via fsl bet) and register it with:

flirt [options] -in <inputvol> -ref <refvol> -omat <outputmatrix>

and use then the generated .mat file for other data sets from the same aquisition:
flirt [options] -in <inputvol> -ref <refvol> -applyxfm -init <matrix> -out <outputvol>

It seems to me that your images are not in talairach space, since for that, the anterior and posterior commissure should lie on a horizontal line.
But I think one of the experts should comment on those processes.
Still, I hope that helped a bit.

Best regards, Lucius

2 Likes

Hi, Lucius,

Sweet thanks for the help!

I registered t1 to mni152 by using linear registration and non-linear registration.
I find it that non-linear registeration is better matched to MNI152 :

the register commands:
flirt -in t1_skulled.nii.gz -ref MNI152_T1_1mm_brain.nii.gz -omat t1_skulled_to_MNI152.mat
and use then the generated .mat as input of --aff in fnirt:
fnirt --in=t1_skulled.nii.gz --ref=MNI152_T1_1mm_brain.nii.gz --aff=t1_skulled_to_MNI152.mat --iout=t1_skulled_in_MNI152_fnirt_out.nii.gz

I will try ants registration later.

Thanks, Chaoqing

Hi, Thibo,

Thanks for your advice!

Yeah, you’re right, I didn’t do any distortion correction on diffusion data.
Here on the sagittal view of the registered DTI and T1 image, it is misplaced.

I will then try to correct the distortion as you suggested, and then do registration. Hope it will work.

Thanks,
Chaoqing

1 Like

It seems works, but the output file is extremely large (original DTI->61.8 MB , output DTI->519.4 MB), which brings a lot of pressure when I do fiber tracking.

With epi_reg I got as well huge data-sets, so I didn’t continue to use that.

Sounds like the script is automatically re-gridding the input DWI to T1 image space; this is similar to the default operation of flirt. Unfortunately it doesn’t look like there’s a way to get around this: With flirt we can request the affine matrix and then apply it to just the header transformation, but epi_reg is non-linear. You could simply resample the resulting DWI series back to a lower resolution again, but you’d be performing two interpolations sequentially, which is generally not advised.

Hi Kerstin,

Thanks for the very informative steps you shared. I’m wondering why you would use mri/nu.mgz and not mri/T1.mgz instead? Or simply use brainmask.mgz which is already skill-stripped?

@Kerstin, @Michiko,

I am personally using norm.mgz, since it is a final FreeSurfer product of intensity normalization and skull stripping (which is not the case of the brainmask.mgz), before intensity filtering of subcortical structures ( which is brain.mgz). Are there reasons why not to use norm.mgz?

Antonin

Hi @Antonin_Skoch,

Thanks for raising this point - do you know how much that step of intensity normalization would affect registration?

It would mainly depend on the cost function used in registration. Its effect will be probably minor. I would expect much more substantial effect on segmentation.

Hi Kerstin,

Thank you for this approach. I have been using this method with good success. I would also like to ask, if the same transformations if applied to the WM_bin image used in the bbr registration step, could be used as a mask to be supplied to the ACT? (Considering the fact that I don’t have the reverse phase encoded data).

Regards,
Archith

Hi, Archith,

suggested approach is using 5ttgen fsl command on T1 structural image to generate proper input for ACT.
However, using distortion correction on DWI is highly recommended, since you would not get sufficient spatial correspondence between DWI and structural image, especially in frontal areas.
See Anatomically-Constrained Tractography (ACT) — MRtrix3 3.0 documentation

Antonin

1 Like