@@ -58,6 +58,7 @@ DataGrabber stores its outputs in a field called outfiles.
58
58
datasource1 = nio.DataGrabber()
59
59
datasource1.inputs.base_directory = os.getcwd()
60
60
datasource1.inputs.template = 'data/s1/f3.nii'
61
+ datasource1.inputs.sort_filelist = True
61
62
results = datasource1.run()
62
63
63
64
Or you can get at all uncompressed NIfTI files starting with the letter 'f' in
@@ -67,6 +68,7 @@ all directories starting with the letter 's'.
67
68
68
69
datasource2.inputs.base_directory = '/mass'
69
70
datasource2.inputs.template = 'data/s*/f*.nii'
71
+ datasource1.inputs.sort_filelist = True
70
72
71
73
Two special inputs were used in these previous cases. The input `base_directory `
72
74
indicates in which directory to search, while the input `template ` indicates the
@@ -89,6 +91,7 @@ then used to set the template (see %d in the template).
89
91
datasource3 = nio.DataGrabber(infields=['run'])
90
92
datasource3.inputs.base_directory = os.getcwd()
91
93
datasource3.inputs.template = 'data/s1/f%d.nii'
94
+ datasource1.inputs.sort_filelist = True
92
95
datasource3.inputs.run = [3, 7]
93
96
94
97
This will return files `basedir/data/s1/f3.nii ` and `basedir/data/s1/f7.nii `. We
@@ -98,6 +101,7 @@ can take this a step further and pair subjects with runs.
98
101
99
102
datasource4 = nio.DataGrabber(infields=['subject_id', 'run'])
100
103
datasource4.inputs.template = 'data/%s/f%d.nii'
104
+ datasource1.inputs.sort_filelist = True
101
105
datasource4.inputs.run = [3, 7]
102
106
datasource4.inputs.subject_id = ['s1', 's3']
103
107
@@ -115,6 +119,7 @@ wish to retrieve all the functional runs and the structural image for the subjec
115
119
datasource = nio.DataGrabber(infields=['subject_id'], outfields=['func', 'struct'])
116
120
datasource.inputs.base_directory = 'data'
117
121
datasource.inputs.template = '*'
122
+ datasource1.inputs.sort_filelist = True
118
123
datasource.inputs.field_template = dict(func='%s/f%d.nii',
119
124
struct='%s/struct.nii')
120
125
datasource.inputs.template_args = dict(func=[['subject_id', [3,5,7,10]]],
0 commit comments