@@ -121,15 +121,15 @@ def analyze_openfmri_dataset(data_dir, subject=None, model_id=None,
121
121
Set up openfmri data specific components
122
122
"""
123
123
124
- subjects = [path .split (os .path .sep )[- 1 ] for path in
125
- glob (os .path .join (data_dir , 'sub*' ))]
124
+ subjects = sorted ( [path .split (os .path .sep )[- 1 ] for path in
125
+ glob (os .path .join (data_dir , 'sub*' ))])
126
126
127
127
infosource = pe .Node (niu .IdentityInterface (fields = ['subject_id' ,
128
128
'model_id' ,
129
129
'task_id' ]),
130
130
name = 'infosource' )
131
131
if subject is None :
132
- infosource .iterables = [('subject_id' , subjects [: 2 ] ),
132
+ infosource .iterables = [('subject_id' , subjects ),
133
133
('model_id' , [model_id ]),
134
134
('task_id' , [task_id ])]
135
135
else :
@@ -200,13 +200,19 @@ def get_highpass(TR, hpcutoff):
200
200
def get_contrasts (contrast_file , task_id , conds ):
201
201
import numpy as np
202
202
contrast_def = np .genfromtxt (contrast_file , dtype = object )
203
+ if len (contrast_def .shape ) == 1 :
204
+ contrast_def = contrast_def [None , :]
203
205
contrasts = []
204
206
for row in contrast_def :
205
207
if row [0 ] != 'task%03d' % task_id :
206
208
continue
207
- con = [row [1 ], 'T' , ['cond%03d' % i for i in range (len (conds ))],
209
+ con = [row [1 ], 'T' , ['cond%03d' % ( i + 1 ) for i in range (len (conds ))],
208
210
row [2 :].astype (float ).tolist ()]
209
211
contrasts .append (con )
212
+ # add auto contrasts for each column
213
+ for i , cond in enumerate (conds ):
214
+ con = [cond , 'T' , ['cond%03d' % (i + 1 )], [1 ]]
215
+ contrasts .append (con )
210
216
return contrasts
211
217
212
218
contrastgen = pe .Node (niu .Function (input_names = ['contrast_file' ,
0 commit comments