nipreps / dmriprep

dMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse dMRI data. The transparent workflow dispenses of manual intervention, thereby ensuring the reproducibility of the results.
https://www.nipreps.org/dmriprep
Apache License 2.0
64 stars 24 forks source link

Implement QSIPREP's algorithm for b=0 masking #57

Closed oesteban closed 4 years ago

oesteban commented 4 years ago

In order to replace the current mask workflow (which relies on FSL+AFNI and is designed for BOLD-EPI).

The core of the algorithm is here: https://github.com/PennBBL/qsiprep/blob/a8a1617453b64c2fc7abd9682503aade949322fd/qsiprep/interfaces/nilearn.py#L423

However, the current implementation is not granular and will be hard to maintain in the long term. To simplify that, I'd propose creating a Nipype workflow where each node has a single tool to run. Therefore, these would be the steps to accomplish that:

  1. Convert calculate_gradmax_b0_mask to a workflow, dropping the report generation step.

    1.1. Reuse the b0 enhancement code from the current implementation (instead of most of this section) 1.2. Use nipype interfaces for ANTs' ImageMaths (instead of this). 1.3. Wrap skimage interfaces with nipype 1.4. Wrap sklearn interfaces with nipype 1.5. Use dipy's interfaces (e.g. otsu). 1.6. Replace nilearn's functions with nibabel's whenever possible.

  2. Similar process with watershed_refined_b0_mask

oesteban commented 4 years ago

Is someone willing to take on this one? May I suggest @josephmje ?

josephmje commented 4 years ago

Yes, I'd be happy to take this on. I checked with @mattcieslak on Wednesday and we weren't sure if you were already working on it.

Is there something I can include in the docstring to give the proper attribution to Matt?

On Fri., Jan. 17, 2020, 10:17 a.m. Oscar Esteban, notifications@github.com wrote:

Is someone willing to take on this one? May I suggest @josephmje https://github.com/josephmje ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nipreps/dmriprep/issues/57?email_source=notifications&email_token=AFIUBMVX4DUWWJLQBVYTJXDQ6HY5BA5CNFSM4KHH46FKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJIQ72Q#issuecomment-575737834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFIUBMTA5SGMORUL244LRLLQ6HY5BANCNFSM4KHH46FA .

oesteban commented 4 years ago

Glad I asked :)

Is there something I can include in the docstring to give the proper attribution to Matt?

We need to make sure QSIPREP is cited in the boilerplate. Of course, we can also add a reference in the docstring and add Matt to the creators list of the zenodo file.

richford commented 4 years ago

@josephmje, Are you working on this one? I don't want to duplicate effort but would be happy to take it on if you have other stuff on your plate.

josephmje commented 4 years ago

hey @richford. i started implementing qsiprep's algorithm but it changed midway through to use the T1w brain mask computed by smriprep (after registering the T1w to the b0). i've tested the existing masking algorithm (a port from fmriprep) on a bunch of my lab's datasets and its been working well for me. i ran into a few situations where ANTS N4 failed and i've been meaning to debug that.

oesteban commented 4 years ago

As per our last meeting, we are abandoning this particular algorithm. Because one of the core reasons to start with this is still standing (the use of FSL BET), whenever we find the bandwidth we'll attempt to remove FSL as a dependency.