PennLINC / qsiprep

Preprocessing of diffusion MRI
http://qsiprep.readthedocs.io
BSD 3-Clause "New" or "Revised" License
138 stars 55 forks source link

ENH: Dealing with gradient non-linearities #71

Open akhanf opened 4 years ago

akhanf commented 4 years ago

For gradient systems with significant non-linearities (e.g. connectome scanner, some 7T head-only systems), it is important to account for these as they not only lead to spatial distortion, but also spatially-dependent changes in b-vector encoding. A recent paper quantifies this nicely: https://www.sciencedirect.com/science/article/pii/S1053811919307189 It is described in the HCP pre-processing pipeline as well: https://github.com/Washington-University/HCPpipelines/wiki/FAQ

There are a number of different features that could be related to this:

  1. Allowing the user to input a gradient table that describes the non-linearities (since the tables are proprietary); the app could use to this generate the warp, concatenate with any other relevant transforms (e.g. to reference T1 or template space), and generate a gradient deviations file (grad_dev nifti) that encodes the Jacobian of the warp.
  2. Have the user supply already unwarped data, along with grad_dev files (e.g. public HCP data) instead of performing the unwarping inside the app
  3. Incorporating the gradient deviation files (grad_dev) in the app for tensor fitting and other reconstructions -- now I am not sure whether the existing tools underlying qsiprep currently support the use of grad_dev files (e.g. FSL and MDT are two other software packages that do).

I am hopeful to hear that there would be interest from existing qsiprep users in incorporating these features, as I admit they are not required for the majority of datasets. Our in-house pipeline/BIDS-app (https://github.com/khanlab/prepdwi) actually implements these general steps, however that pipeline was not designed for longevity and I really would like to shift over to qsiprep since it is so much more feature-rich and is actually well-engineered!! Happy to help out in with this if I can -- I don't have alot of time to code, and still a newbie in nipype, but there are some other developers here that I could engage if needed.

One potential issue might be that the underlying fitting/reconstruction in Dipy may not yet support gradient deviations. We are currently using FSL (dtifit & bedpost) and MDT (https://github.com/cbclab/MDT) for that since they support using gradient deviation files for fitting.

PS - great job on putting qsiprep together, really keen to see it become the standard dMRI processing BIDS App in the community, excellent start!

mattcieslak commented 4 years ago

Hi @akhanf, Thanks for opening this issue!

1. Allowing the user to input a gradient table that describes the non-linearities (since the tables are proprietary); the app could use to this generate the warp, concatenate with any other relevant transforms (e.g. to reference T1 or template space), and generate a gradient deviations file (grad_dev nifti) that encodes the Jacobian of the warp.

We could make the path to the table file an argument to qsiprep. Does the warp apply to the structural images and the diffusion images? If it applies to the structural images too it might be worth also opening a PR on smriprep.

2. Have the user supply already unwarped data, along with grad_dev files (e.g. public HCP data) instead of performing the unwarping inside the app

This is undocumented at the moment, but if you rename your preprocessed outputs to look like qsiprep outputs, you should be able to run the reconstruction workflows on them.

3. Incorporating the gradient deviation files (grad_dev) in the app for tensor fitting and other reconstructions -- now I am not sure whether the existing tools underlying qsiprep currently support the use of grad_dev files (e.g. FSL and MDT are two other software packages that do).

DSI Studio also supports using grad_dev files if they are in the same directory as the src.gz file you are reconstructing.

I think this is a great idea for a feature and would welcome a PR on it, even if it takes some time to get fully working. The documentation for HCP's gradunwarp fork doesn't specify what the format is for the warps. I'm assuming they're FSL? If we can get them into ANTs format then incorporating them into the rest of the pipeline will be pretty easy.

mattcieslak commented 7 months ago

There is a tool in TORTOISE that can do this, and TORTOISE is in qsiprep now.