@@ -2761,8 +2761,10 @@ class BIDSDataGrabberInputSpec(DynamicTraitedSpec):
2761
2761
desc = 'Generate exception if list is empty '
2762
2762
'for a given field' )
2763
2763
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' )
2766
2768
2767
2769
2768
2770
class BIDSDataGrabber (IOBase ):
@@ -2788,7 +2790,7 @@ class BIDSDataGrabber(IOBase):
2788
2790
are filtered on common entities, which can be explicitly defined as
2789
2791
infields.
2790
2792
2791
- >>> bg = BIDSDataGrabber(infields = ['subject'], outfields = ['dwi'] )
2793
+ >>> bg = BIDSDataGrabber(infields = ['subject'])
2792
2794
>>> bg.inputs.base_dir = 'ds005/'
2793
2795
>>> bg.inputs.subject = '01'
2794
2796
>>> bg.inputs.output_query['dwi'] = dict(modality='dwi')
@@ -2810,8 +2812,10 @@ def __init__(self, infields=None, **kwargs):
2810
2812
2811
2813
if not isdefined (self .inputs .output_query ):
2812
2814
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" ]},
2815
2819
}
2816
2820
2817
2821
# If infields is empty, use all BIDS entities
@@ -2838,10 +2842,11 @@ def _run_interface(self, runtime):
2838
2842
return runtime
2839
2843
2840
2844
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 )
2845
2850
2846
2851
# If infield is not given nm input value, silently ignore
2847
2852
filters = {}
0 commit comments