26
26
import re
27
27
import warnings
28
28
from bids import BIDSLayout
29
+ from bids .layout import Query
29
30
from packaging .version import Version
30
31
31
32
@@ -149,6 +150,7 @@ def collect_participants(
149
150
def collect_data (
150
151
bids_dir ,
151
152
participant_label ,
153
+ session_id = Query .OPTIONAL ,
152
154
task = None ,
153
155
echo = None ,
154
156
bids_validate = True ,
@@ -161,6 +163,23 @@ def collect_data(
161
163
162
164
>>> data_dir_canary()
163
165
166
+ Parameters
167
+ ----------
168
+ bids_dir : :obj:`str` or :obj:`bids.layout.BIDSLayout`
169
+ The BIDS directory
170
+ participant_label : :obj:`str`
171
+ The participant identifier
172
+ session_id : :obj:`str`, None, or :obj:`bids.layout.Query`
173
+ The session identifier. By default, all sessions will be used.
174
+ task : :obj:`str` or None
175
+ The task identifier (for BOLD queries)
176
+ echo : :obj:`int` or None
177
+ The echo identifier (for BOLD queries)
178
+ bids_validate : :obj:`bool`
179
+ Whether the `bids_dir` is validated upon initialization
180
+ bids_filters: :obj:`dict` or None
181
+ Custom filters to alter default queries
182
+
164
183
Examples
165
184
--------
166
185
>>> bids_root, _ = collect_data(str(datadir / 'ds054'), '100185',
@@ -222,6 +241,7 @@ def collect_data(
222
241
layout .get (
223
242
return_type = "file" ,
224
243
subject = participant_label ,
244
+ session = session_id ,
225
245
extension = [".nii" , ".nii.gz" ],
226
246
** query ,
227
247
)
0 commit comments