Skip to content

Commit db3b0ed

Browse files
committed
ENH: Add strict mode to BIDSDataGrabber
1 parent 1efa6cd commit db3b0ed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nipype/interfaces/io.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,8 @@ class BIDSDataGrabberInputSpec(DynamicTraitedSpec):
27552755
desc='Generate exception if list is empty '
27562756
'for a given field')
27572757
return_type = traits.Enum('file', 'namedtuple', usedefault=True)
2758+
strict = traits.Bool(desc='Return only BIDS "proper" files (e.g., '
2759+
'ignore derivatives/, sourcedata/, etc.)')
27582760

27592761

27602762
class BIDSDataGrabber(IOBase):
@@ -2828,8 +2830,10 @@ def _run_interface(self, runtime):
28282830
return runtime
28292831

28302832
def _list_outputs(self):
2831-
layout = gb.BIDSLayout(self.inputs.base_dir,
2832-
exclude=['derivatives/', 'code/', 'sourcedata/'])
2833+
exclude = None
2834+
if self.inputs.strict:
2835+
exclude = ['derivatives/', 'code/', 'sourcedata/']
2836+
layout = gb.BIDSLayout(self.inputs.base_dir, exclude=exclude)
28332837

28342838
# If infield is not given nm input value, silently ignore
28352839
filters = {}

0 commit comments

Comments
 (0)