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,7 +150,7 @@ def collect_participants(
149
150
def collect_data (
150
151
bids_dir ,
151
152
participant_label ,
152
- session_id = False ,
153
+ session_id = Query . ANY ,
153
154
task = None ,
154
155
echo = None ,
155
156
bids_validate = True ,
@@ -168,8 +169,8 @@ def collect_data(
168
169
The BIDS directory
169
170
participant_label : :obj:`str`
170
171
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.
173
174
task : :obj:`str` or None
174
175
The task identifier (for BOLD queries)
175
176
echo : :obj:`int` or None
@@ -235,15 +236,12 @@ def collect_data(
235
236
if echo :
236
237
queries ["bold" ]["echo" ] = echo
237
238
238
- if session_id is not False :
239
- for acq in queries .keys ():
240
- queries [acq ]["session" ] = session_id
241
-
242
239
subj_data = {
243
240
dtype : sorted (
244
241
layout .get (
245
242
return_type = "file" ,
246
243
subject = participant_label ,
244
+ session = session_id ,
247
245
extension = [".nii" , ".nii.gz" ],
248
246
** query ,
249
247
)
0 commit comments