@@ -250,6 +250,34 @@ class EstimateModelOutputSpec(TraitedSpec):
250
250
ImageFileSPM (exists = True ),
251
251
desc = "Images of the standard deviation of parameter posteriors" ,
252
252
)
253
+ con_images = OutputMultiPath (
254
+ File (exists = True ),
255
+ desc = (
256
+ "contrast images from a t-contrast "
257
+ "(created if factor_info used in Level1Design)"
258
+ ),
259
+ )
260
+ spmT_images = OutputMultiPath (
261
+ File (exists = True ),
262
+ desc = (
263
+ "stat images from a t-contrast"
264
+ "(created if factor_info used in Level1Design)"
265
+ ),
266
+ )
267
+ ess_images = OutputMultiPath (
268
+ File (exists = True ),
269
+ desc = (
270
+ "contrast images from an F-contrast"
271
+ "(created if factor_info used in Level1Design)"
272
+ ),
273
+ )
274
+ spmF_images = OutputMultiPath (
275
+ File (exists = True ),
276
+ desc = (
277
+ "stat images from an F-contrast"
278
+ "(created if factor_info used in Level1Design)"
279
+ ),
280
+ )
253
281
254
282
255
283
class EstimateModel (SPMCommand ):
@@ -319,6 +347,29 @@ def _list_outputs(self):
319
347
outputs ["residual_images" ] = glob (os .path .join (pth , "Res_*" ))
320
348
if betas :
321
349
outputs ["beta_images" ] = [os .path .join (pth , beta ) for beta in betas ]
350
+ # When 'factor_info' is used in Level1Design
351
+ # spm automatically creates contrast
352
+ try :
353
+ contrast = [c .Vcon [0 ][0 ].fname [0 ] for c in spm ["SPM" ][0 , 0 ].xCon [0 ]]
354
+ contrast_spm = [c .Vspm [0 ][0 ].fname [0 ] for c in spm ["SPM" ][0 , 0 ].xCon [0 ]]
355
+ except Exception :
356
+ contrast = []
357
+ contrast_spm = []
358
+
359
+ if contrast :
360
+ outputs ["con_images" ] = [
361
+ (os .path .join (pth , cont ) for cont in contrast if 'con' in cont )
362
+ ]
363
+ outputs ["ess_images" ] = [
364
+ (os .path .join (pth , cont ) for cont in contrast if 'ess' in cont )
365
+ ]
366
+ if contrast_spm :
367
+ outputs ["spmT_images" ] = [
368
+ (os .path .join (pth , cont ) for cont in contrast_spm if 'spmT' in cont )
369
+ ]
370
+ outputs ["spmF_images" ] = [
371
+ (os .path .join (pth , cont ) for cont in contrast_spm if 'spmF' in cont )
372
+ ]
322
373
323
374
outputs ["mask_image" ] = os .path .join (pth , "mask.{}" .format (outtype ))
324
375
outputs ["spm_mat_file" ] = os .path .join (pth , "SPM.mat" )
0 commit comments