Skip to content

Commit 6ed5a11

Browse files
committed
fix: add DWI to the default queries of BIDS querying
1 parent 16ccaa9 commit 6ed5a11

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

niworkflows/utils/bids.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@
3030
from packaging.version import Version
3131

3232

33+
DEFAULT_BIDS_QUERIES = {
34+
"bold": {"datatype": "func", "suffix": "bold", "part": ["mag", None]},
35+
"dwi": {"suffix": "dwi"},
36+
"flair": {"datatype": "anat", "suffix": "FLAIR", "part": ["mag", None]},
37+
"fmap": {"datatype": "fmap"},
38+
"pet": {"suffix": "pet"},
39+
"roi": {"datatype": "anat", "suffix": "roi"},
40+
"sbref": {"datatype": "func", "suffix": "sbref", "part": ["mag", None]},
41+
"t1w": {"datatype": "anat", "suffix": "T1w", "part": ["mag", None]},
42+
"t2w": {"datatype": "anat", "suffix": "T2w", "part": ["mag", None]},
43+
}
44+
45+
3346
class BIDSError(ValueError):
3447
def __init__(self, message, bids_root):
3548
indent = 10
@@ -151,11 +164,12 @@ def collect_participants(
151164
def collect_data(
152165
bids_dir,
153166
participant_label,
154-
session_id=Query.OPTIONAL,
167+
session_id=None,
155168
task=None,
156169
echo=None,
157170
bids_validate=True,
158171
bids_filters=None,
172+
queries=None,
159173
):
160174
"""
161175
Uses pybids to retrieve the input data for a given participant
@@ -223,19 +237,10 @@ def collect_data(
223237
'return_type': 'file',
224238
'subject': participant_label,
225239
'extension': ['.nii', '.nii.gz'],
226-
'session': session_id,
240+
'session': session_id or Query.OPTIONAL,
227241
}
228242

229-
queries = {
230-
"fmap": {"datatype": "fmap"},
231-
"bold": {"datatype": "func", "suffix": "bold", "part": ["mag", None]},
232-
"sbref": {"datatype": "func", "suffix": "sbref", "part": ["mag", None]},
233-
"flair": {"datatype": "anat", "suffix": "FLAIR", "part": ["mag", None]},
234-
"t2w": {"datatype": "anat", "suffix": "T2w", "part": ["mag", None]},
235-
"t1w": {"datatype": "anat", "suffix": "T1w", "part": ["mag", None]},
236-
"roi": {"datatype": "anat", "suffix": "roi"},
237-
"pet": {"suffix": "pet"}
238-
}
243+
queries = queries or DEFAULT_BIDS_QUERIES
239244
bids_filters = bids_filters or {}
240245
for acq, entities in bids_filters.items():
241246
queries[acq].update(entities)

0 commit comments

Comments
 (0)