@@ -2755,6 +2755,8 @@ class BIDSDataGrabberInputSpec(DynamicTraitedSpec):
2755
2755
desc = 'Generate exception if list is empty '
2756
2756
'for a given field' )
2757
2757
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.)' )
2758
2760
2759
2761
2760
2762
class BIDSDataGrabber (IOBase ):
@@ -2801,8 +2803,10 @@ def __init__(self, infields=None, **kwargs):
2801
2803
super (BIDSDataGrabber , self ).__init__ (** kwargs )
2802
2804
2803
2805
if not isdefined (self .inputs .output_query ):
2804
- self .inputs .output_query = {"func" : {"modality" : "func" },
2805
- "anat" : {"modality" : "anat" }}
2806
+ self .inputs .output_query = {
2807
+ "func" : {"modality" : "func" , 'extensions' : ['nii' , '.nii.gz' ]},
2808
+ "anat" : {"modality" : "anat" , 'extensions' : ['nii' , '.nii.gz' ]},
2809
+ }
2806
2810
2807
2811
# If infields is empty, use all BIDS entities
2808
2812
if infields is None and have_pybids :
@@ -2828,7 +2832,10 @@ def _run_interface(self, runtime):
2828
2832
return runtime
2829
2833
2830
2834
def _list_outputs (self ):
2831
- layout = gb .BIDSLayout (self .inputs .base_dir )
2835
+ exclude = None
2836
+ if self .inputs .strict :
2837
+ exclude = ['derivatives/' , 'code/' , 'sourcedata/' ]
2838
+ layout = gb .BIDSLayout (self .inputs .base_dir , exclude = exclude )
2832
2839
2833
2840
# If infield is not given nm input value, silently ignore
2834
2841
filters = {}
0 commit comments