Skip to content

Commit 343cdb3

Browse files
committed
ENH: Parse kwargs to allow no T1w
Also, adds a default to the expected kwarg `anat_only` to allow bare initialization
1 parent 2ec6b23 commit 343cdb3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

niworkflows/interfaces/bids.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,24 +253,32 @@ class BIDSDataGrabber(SimpleInterface):
253253
>>> bids_src.inputs.subject_data = bids_collect_data(
254254
... str(datadir / 'ds114'), '01', bids_validate=False)[0]
255255
>>> bids_src.inputs.subject_id = '01'
256+
>>> bids_src._require_t1w
257+
True
258+
>>> bids_src._require_funcs
259+
True
256260
>>> res = bids_src.run()
257261
>>> res.outputs.t1w # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
258262
['.../ds114/sub-01/ses-retest/anat/sub-01_ses-retest_T1w.nii.gz',
259263
'.../ds114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz']
260264
265+
>>> bids_src = BIDSDataGrabber(require_t1w=False)
266+
>>> bids_src._require_t1w
267+
False
261268
"""
262269

263270
input_spec = _BIDSDataGrabberInputSpec
264271
output_spec = _BIDSDataGrabberOutputSpec
265272
_require_funcs = True
266273

267274
def __init__(self, *args, **kwargs):
268-
anat_only = kwargs.pop('anat_only')
275+
anat_only = kwargs.pop('anat_only', None)
269276
anat_derivatives = kwargs.pop('anat_derivatives', None)
277+
require_t1w = kwargs.pop('require_t1w', True)
270278
super().__init__(*args, **kwargs)
271279
if anat_only is not None:
272280
self._require_funcs = not anat_only
273-
self._require_t1w = anat_derivatives is None
281+
self._require_t1w = require_t1w and anat_derivatives is None
274282

275283
def _run_interface(self, runtime):
276284
bids_dict = self.inputs.subject_data

0 commit comments

Comments
 (0)