@@ -2761,8 +2761,10 @@ class BIDSDataGrabberInputSpec(DynamicTraitedSpec):
27612761 desc = 'Generate exception if list is empty '
27622762 'for a given field' )
27632763 return_type = traits .Enum ('file' , 'namedtuple' , usedefault = True )
2764- strict = traits .Bool (desc = 'Return only BIDS "proper" files (e.g., '
2765- 'ignore derivatives/, sourcedata/, etc.)' )
2764+ index_derivatives = traits .Bool (False , usedefault = True ,
2765+ desc = 'Index derivatives/ sub-directory' )
2766+ extra_derivatives = traits .List (Directory (exists = True ),
2767+ desc = 'Additional derivative directories to index' )
27662768
27672769
27682770class BIDSDataGrabber (IOBase ):
@@ -2788,7 +2790,7 @@ class BIDSDataGrabber(IOBase):
27882790 are filtered on common entities, which can be explicitly defined as
27892791 infields.
27902792
2791- >>> bg = BIDSDataGrabber(infields = ['subject'], outfields = ['dwi'] )
2793+ >>> bg = BIDSDataGrabber(infields = ['subject'])
27922794 >>> bg.inputs.base_dir = 'ds005/'
27932795 >>> bg.inputs.subject = '01'
27942796 >>> bg.inputs.output_query['dwi'] = dict(modality='dwi')
@@ -2810,8 +2812,10 @@ def __init__(self, infields=None, **kwargs):
28102812
28112813 if not isdefined (self .inputs .output_query ):
28122814 self .inputs .output_query = {
2813- "func" : {"modality" : "func" , 'extensions' : ['nii' , '.nii.gz' ]},
2814- "anat" : {"modality" : "anat" , 'extensions' : ['nii' , '.nii.gz' ]},
2815+ "bold" : {"datatype" : "func" , "suffix" : "bold" ,
2816+ "extensions" : ["nii" , ".nii.gz" ]},
2817+ "T1w" : {"datatype" : "anat" , "suffix" : "T1w" ,
2818+ "extensions" : ["nii" , ".nii.gz" ]},
28152819 }
28162820
28172821 # If infields is empty, use all BIDS entities
@@ -2838,10 +2842,11 @@ def _run_interface(self, runtime):
28382842 return runtime
28392843
28402844 def _list_outputs (self ):
2841- exclude = None
2842- if self .inputs .strict :
2843- exclude = ['derivatives/' , 'code/' , 'sourcedata/' ]
2844- layout = bidslayout .BIDSLayout (self .inputs .base_dir , exclude = exclude )
2845+ layout = bidslayout .BIDSLayout (self .inputs .base_dir ,
2846+ derivatives = self .inputs .derivatives )
2847+
2848+ if isdefined (self .inputs .extra_derivatives ):
2849+ layout .add_derivatives (self .inputs .extra_derivatives )
28452850
28462851 # If infield is not given nm input value, silently ignore
28472852 filters = {}
0 commit comments