PennLINC / qsiprep

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

Lines to modify RE: skipping T1w registration and leaving preprocessed dwi in native diffusion space #15

Closed dPys closed 4 years ago

dPys commented 4 years ago

Creating a trigger for this now, but I wanted to be sure you haven't already done this?

Plan is to add 'native' as an option to output_spaces to essentially skip lines 474-L556 of qsiprep/workflows/dwi/base.py.

Theoretically this option should also obviate the need for any T1 processing as well?

Let me know if you have any thoughts, preferences, or suggestions.

@dPys

mattcieslak commented 4 years ago

I think the easiest way to do this is to add in all the new fmriprep code from v1.4.1. They add the ability to write outputs to a bunch of templates and to native space. This will be a big overhaul so will probably happen a bit down the road.

dPys commented 4 years ago

Mind if I take this one on personally? I'd also be happy to restrict it to a personal fork rather than outright PR if you'd prefer. Since all of my testing of qsiprep on our test-retest data appears to be succeeding, this goal would seem to be the last remaining hurdle before ndmg and pynets can fully integrated with psiprep...

Would be helpful to get a sense though of which modules in particular would likely require changing (if known) and where along the execution graph exactly T1-related processing actually begins to occur. Looking over fmriprep v1.4.1, it seems that the tweak is not too bad and may simply require a few conditional wf.disconnect/connect statements.

Cheers, @dPys

mattcieslak commented 4 years ago

I would be very grateful if you tried to get this working. One potential issue is that qsiprep is currently reflecting fmriprep from version 1.2.6, so it may be more involved. You'd need to change code in workflows.dwi.resampling, workflows.dwi.derivatives, interfaces.gradients, and workflows.dwi.base.

I'm not convinced that native space is very useful. Here are some of the issues that made me not want to use it in my own workflows:

I'm working on a branch that registers everything to an intramodal template (#18) that would register all the dwis to a midpoint image of their distortion-corrected b=0 images. In the case where you have a single scan this would be effectively native space. Then you'll only need the one coregistered t1w and tissue maps. What do you think?

dPys commented 4 years ago

I can take a stab at it. I see now that quite a few changes may be required, but it might also be a good opportunity for me to get more familiar with qsiprep's internals in the process...

Thanks also for the excellent points RE: choice of native space. Obviously, these will all remain somewhat open questions until more empirical clarity can be gleaned one way or another, but I will try to address the issues raised based on my own analysis experiences and from what I've read:

1) if one has > 1 dwi series and wants to do voxelwise comparisons, why should one necessarily have to pick a native space? It seems to me that, normalization issues aside, voxelwise analysis probably makes the most sense in an independent template space anyway (e.g. FMRIB58_FA_1mm) rather than using a native-space target. Worth noting that FSL has always managed to implement their pre-TBSS dmri preprocessing routines with a native-space assumption, which I think was a reasonable choice.

2) Although it is true that motion/distortion correction interpolates data, that this is within-modality, no? In my opinion, the truly worrisome source of interpolation error that gets avoided with native-space processing is that which arises from the intermodal spatial registration that occurs when using a T1/T2 template as reference. What I mean is that there is a host of additional assumptions to consider since tissue signal contrasts fundamentally differ across a T1 and dwi such that spatial landmarks needed to optimize the registration will be less aligned and less precise. This was (sort of) the whole reasoning behind boundary-based registration (BBR) as it was initially conceived with epi BOLD images in mind. On that note, I do very much like the idea of using an intramodal template (w.r.t issue #18 ) and would be eager to see some examples of those outputs.

3) I didn't realize that HCP did ACPC space, but I agree that this would seem to be a useful strategy for QC regardless of the eventual output space (i.e. native, t1, or template).

