Optimizing registration for FODs and structural images

Hi,

I am currently working on a project with the HCP dataset.

We are combining fixel metrics (transformed into voxel based metrics with fixel2voxel) with voxel-based DTI and structural (T1/T2) metrics in a multi-parametric analysis. Therefore, we want to ensure all these maps are in the same space and that the alignment is optimal in white and grey matter.

When using the FODs (resolution: 1.25mm) only to drive registrations and bringing everything into that FOD template space, we found the alignment in grey matter was rather poor (visible in warped T1 and T2 maps). To improve registrations, I tried:

  1. increasing the number of non-linear steps, adding 4 x 1.0 to nl_scale, 4 x 8 to nl_lmax and 4 x 25 to nl_niter when generating the template with population_template. I did not see any difference.
  2. using multiple contrast (FOD, T1, T2) to drive the registration in population_template, creating 3 templates (done with default parameters since modifying these did not seem to have any impact on registration) and then using these templates to compute transforms with mrregister. We were still not satisfied with the registration and thought this may be because by downsampling the T1 and T2 from 0.7 to 1.25mm (to match the FOD resolution) we were not really improving the accuracy of information in grey matter, which led us to try this:
  3. specifying a -voxel_size 0.7 in population_template. I ran a test with only the FODs and one with multiple contrasts (FOD, T1 and T2) with the voxel_size option at 0.7. It looks like using this resolution improved the registrations, but I am still unsure if using the T1 and T2 as contrasts when generating templates improves the registration.

I was wondering if using a lower resolution than the resolution of my FOD is appropriate. In your documentation, upsampling the DWI data is suggested to improve template building and registration, but here we upsampled the FODs. If this can improve our registrations, we could go back and upsample our DWI images to 0.7 before carrying on with the next steps. I look forward to hear your thoughts on this.

Lastly, I was wondering if there is a specific reason why mrregister and mrtransform are used in the fixel-based analysis steps instead of computing the warps and applying them to the images in one step with the population_template function (using the -warp_dir and -transformed_dir options)? Or am I misunderstanding the use of these option?

Thank you,

Stefanie

Hi Stefanie,

There are several options that might improve the results.

1) changing regularisation parameters
It might be a good idea to change “-nl_update_smooth” or “-nl_disp_smooth” from default. That would (although might lead to negative Jacobians).
E.g., -nl_update_smooth 1.00 -nl_disp_smooth 0.75.

2) addition of cortex masks
In my experience - adding binary cortex masks as additional channels significantly improves alignment for the cortex (or even GM probability priors).

3) using NCC metric non-linear registrastration part
The current version of registration in mrtrix in the main branch uses only SSD metric.
This is one of the reasons why it might be optimal for structural registration (e.g., intensities are not normalised / differences in the acquisition parameters / lesions with extreme intensity difference).

We’ve been working on adding the NCC metric to registration / population_template function and you can install it from “mrreg_lite2” branch from:

You can run it with the following options (global NCC for linear with “0” radius and local NCC with “3” voxel radius):
-linear_metric ncc -linear_metric.radius 0
-nl_metric ncc -nl_metric.radius 3

Please note that in linear registration guided by NCC is not symmetric (it is symmetric for nonlinear NCC registration).


So in summary - it might be a good idea to use SSD for the linear phases of population_template and local NCC for nonlinear + decrease regularisation parameters and add cortex masks.

Hope this will help!

Let me know if there will be any issues.

Best,
Alena

1 Like

Hi Stefanie,

I’ll throw in a few suggestions on top of what Alena has already said:

  • If you want good alignment of both white and grey matter in the DWI data, you might want to consider trying utilising the multiple ODFs generated by dwi2fod msmt_csd (the GM and CSF images are also ODFs, they’re just constant over the orientation domain) within the multi-contrast registration framework. See @maxpietsch’s relevant work here.

  • Particularly because the registration in MRtrix3 is based entirely on a voxel-grid-based representation of non-linear warps (and by extension the relevant gradients & Jacobians), as opposed to using a continuous spline representation, there may well be improvements to be made in registration by upsampling, despite the fact that you’re dealing with native 1.25mm data. Most people would probably scoff at the resulting computation times, but if you’re willing to make that investment, and also if you’re wanting your T1w / T2w data to be co-localised in the same template, I reckon give a 0.7mm template a red hot go.

  • Regarding the upsampling itself, there is a benefit to performing the upsampling on the DWI data rather than the FODs. See this relevant article from Tim Dyrby, which is often cited to justify such. If there is a lot of curvature in fibre orientations between two adjacent voxels, then interpolating the SH coefficients in between them can produce an ODF that contains both discrete orientations, rather than a single orientation in between those of the voxels from which values are being interpolated. But it does mean that spherical deconvolution takes quite a bit longer.

  • Finally, the use of mrregister & mrtransform in the FBA pipeline is multi-faceted:

    • If only a subset of participants in a study are utilised in construction of the population template, as opposed to the entire cohort, then the non-linear warp fields estimated by population_template should not be used. Those subjects that were not used in construction of the template would require an explicit mrregister call, and so you do not want to introduce a bias / inequality in processing by performing the registration in one way for some subjects and in a different way for others.

    • When iteratively registering ODFs and revising the template, it is beneficial to reorient FODs as the contribution of each subject’s image data to the template is updated. Without this, two input images from the same subject but with gross differences in head position within the scanner could never be properly aligned, as even if you could rotate the brains to overlap with one another perfectly in space, the FODs would look drastically different, since they would still reflect the subject’s head position prior to that reorientation. However once that template is constructed, it was found to be beneficial to, rather than reorienting FODs as they are transformed to the template and then running the segmentation algorithm to produce fixels, instead perform that segmentation on FODs that have not been reoriented, and instead apply that reorientation to the fixels. This simply prevents any imperfections of the approach used for FOD reorientation from having detrimental effects on the FOD segmentation algorithm, since having different numbers of fixels being produced for different subjects can introduce a large amount of variance to the data.

