@@ -245,6 +245,34 @@ class EstimateModelOutputSpec(TraitedSpec):
245
245
ImageFileSPM (exists = True ),
246
246
desc = "Images of the standard deviation of parameter posteriors" ,
247
247
)
248
+ con_images = OutputMultiPath (
249
+ File (exists = True ),
250
+ desc = (
251
+ "contrast images from a t-contrast "
252
+ "(created if factor_info used in Level1Design)"
253
+ ),
254
+ )
255
+ spmT_images = OutputMultiPath (
256
+ File (exists = True ),
257
+ desc = (
258
+ "stat images from a t-contrast"
259
+ "(created if factor_info used in Level1Design)"
260
+ ),
261
+ )
262
+ ess_images = OutputMultiPath (
263
+ File (exists = True ),
264
+ desc = (
265
+ "contrast images from an F-contrast"
266
+ "(created if factor_info used in Level1Design)"
267
+ ),
268
+ )
269
+ spmF_images = OutputMultiPath (
270
+ File (exists = True ),
271
+ desc = (
272
+ "stat images from an F-contrast"
273
+ "(created if factor_info used in Level1Design)"
274
+ ),
275
+ )
248
276
249
277
250
278
class EstimateModel (SPMCommand ):
@@ -310,6 +338,29 @@ def _list_outputs(self):
310
338
outputs ["residual_images" ] = glob (os .path .join (pth , "Res_*" ))
311
339
if betas :
312
340
outputs ["beta_images" ] = [os .path .join (pth , beta ) for beta in betas ]
341
+ # When 'factor_info' is used in Level1Design
342
+ # spm automatically creates contrast
343
+ try :
344
+ contrast = [c .Vcon [0 ][0 ].fname [0 ] for c in spm ["SPM" ][0 , 0 ].xCon [0 ]]
345
+ contrast_spm = [c .Vspm [0 ][0 ].fname [0 ] for c in spm ["SPM" ][0 , 0 ].xCon [0 ]]
346
+ except Exception :
347
+ contrast = []
348
+ contrast_spm = []
349
+
350
+ if contrast :
351
+ outputs ["con_images" ] = [
352
+ os .path .join (pth , cont ) for cont in contrast if 'con' in cont
353
+ ]
354
+ outputs ["ess_images" ] = [
355
+ os .path .join (pth , cont ) for cont in contrast if 'ess' in cont
356
+ ]
357
+ if contrast_spm :
358
+ outputs ["spmT_images" ] = [
359
+ os .path .join (pth , cont ) for cont in contrast_spm if 'spmT' in cont
360
+ ]
361
+ outputs ["spmF_images" ] = [
362
+ os .path .join (pth , cont ) for cont in contrast_spm if 'spmF' in cont
363
+ ]
313
364
314
365
outputs ["mask_image" ] = os .path .join (pth , f"mask.{ outtype } " )
315
366
outputs ["spm_mat_file" ] = os .path .join (pth , "SPM.mat" )
0 commit comments