@@ -47,6 +47,13 @@ class Level1DesignInputSpec(BaseInterfaceInputSpec):
4747 mandatory = True ,
4848 desc = ("name of basis function and options e.g., "
4949 "{'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 = {})
5057 model_serial_correlations = traits .Bool (
5158 desc = "Option to model serial correlations using an \
5259 autoregressive estimator (order 1). Setting this option is only \
@@ -123,8 +130,8 @@ def _create_ev_file(self, evfname, evinfo):
123130 f .close ()
124131
125132 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 ):
128135 """Creates EV files from condition and regressor information.
129136
130137 Parameters:
@@ -138,6 +145,8 @@ def _create_ev_files(
138145 ev_parameters : dict
139146 A dictionary containing the model parameters for the
140147 given design type.
148+ orthogonalization : dict
149+ A dictionary of dictionaries specifying orthogonal EVs.
141150 contrasts : list of lists
142151 Information on contrasts to be evaluated
143152 """
@@ -208,7 +217,11 @@ def _create_ev_files(
208217 # add ev orthogonalization
209218 for i in range (1 , num_evs [0 ] + 1 ):
210219 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 )
212225 ev_txt += "\n "
213226 # add contrast info to fsf file
214227 if isdefined (contrasts ):
@@ -321,6 +334,7 @@ def _run_interface(self, runtime):
321334 if info ['hpf' ] == np .inf :
322335 do_tempfilter = 0
323336 num_evs , cond_txt = self ._create_ev_files (cwd , info , i , ev_parameters ,
337+ self .inputs .orthogonalization ,
324338 self .inputs .contrasts ,
325339 do_tempfilter , basis_key )
326340 nim = load (func_files [i ])
0 commit comments