Cheers
Rob

Thank you very much @alenaullauus and @rsmith for the input!

After a few additional tests, based on your recommendations, I was able to improve my registrations. I added the GM and CSF ODFs as contrasts (along with the WM FOD) and decreased the regularisation parameters.

Thanks again!

Hi Alena,
We are trying to build the template and use your the cross correlation metric for the non-linear registration stage. Thanks for creating this possibility! :grinning:
The linear stages run fine but at the moment the non-linear starts we receive this error :
mrregister: [ERROR] the lmax needs to be defined for each multi-resolution level (scale factor)
Do we make a mistake in the way we start the template building command?

mrreg_lite2/bin/population_template ./fod_input ./wmfod_template_mrreg.mif ./gm_input gm_template_mrreg.mif ./csf_input ./csf_template_mrreg.mif -voxel_size 2.0 -warp_dir ./warps -transformed_dir ./wm_transforms_nl,./gm_transforms_nl,./csf_transforms_nl -linear_transformations_dir ./lin_transforms_nl -nl_scale 0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0 -nl_lmax 2,2,2,2,2,2,2,2,4,4,4,4,4,4,4,4 -nl_niter 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 -nl_update_smooth 2.0 -nl_disp_smooth 1.0 -nl_grad_step 0.5 -nl_metric ncc -nl_metric_radius 3 -info -nocleanup -force

thanks for shining your light on this one
Johan

Hi,

I think I fixed that bug in the registration_CC branch in this repo. Could you try if this solves your issue? Please note that this is still developmental code, please let us know if you into any issues!

git clone https://github.com/MRtrix3/mrtrix3.git mrtrix3_cc 
cd mrtrix3_cc
git checkout registration_CC
./configure

[EDIT] fixed git clone command

Hi Jovaudek and Alena,
@jovaudek @alenaullauus
I still get the same error “[ERROR] the lmax needs to be defined for each multi-resolution level (scale factor)” while using " mrreg_lite2/bin/population_template". Any idea to overcome this?

Best,
Jinglei

This bug should be fixed in the MRtrix repo (see above
Optimizing registration for FODs and structural images - #6 by maxpietsch).

Hi Max
Thanks for your reply. However, I found it does not work.

  1. When I run “git clone git@github.com:MRtrix3/mrtrix3.git”, I got " Error: Permission denied (publickey)"
  2. I manually downloaded the “master” package from “GitHub - MRtrix3/mrtrix3: MRtrix3 provides a set of tools to perform various advanced diffusion MRI analyses, including constrained spherical deconvolution (CSD), probabilistic tractography, track-density imaging, and apparent fibre density”.
  3. In this version, the “ncc” metric is not implemented for neither “population_template” nor “mrregister”.
    Could you help point out what I have done wrongly?

Best,
Jinglei

I got the error when using “-nl_metric ncc”.

Hi Jinglei,

Apologies, my git command requires ssh key access, you can use the HTTPS version of the git clone command. -nl_metric ncc is not implemented in master so the correct procedure should be:

git clone https://github.com/MRtrix3/mrtrix3.git mrtrix3_cc 
cd mrtrix3_cc
git checkout registration_CC
./configure
./build

Then you should be able to use the CC metric via ~/mrtrix3_cc/bin/population_template and ~/mrtrix3_cc/bin/mrregister. I’d recommend not using this code for anything else as other commands might be outdated compared to the master branch.

Rob wrote instructions on using custom branches in the wiki
Testing different code branches. Just make sure to build all commands as shown above.

Glad to learn how to use the branches of Mrtrix3. Following the instructions, I now have the registration_cc installed. And yes, both population_template and mrregister are equipped with “ncc”.

The population_template and mrregister run well, free of the previous error

Thank you!