Skip to content

Commit ef459f0

Browse files
committed
correct usage of the DataGrabber node
given sort_true is a mandatory argument now
1 parent 3abf131 commit ef459f0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/users/grabbing_and_sinking.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ DataGrabber stores its outputs in a field called outfiles.
5858
datasource1 = nio.DataGrabber()
5959
datasource1.inputs.base_directory = os.getcwd()
6060
datasource1.inputs.template = 'data/s1/f3.nii'
61+
datasource1.inputs.sort_filelist = True
6162
results = datasource1.run()
6263

6364
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'.
6768

6869
datasource2.inputs.base_directory = '/mass'
6970
datasource2.inputs.template = 'data/s*/f*.nii'
71+
datasource1.inputs.sort_filelist = True
7072

7173
Two special inputs were used in these previous cases. The input `base_directory`
7274
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).
8991
datasource3 = nio.DataGrabber(infields=['run'])
9092
datasource3.inputs.base_directory = os.getcwd()
9193
datasource3.inputs.template = 'data/s1/f%d.nii'
94+
datasource1.inputs.sort_filelist = True
9295
datasource3.inputs.run = [3, 7]
9396

9497
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.
98101

99102
datasource4 = nio.DataGrabber(infields=['subject_id', 'run'])
100103
datasource4.inputs.template = 'data/%s/f%d.nii'
104+
datasource1.inputs.sort_filelist = True
101105
datasource4.inputs.run = [3, 7]
102106
datasource4.inputs.subject_id = ['s1', 's3']
103107

@@ -115,6 +119,7 @@ wish to retrieve all the functional runs and the structural image for the subjec
115119
datasource = nio.DataGrabber(infields=['subject_id'], outfields=['func', 'struct'])
116120
datasource.inputs.base_directory = 'data'
117121
datasource.inputs.template = '*'
122+
datasource1.inputs.sort_filelist = True
118123
datasource.inputs.field_template = dict(func='%s/f%d.nii',
119124
struct='%s/struct.nii')
120125
datasource.inputs.template_args = dict(func=[['subject_id', [3,5,7,10]]],

0 commit comments

Comments
 (0)