danjgale / nii-masker

Convenient command-line wrapper for nilearn's Masker objects
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Compatibility with fmriprep and BIDS ideas #12

Closed danjgale closed 3 years ago

danjgale commented 5 years ago

Just some thoughts.

Currently, niimasker works really nicely with fmriprep using glob pattern matching. For example:

niimasker output/ -i path/to/fmriprep/*/*/*preproc_bold.nii.gz  -m atlas.nii.gz \
--regressor_files  path/to/fmriprep/*/*/*confound_regressors.tsv \
--regressor_names csf white_matter trans_x trans_y trans_z rot_x rot_y rot_z \
--standardize --high_pass 0.01 --detrend --t_r 2

Because of the natural file sorting and BIDS-formatting of fmriprep, the input files and regressor files identified by the glob patterns are automatically aligned with each other. However, this approach could be simplified with the following commands:

niimasker output/ -i path/to/fmriprep  -m atlas.nii.gz --fmriprep \
--regressor_names csf white_matter trans_x trans_y trans_z rot_x rot_y rot_z \
--standardize --high_pass 0.01 --detrend --t_r 2

So, using an --fmriprep command replaces the need for glob patterns and using --regressor_files. Given that using fmriprep is standard practice in our lab now, this might make things more easier for everyone. However, given that fmriprep 1.4.0 (and maybe earlier versions too) lets you output your data into multiple spaces, we'd need to add an --output-space flag for which we can specify which output space to use. So, this approach would require adding an extra parameter option, which I'm hesitant to do. At this point, it might just be best to stick to the current glob approach.

If sticking to the current glob approach, then I'll write very clear documentation, with examples, for seamlessly integrating niimasker with fmriprep. I suspect that this is the most typical use case and this should be a priority (at least for the lab I'm in).

Lastly, in any case, another related parameter is needed in general. That is one to return a completely BIDS-standardized output (e.g., --bids). This would only be possible if the input data is also in BIDS, and niimasker would raise an error if not.

danjgale commented 3 years ago

I think the current approach with glob patterns for any application is best. Makes this flexible and not tied to one tool, and don't have to maintain a feature subject to change with fmriprep development