Skip to content

Commit 61a1df9

Browse files
mgxdeffigies
andcommitted
ENH: Leverage pybids functionality
Co-authored-by: Chris Markiewicz <[email protected]>
1 parent 1993589 commit 61a1df9

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

niworkflows/utils/bids.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import re
2727
import warnings
2828
from bids import BIDSLayout
29+
from bids.layout import Query
2930
from packaging.version import Version
3031

3132

@@ -149,7 +150,7 @@ def collect_participants(
149150
def collect_data(
150151
bids_dir,
151152
participant_label,
152-
session_id=False,
153+
session_id=Query.ANY,
153154
task=None,
154155
echo=None,
155156
bids_validate=True,
@@ -168,8 +169,8 @@ def collect_data(
168169
The BIDS directory
169170
participant_label : :obj:`str`
170171
The participant identifier
171-
session_id : :obj:`str`, None, or ``False``
172-
The session identifier. If ``False``, all sessions will be used (default).
172+
session_id : :obj:`str`, None, or :obj:`bids.layout.Query`
173+
The session identifier. By default, all sessions will be used.
173174
task : :obj:`str` or None
174175
The task identifier (for BOLD queries)
175176
echo : :obj:`int` or None
@@ -235,15 +236,12 @@ def collect_data(
235236
if echo:
236237
queries["bold"]["echo"] = echo
237238

238-
if session_id is not False:
239-
for acq in queries.keys():
240-
queries[acq]["session"] = session_id
241-
242239
subj_data = {
243240
dtype: sorted(
244241
layout.get(
245242
return_type="file",
246243
subject=participant_label,
244+
session=session_id,
247245
extension=[".nii", ".nii.gz"],
248246
**query,
249247
)

0 commit comments

Comments
 (0)