Skip to content
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

ENH: Use BIDSLayoutIndexer and do not index unnecessary modalities #2494

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 13 additions & 4 deletions fmriprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ def init(cls):

if cls._layout is None:
import re
from bids.layout.index import BIDSLayoutIndexer
from bids.layout import BIDSLayout

if cls.bids_database_dir:
Expand All @@ -446,19 +447,27 @@ def init(cls):
_db_path = cls.work_dir / cls.run_uuid / "bids_db"

_db_path.mkdir(exist_ok=True, parents=True)
cls._layout = BIDSLayout(
str(cls.bids_dir),

# Recommended after PyBIDS 12.1
_indexer = BIDSLayoutIndexer(
validate=False,
database_path=_db_path,
reset_database=cls.bids_database_dir is None,
ignore=(
"code",
"stimuli",
"sourcedata",
"models",
re.compile(r"^\."),
re.compile(
r"sub-[a-zA-Z0-9]+(/ses-[a-zA-Z0-9]+)?/(beh|dwi|eeg|ieeg|meg|perf)"
),
),
)
cls._layout = BIDSLayout(
str(cls.bids_dir),
database_path=_db_path,
reset_database=cls.bids_database_dir is None,
indexer=_indexer,
)
cls.bids_database_dir = _db_path
cls.layout = cls._layout
if cls.bids_filters:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ install_requires =
numpy
pandas
psutil >= 5.4
pybids >= 0.11.1
pybids >= 0.12.1
pyyaml
requests
scikit-image ~= 0.17.2
Expand Down