@@ -1296,32 +1296,36 @@ class SelectFilesInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
12961296class SelectFiles (IOBase ):
12971297 """Flexibly collect data from disk to feed into workflows.
12981298
1299- This interface uses the {}-based string formatting syntax to plug
1299+ This interface uses Python's {}-based string formatting syntax to plug
13001300 values (possibly known only at workflow execution time) into string
1301- templates and collect files from persistant storage. These templates
1302- can also be combined with glob wildcards. The field names in the
1303- formatting template (i.e. the terms in braces) will become inputs
1304- fields on the interface, and the keys in the templates dictionary
1305- will form the output fields.
1301+ templates and collect files from persistant storage. These templates can
1302+ also be combined with glob wildcards (*, ?) and character ranges ([...]).
1303+ The field names in the formatting template (i.e. the terms in braces) will
1304+ become inputs fields on the interface, and the keys in the templates
1305+ dictionary will form the output fields.
13061306
13071307 Examples
13081308 --------
13091309
13101310 >>> import pprint
13111311 >>> from nipype import SelectFiles, Node
13121312 >>> templates={"T1": "{subject_id}/struct/T1.nii",
1313- ... "epi": "{subject_id}/func/f[0, 1].nii"}
1313+ ... "epi": "{subject_id}/func/f[0,1].nii"}
13141314 >>> dg = Node(SelectFiles(templates), "selectfiles")
13151315 >>> dg.inputs.subject_id = "subj1"
13161316 >>> pprint.pprint(dg.outputs.get()) # doctest:
13171317 {'T1': <undefined>, 'epi': <undefined>}
13181318
1319- The same thing with dynamic grabbing of specific files:
1319+ Note that SelectFiles does not support lists as inputs for the dynamic
1320+ fields. Attempts to do so may lead to unexpected results because brackets
1321+ also express glob character ranges. For example,
13201322
1321- >>> templates["epi"] = "{subject_id}/func/f{run!s }.nii"
1323+ >>> templates["epi"] = "{subject_id}/func/f{run}.nii"
13221324 >>> dg = Node(SelectFiles(templates), "selectfiles")
13231325 >>> dg.inputs.subject_id = "subj1"
1324- >>> dg.inputs.run = [2, 4]
1326+ >>> dg.inputs.run = [10, 11]
1327+
1328+ would match f0.nii or f1.nii, not f10.nii or f11.nii.
13251329
13261330 """
13271331 input_spec = SelectFilesInputSpec
0 commit comments