|
30 | 30 | from packaging.version import Version
|
31 | 31 |
|
32 | 32 |
|
| 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 | + |
33 | 46 | class BIDSError(ValueError):
|
34 | 47 | def __init__(self, message, bids_root):
|
35 | 48 | indent = 10
|
@@ -151,11 +164,12 @@ def collect_participants(
|
151 | 164 | def collect_data(
|
152 | 165 | bids_dir,
|
153 | 166 | participant_label,
|
154 |
| - session_id=Query.OPTIONAL, |
| 167 | + session_id=None, |
155 | 168 | task=None,
|
156 | 169 | echo=None,
|
157 | 170 | bids_validate=True,
|
158 | 171 | bids_filters=None,
|
| 172 | + queries=None, |
159 | 173 | ):
|
160 | 174 | """
|
161 | 175 | Uses pybids to retrieve the input data for a given participant
|
@@ -223,19 +237,10 @@ def collect_data(
|
223 | 237 | 'return_type': 'file',
|
224 | 238 | 'subject': participant_label,
|
225 | 239 | 'extension': ['.nii', '.nii.gz'],
|
226 |
| - 'session': session_id, |
| 240 | + 'session': session_id or Query.OPTIONAL, |
227 | 241 | }
|
228 | 242 |
|
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 |
239 | 244 | bids_filters = bids_filters or {}
|
240 | 245 | for acq, entities in bids_filters.items():
|
241 | 246 | queries[acq].update(entities)
|
|
0 commit comments