4) I see the argument for saving on computation by estimating only one segmentation, though I don't see why a separate linear transform can't be calculated and applied to map the same segmentation to a different native diffusion space across runs? In fact, this is exactly what I've done for NDMG and pynets (see: https://github.com/neurodata/ndmg/blob/staging/ndmg/register/gen_reg.py#L818-948)

5) That seems very reasonable to me.

@dPys

mattcieslak commented 4 years ago
1. if one has > 1 dwi series and wants to do voxelwise comparisons, why should one necessarily have to pick a native space? It seems to me that, normalization issues aside, voxelwise analysis probably makes the most sense in an independent template space anyway (e.g. FMRIB58_FA_1mm) rather than using a native-space target. Worth noting that FSL has always managed to implement their pre-TBSS dmri preprocessing routines with a native-space assumption, which I think was a reasonable choice.

If the subject re-positioned their head between scans then the head position of one of those scans would have to be chosen as the native space. I know the new fmriprep with templateflow has an option for native space, so this will likely get adopted here at some point.

2. Although it is true that motion/distortion correction interpolates data, that this is within-modality, no? In my opinion, the truly worrisome source of interpolation error that gets avoided with native-space processing is that which arises from the intermodal spatial registration that occurs when using a T1/T2 template as reference. What I mean is that there is a host of additional assumptions to consider since tissue signal contrasts fundamentally differ across a T1 and dwi such that spatial landmarks needed to optimize the registration will be less aligned and less precise. This was (sort of) the whole reasoning behind boundary-based registration (BBR) as it was initially conceived with epi BOLD images in mind. On that note, I do very much like the idea of using an intramodal template (w.r.t issue #18 ) and would be eager to see some examples of those outputs.

Interpolation doesn't depend on modality in any way. The registration process itself may perform more or less accurately depending on what is being registered, but interpolation is an independent operation.

If you want to try this, let's open a more specific issue

dPys commented 4 years ago
1. if one has > 1 dwi series and wants to do voxelwise comparisons, why should one necessarily have to pick a native space? It seems to me that, normalization issues aside, voxelwise analysis probably makes the most sense in an independent template space anyway (e.g. FMRIB58_FA_1mm) rather than using a native-space target. Worth noting that FSL has always managed to implement their pre-TBSS dmri preprocessing routines with a native-space assumption, which I think was a reasonable choice.

If the subject re-positioned their head between scans then the head position of one of those scans would have to be chosen as the native space. I know the new fmriprep with templateflow has an option for native space, so this will likely get adopted here at some point.

Terrific!

2. Although it is true that motion/distortion correction interpolates data, that this is within-modality, no? In my opinion, the truly worrisome source of interpolation error that gets avoided with native-space processing is that which arises from the intermodal spatial registration that occurs when using a T1/T2 template as reference. What I mean is that there is a host of additional assumptions to consider since tissue signal contrasts fundamentally differ across a T1 and dwi such that spatial landmarks needed to optimize the registration will be less aligned and less precise. This was (sort of) the whole reasoning behind boundary-based registration (BBR) as it was initially conceived with epi BOLD images in mind. On that note, I do very much like the idea of using an intramodal template (w.r.t issue #18 ) and would be eager to see some examples of those outputs.

Interpolation doesn't depend on modality in any way. The registration process itself may perform more or less accurately depending on what is being registered, but interpolation is an independent operation.

If you want to try this, let's open a more specific issue

It appears I misspoke RE: interpolation (I was referring to the registration process itself-- not interpolation in the formal sense of post-reg interp methods like trilinear, nn, etc.) The registration process itself will indeed perform a lot less accurately in the case of working with images of different modalities. This is because we are forced to rely primarily on inter-modal cost functions with less DOF, but also because the tissue contrasts are entirely different-- they live on different scales, refer to different underlying properties and will become unavoidably distorted in the case that we register one to the other. The question of to what extent this introduces spatial error is a different one, however. Our discriminability analyses of structural connectomes generated in native space and with T1w registration seems to indicate that the difference is by no means negligible.

@dPys