Skip to content

Commit bc9c1dd

Browse files
mnoergaardeffigies
authored andcommitted
Update BIDS data grabbing to grab only anatomical and PET data (no functional)
1 parent bebfbcf commit bc9c1dd

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

niworkflows/interfaces/bids.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class BIDSDataGrabber(SimpleInterface):
260260

261261
input_spec = _BIDSDataGrabberInputSpec
262262
output_spec = _BIDSDataGrabberOutputSpec
263-
_require_funcs = True
263+
_require_funcs = False
264264

265265
def __init__(self, *args, **kwargs):
266266
anat_only = kwargs.pop('anat_only', None)
@@ -282,12 +282,7 @@ def _run_interface(self, runtime):
282282
f'No T1w images found for subject sub-{self.inputs.subject_id}'
283283
)
284284

285-
if self._require_funcs and not bids_dict['bold']:
286-
raise FileNotFoundError(
287-
f'No functional images found for subject sub-{self.inputs.subject_id}'
288-
)
289-
290-
for imtype in ['bold', 't2w', 'flair', 'fmap', 'sbref', 'roi', 'pet', 'asl']:
285+
for imtype in ['t2w', 'flair', 'fmap', 'sbref', 'roi', 'pet', 'asl']:
291286
if not bids_dict[imtype]:
292287
LOGGER.info('No "%s" images found for sub-%s', imtype, self.inputs.subject_id)
293288

niworkflows/utils/bids.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
'pet': {'suffix': 'pet'},
4242
'roi': {'datatype': 'anat', 'suffix': 'roi'},
4343
'sbref': {'datatype': 'func', 'suffix': 'sbref', 'part': ['mag', None]},
44-
't1w': {'datatype': 'anat', 'suffix': 'T1w', 'part': ['mag', None]},
44+
't1w': {'suffix': 'T1w'},
4545
't2w': {'datatype': 'anat', 'suffix': 'T2w', 'part': ['mag', None]},
4646
'asl': {'datatype': 'perf', 'suffix': 'asl'},
4747
}
@@ -251,8 +251,9 @@ def collect_data(
251251
'return_type': 'file',
252252
'subject': participant_label,
253253
'extension': ['.nii', '.nii.gz'],
254-
'session': session_id or Query.OPTIONAL,
255254
}
255+
if session_id is not None:
256+
layout_get_kwargs['session'] = session_id
256257

257258
reserved_entities = [('subject', participant_label), ('session', session_id)]
258259

@@ -271,20 +272,10 @@ def collect_data(
271272
# avoid clobbering layout.get
272273
del layout_get_kwargs[entity]
273274

274-
if task:
275-
queries['bold']['task'] = task
276-
277-
if echo:
278-
queries['bold']['echo'] = echo
279-
280275
subj_data = {
281276
dtype: sorted(layout.get(**layout_get_kwargs, **query)) for dtype, query in queries.items()
282277
}
283278

284-
# Special case: multi-echo BOLD, grouping echos
285-
if group_echos and 'bold' in subj_data and any('_echo-' in bold for bold in subj_data['bold']):
286-
subj_data['bold'] = group_multiecho(subj_data['bold'])
287-
288279
return subj_data, layout
289280

290281

0 commit comments

Comments
 (0)