Skip to content

FIX: Storing --bids-filters within config file #2177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fmriprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def _drop_sub(value):

def _filter_pybids_none_any(dct):
import bids
return {k: bids.layout.Query.ANY if v == "*" else v
return {k: bids.layout.Query.NONE if v is None else
(bids.layout.Query.ANY if v == "*" else v)
for k, v in dct.items()}

def _bids_filter(value):
Expand Down
7 changes: 7 additions & 0 deletions fmriprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ def init(cls):
ignore=("code", "stimuli", "sourcedata", "models",
"derivatives", re.compile(r'^\.')))
cls.layout = cls._layout
if cls.bids_filters:
from bids.layout import Query
# unserialize pybids Query enum values
for acq, filters in cls.bids_filters.items():
cls.bids_filters[acq] = {
k: getattr(Query, v[7:-4]) if not isinstance(v, Query) and 'Query' in v else v
for k, v in filters.items()}


# These variables are not necessary anymore
Expand Down
6 changes: 6 additions & 0 deletions fmriprep/data/tests/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ stop_on_first_crash = false
[nipype.plugin_args]
maxtasksperchild = 1
raise_insufficient = false

[execution.bids_filters.t1w]
reconstruction = "<Query.NONE: 1>"

[execution.bids_filters.t2w]
reconstruction = "<Query.NONE: 1>"