@@ -47,6 +47,13 @@ class Level1DesignInputSpec(BaseInterfaceInputSpec):
47
47
mandatory = True ,
48
48
desc = ("name of basis function and options e.g., "
49
49
"{'dgamma': {'derivs': True}}" ))
50
+ orthogonalization = traits .Dict (traits .Int , traits .Dict (traits .Int ,
51
+ traits .Either (traits .Bool ,traits .Int )),
52
+ mandatory = False ,
53
+ desc = ("which regressors to make orthogonal e.g., "
54
+ "{1: {0:0,1:0,2:0}, 2: {0:1,1:1,2:0}} to make the second "
55
+ "regressor in a 2-regressor model orthogonal to the first." ),
56
+ default = {})
50
57
model_serial_correlations = traits .Bool (
51
58
desc = "Option to model serial correlations using an \
52
59
autoregressive estimator (order 1). Setting this option is only \
@@ -123,8 +130,8 @@ def _create_ev_file(self, evfname, evinfo):
123
130
f .close ()
124
131
125
132
def _create_ev_files (
126
- self , cwd , runinfo , runidx , ev_parameters , contrasts ,
127
- do_tempfilter , basis_key ):
133
+ self , cwd , runinfo , runidx , ev_parameters , orthogonalization ,
134
+ contrasts , do_tempfilter , basis_key ):
128
135
"""Creates EV files from condition and regressor information.
129
136
130
137
Parameters:
@@ -138,6 +145,8 @@ def _create_ev_files(
138
145
ev_parameters : dict
139
146
A dictionary containing the model parameters for the
140
147
given design type.
148
+ orthogonalization : dict
149
+ A dictionary of dictionaries specifying orthogonal EVs.
141
150
contrasts : list of lists
142
151
Information on contrasts to be evaluated
143
152
"""
@@ -208,7 +217,11 @@ def _create_ev_files(
208
217
# add ev orthogonalization
209
218
for i in range (1 , num_evs [0 ] + 1 ):
210
219
for j in range (0 , num_evs [0 ] + 1 ):
211
- ev_txt += ev_ortho .substitute (c0 = i , c1 = j )
220
+ try :
221
+ orthogonal = int (orthogonalization [i ][j ])
222
+ except (KeyError , TypeError , ValueError , IndexError ):
223
+ orthogonal = 0
224
+ ev_txt += ev_ortho .substitute (c0 = i , c1 = j , orthogonal = orthogonal )
212
225
ev_txt += "\n "
213
226
# add contrast info to fsf file
214
227
if isdefined (contrasts ):
@@ -321,6 +334,7 @@ def _run_interface(self, runtime):
321
334
if info ['hpf' ] == np .inf :
322
335
do_tempfilter = 0
323
336
num_evs , cond_txt = self ._create_ev_files (cwd , info , i , ev_parameters ,
337
+ self .inputs .orthogonalization ,
324
338
self .inputs .contrasts ,
325
339
do_tempfilter , basis_key )
326
340
nim = load (func_files [i ])
0 commit comments