Skip to content

Commit 1993589

Browse files
committed
ENH: Add optional session filter when collecting data
1 parent 3d10143 commit 1993589

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

niworkflows/utils/bids.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def collect_participants(
149149
def collect_data(
150150
bids_dir,
151151
participant_label,
152+
session_id=False,
152153
task=None,
153154
echo=None,
154155
bids_validate=True,
@@ -161,6 +162,23 @@ def collect_data(
161162
162163
>>> data_dir_canary()
163164
165+
Parameters
166+
----------
167+
bids_dir : :obj:`str` or :obj:`bids.layout.BIDSLayout`
168+
The BIDS directory
169+
participant_label : :obj:`str`
170+
The participant identifier
171+
session_id : :obj:`str`, None, or ``False``
172+
The session identifier. If ``False``, all sessions will be used (default).
173+
task : :obj:`str` or None
174+
The task identifier (for BOLD queries)
175+
echo : :obj:`int` or None
176+
The echo identifier (for BOLD queries)
177+
bids_validate : :obj:`bool`
178+
Whether the `bids_dir` is validated upon initialization
179+
bids_filters: :obj:`dict` or None
180+
Custom filters to alter default queries
181+
164182
Examples
165183
--------
166184
>>> bids_root, _ = collect_data(str(datadir / 'ds054'), '100185',
@@ -217,6 +235,10 @@ def collect_data(
217235
if echo:
218236
queries["bold"]["echo"] = echo
219237

238+
if session_id is not False:
239+
for acq in queries.keys():
240+
queries[acq]["session"] = session_id
241+
220242
subj_data = {
221243
dtype: sorted(
222244
layout.get(

0 commit comments

Comments
 (0)