@@ -572,14 +572,45 @@ class DataFinderInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
572
572
573
573
574
574
class DataFinder (IOBase ):
575
- """Search for paths that match a given regular expression. Matched
576
- paths are available in the output 'out_paths'. Any named groups of
577
- captured text from the regular expression are also available as
578
- ouputs of the same name.
575
+ """Search for paths that match a given regular expression. Allows a less
576
+ proscriptive approach to gathering input files compared to DataGrabber.
577
+ Will recursively search any subdirectories by default. This can be limited
578
+ with the min/max depth options.
579
579
580
- Will recursively search any subdirectories by default. This can be
581
- limited with the min/max depth options. Named groups of text
582
- captured by the regular expression will also be output dynamically.
580
+ Matched paths are available in the output 'out_paths'. Any named groups of
581
+ captured text from the regular expression are also available as ouputs of
582
+ the same name.
583
+
584
+ Examples
585
+ --------
586
+
587
+ >>> from nipype.interfaces.io import DataFinder
588
+
589
+ Look for Nifti files in directories with "ep2d_fid" or "qT1" in the name,
590
+ starting in the current directory.
591
+
592
+ >>> df = DataFinder()
593
+ >>> df.inputs.root_paths = '.'
594
+ >>> df.inputs.match_regex = '.+/(?P<series_dir>.+(qT1|ep2d_fid_T1).+)/(?P<basename>.+)\.nii.gz'
595
+ >>> result = df.run()
596
+ >>> print result.outputs.out_paths
597
+ ['./027-ep2d_fid_T1_Gd4/acquisition.nii.gz',
598
+ './018-ep2d_fid_T1_Gd2/acquisition.nii.gz',
599
+ './016-ep2d_fid_T1_Gd1/acquisition.nii.gz',
600
+ './013-ep2d_fid_T1_pre/acquisition.nii.gz']
601
+
602
+ >>> print result.outputs.series_dir
603
+ ['027-ep2d_fid_T1_Gd4',
604
+ '018-ep2d_fid_T1_Gd2',
605
+ '016-ep2d_fid_T1_Gd1',
606
+ '013-ep2d_fid_T1_pre']
607
+
608
+ >>> print result.outputs.basename
609
+ ['acquisition',
610
+ 'acquisition',
611
+ 'acquisition',
612
+ 'acquisition']
613
+
583
614
"""
584
615
585
616
input_spec = DataFinderInputSpec
0 commit comments