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
http://www.mrtrix.org
Mozilla Public License 2.0
281 stars 176 forks source link

New command: dwirecon #2915

Open Lestropie opened 1 month ago

Lestropie commented 1 month ago

Creating a draft PR to facilitate external tracking.

This work was done in collaboration with @tclose and @arkiev for creation of a DWI pre-processing pipeline in Pydra. We've ported much of dwifslpreproc over to that environment. But one of the final components, being the explicit weighted recombination of DWI volume pairs with identical diffusion sensitisation but opposing phase encoding direction, would have been exceptionally difficult to port to that environment.

Moreover, I am commonly utilising an acquisition strategy that is currently not explicitly handled by dwifslpreproc. I utilise a subset of the capabilities of the scattered-slice acquisition work, where I take the full gradient table, split it into two individually-well-distributed subsets, and acquire one subset with one phase encoding direction and then the other with the opposite phase encoding direction, such that after pre-processing and concatenation the aggregated data is well distributed. However in regions of strong susceptibility distortion, half of the images will be blurred. Ideally, this would be handled either by something like what the SHARD recon does, or with a weighted diffusion model fit. What I've done here instead, as an incremental improvement that's consistent with the current workflow, is to introduce an additional capability into the pre-processing, that will appear in the same place as the explicit volume pair combination. Here, where a volume is expected to be erroneously smooth due to EPI distortion, the reconstructed image intensity will be heuristically weighted with the intensity predicted by other volume groups that have different effects of distortions. This allows slightly better results of DWI model fitting in regions of strong susceptibility distortions. Unlike the SHARD recon this is done on a per-shell basis. This would have been very difficult to manage as Python code within dwifslpreproc.

Therefore here I'm proposing a new C++ command dwirecon, which can perform different operations involving reconstruction of DWI data depending on what is required for any given processing pipeline.

The implemented combine_pairs operation duplicates exactly what is currently done in dwifslpreproc. The combine_predicted operation seems to be doing a sensible job in terms of utilising predicted data in regions of strong susceptibility distortions but leaving data elsewhere unmodified; I'll present some examples here when I get the chance to come back to it.


dchristiaens commented 1 month ago

The term "reconstruction" is so widely used medical imaging that I suppose a potential naming conflict for dwirecon was only a matter of time. That said, I would have preferred to merge SHARD-recon into the main repo before other commands with this name are added.

Moreover, the overarching purpose you describe could, I think, be achieved directly with dwirecon (SHARD edition). You would simply need to provide the field map and the PE table, and set the appropriate slice thickness for the split acquisition you describe. It is perfectly possible to run this single-shell, if you want. From what I understand, the only part that is not supported in dwirecon (SHARD edition) is the leave-one-out approach you describe, but this is not yet implemented in this PR either. Did you compare both approaches?

Longer term, I could see the operation of the SHARD dwirecon command being incorporated into this dwirecon command as one operation among many.

May I suggest to do it the other way around? The additional functionality to deal with subject motion, the slice profile, outlier weights, etc., bring about a lot more complexity.

Lestropie commented 1 month ago

dwi2dwi? :upside_down_face:

the overarching purpose you describe could, I think, be achieved directly with dwirecon (SHARD edition).

Hmmm, potentially. The SHARD recon behaviour in the -rpe_all context would maybe be closer in behaviour to eddy's least-squares reconstruction, rather than the very simple weighted averaging currently in place. For the split PE design, it would certainly be more principled than what I'm doing here. But how the outcomes may differ, I don't know, I haven't tried it. For the Pydra pipeline we'd like to integrate SHARD pre-processing as an alternative workflow option in the future (was going to email you about that separately once we had a minimal working product). Here I'm currently only trying to facilitate utilisation of the current pipeline in that environment, and am conscious of potential road blocks given external time pressures.

What would be the prospect of integration of a subset of the SHARD capabilities into 3.1: enough to facilitate the functionalities required here, but not the entire pre-processing pipeline?

One of the tasks on my to-do list is to acquire single-session data using all of the different phase encoding strategies that can be handled by dwifslpreproc, to use as exemplar workshop data. Perhaps in the process of generating that data I can finally try getting my hands dirty with SHARD, not only as a potential substitute for dwifslpreproc but potentially also just for estimation of the final DWI data post-eddy.

May I suggest to do it the other way around?

My thinking was that if these were separate "operations" within the same command, akin to something like mrfilter, then the order of implementation / distribution wouldn't matter; there may just be some operations that have many command-line options only applicable to that operation. Whereas if I'm following your train of thought, there would be no need for such distinct "operations"; they would all fall under the banner of "given these input DWI data, and other input parameters, give me output DWI data".