Skip to content

Commit 06e8316

Browse files
committed
Update BIDS data grabbing to grab only anatomical and PET data (no functional)
1 parent 2a10a59 commit 06e8316

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
@@ -39,7 +39,7 @@
3939
'pet': {'suffix': 'pet'},
4040
'roi': {'datatype': 'anat', 'suffix': 'roi'},
4141
'sbref': {'datatype': 'func', 'suffix': 'sbref', 'part': ['mag', None]},
42-
't1w': {'datatype': 'anat', 'suffix': 'T1w', 'part': ['mag', None]},
42+
't1w': {'suffix': 'T1w'},
4343
't2w': {'datatype': 'anat', 'suffix': 'T2w', 'part': ['mag', None]},
4444
'asl': {'datatype': 'perf', 'suffix': 'asl'},
4545
}
@@ -236,8 +236,9 @@ def collect_data(
236236
'return_type': 'file',
237237
'subject': participant_label,
238238
'extension': ['.nii', '.nii.gz'],
239-
'session': session_id or Query.OPTIONAL,
240239
}
240+
if session_id is not None:
241+
layout_get_kwargs['session'] = session_id
241242

242243
queries = queries or DEFAULT_BIDS_QUERIES
243244
bids_filters = bids_filters or {}
@@ -248,20 +249,10 @@ def collect_data(
248249
# avoid clobbering layout.get
249250
del layout_get_kwargs[entity]
250251

251-
if task:
252-
queries['bold']['task'] = task
253-
254-
if echo:
255-
queries['bold']['echo'] = echo
256-
257252
subj_data = {
258253
dtype: sorted(layout.get(**layout_get_kwargs, **query)) for dtype, query in queries.items()
259254
}
260255

261-
# Special case: multi-echo BOLD, grouping echos
262-
if group_echos and 'bold' in subj_data and any('_echo-' in bold for bold in subj_data['bold']):
263-
subj_data['bold'] = group_multiecho(subj_data['bold'])
264-
265256
return subj_data, layout
266257

267258

0 commit comments

Comments
 (0)