bids-apps / MRtrix3_connectome

Generate subject connectomes from raw BIDS data & perform inter-subject connection density normalisation, using the MRtrix3 software package.
http://www.mrtrix.org/
Apache License 2.0
50 stars 26 forks source link

Supporting input DWI data on different voxel grids #123

Open Lestropie opened 1 year ago

Lestropie commented 1 year ago

Need to be able to support data for which execution otherwise fails with this error.

  1. Wait until denoising and Gibbs ringing removal have been completed
  2. Define the average header across all DWIs
  3. Resample all DWI data onto that grid If all voxel sizes are identical, then this can be done using mrtransform -replace; if not, then mrtransform -template will be necessary Ensure that gradient directions are rotated accordingly Ensure that phase encoding directions remain faithful
  4. If necessary, also resample any fmap/ images onto the same image grid (there are already cases where this can occur, but if step 4 above is invoked then this is guaranteed to be necessary)
Lestropie commented 1 year ago

Consider implementing as a feature in MRtrix3's dwicat.

Lestropie commented 1 year ago

Note that by implementing the necessary functionality in MRtrix3's dwicat, and then utilising that script here to deal with voxel grid differences, #64 will be closed.

Lestropie commented 1 year ago

Dealing with fmap/ images may be a little trickier than first anticipated.

A susceptibility field map can only be used reliably by eddy if the first volume of the input to topup is the same as the first volume of the input to eddy. There is some existing trickery within dwifslpreproc to deal with this; for instance, inserting the first DWI b=0 volume into the SE-EPI series to pass to eddy, and resampling the series provided via -se_epi to the DWI voxel grid if necessary. However the changes to dwicat potentially make this even more complex. Because we're no longer just dealing with voxel grid differences: dwicat may have actually moved the image content in space, particularly in the avoidance of interpolation to concatenate data from multiple series with different header transforms.

So I think maybe what needs to be done is:

  1. For each fmap/ image:
    1. Calculate affine transformation from fmap/ image to concatenated DWIs
    2. Extract rigid component of that transformation
    3. Apply rigid transformation without resampling
  2. Attempt to concatenate all transformed fmap/ images
  3. If step 2. above does not work:
    1. For each fmap/ image:
      1. Interpolate transformed image from step 1.iii. onto DWI voxel grid
    2. Concatenate all fmap/ images

For step 3.i.a., I think that it should be the transformed images that get resampled and not the originals: