@@ -55,8 +55,9 @@ class SliceTimingInputSpec(SPMCommandInputSpec):
55
55
56
56
57
57
class SliceTimingOutputSpec (TraitedSpec ):
58
- timecorrected_files = OutputMultiPath (File (exist = True ,
59
- desc = 'slice time corrected files' ))
58
+ timecorrected_files = OutputMultiPath (traits .Either (traits .List (File (exists = True )),
59
+ File (exists = True )),
60
+ desc = 'slice time corrected files' )
60
61
61
62
62
63
class SliceTiming (SPMCommand ):
@@ -100,15 +101,11 @@ def _list_outputs(self):
100
101
101
102
filelist = filename_to_list (self .inputs .in_files )
102
103
for f in filelist :
103
- run = []
104
104
if isinstance (f , list ):
105
- for inner_f in filename_to_list (f ):
106
- run .append (fname_presuffix (inner_f ,
107
- prefix = self .inputs .out_prefix ))
105
+ run = [fname_presuffix (in_f , prefix = self .inputs .out_prefix ) for in_f in f ]
108
106
else :
109
- realigned_run = fname_presuffix (f ,
110
- prefix = self .inputs .out_prefix )
111
- outputs ['timecorrected_files' ].append (realigned_run )
107
+ run = fname_presuffix (f , prefix = self .inputs .out_prefix )
108
+ outputs ['timecorrected_files' ].append (run )
112
109
return outputs
113
110
114
111
@@ -152,9 +149,18 @@ class RealignInputSpec(SPMCommandInputSpec):
152
149
153
150
class RealignOutputSpec (TraitedSpec ):
154
151
mean_image = File (exists = True , desc = 'Mean image file from the realignment' )
152
+ modified_in_files = OutputMultiPath (traits .Either (traits .List (File (exists = True )),
153
+ File (exists = True )),
154
+ desc = 'Copies of all files passed to in_files.\
155
+ Headers will have been modified to align all\
156
+ images with the first, or optionally to first\
157
+ do that, extract a mean image, and re-align to\
158
+ that mean image.' )
155
159
realigned_files = OutputMultiPath (traits .Either (traits .List (File (exists = True )),
156
160
File (exists = True )),
157
- desc = 'Realigned files' )
161
+ desc = 'If jobtype is write or estwrite, these will be the\
162
+ resliced files. Otherwise, they will be copies of\
163
+ in_files that have had their headers rewritten.' )
158
164
realignment_parameters = OutputMultiPath (File (exists = True ),
159
165
desc = 'Estimated translation and rotation parameters' )
160
166
@@ -213,6 +219,10 @@ def _list_outputs(self):
213
219
use_ext = False ))
214
220
if not isinstance (imgf , list ) and func_is_3d (imgf ):
215
221
break
222
+ if self .inputs .jobtype == "estimate" :
223
+ outputs ['realigned_files' ] = self .inputs .in_files
224
+ if self .inputs .jobtype == "estimate" or self .inputs .jobtype == "estwrite" :
225
+ outputs ['modified_in_files' ] = self .inputs .in_files
216
226
if self .inputs .jobtype == "write" or self .inputs .jobtype == "estwrite" :
217
227
if isinstance (self .inputs .in_files [0 ], list ):
218
228
first_image = self .inputs .in_files [0 ][0 ]
@@ -367,8 +377,11 @@ class NormalizeInputSpec(SPMCommandInputSpec):
367
377
jobtype = traits .Enum ('estwrite' , 'est' , 'write' ,
368
378
desc = 'one of: est, write, estwrite (opt, estwrite)' ,
369
379
usedefault = True )
370
- apply_to_files = InputMultiPath (File (exists = True ), field = 'subj.resample' ,
371
- desc = 'files to apply transformation to (opt)' , copyfile = True )
380
+ apply_to_files = InputMultiPath (traits .Either (File (exists = True ),
381
+ traits .List (File (exists = True ))),
382
+ field = 'subj.resample' ,
383
+ desc = 'files to apply transformation to (opt)' ,
384
+ copyfile = True )
372
385
parameter_file = File (field = 'subj.matname' , mandatory = True ,
373
386
xor = ['source' , 'template' ],
374
387
desc = 'normalization parameter file*_sn.mat' , copyfile = False )
@@ -481,9 +494,13 @@ def _list_outputs(self):
481
494
elif 'write' in self .inputs .jobtype :
482
495
outputs ['normalized_files' ] = []
483
496
if isdefined (self .inputs .apply_to_files ):
484
- for imgf in filename_to_list (self .inputs .apply_to_files ):
485
- outputs ['normalized_files' ].append (fname_presuffix (imgf , prefix = self .inputs .out_prefix ))
486
-
497
+ filelist = filename_to_list (self .inputs .apply_to_files )
498
+ for f in filelist :
499
+ if isinstance (f , list ):
500
+ run = [fname_presuffix (in_f , prefix = self .inputs .out_prefix ) for in_f in f ]
501
+ else :
502
+ run = [fname_presuffix (f , prefix = self .inputs .out_prefix )]
503
+ outputs ['normalized_files' ].extend (run )
487
504
if isdefined (self .inputs .source ):
488
505
outputs ['normalized_source' ] = []
489
506
for imgf in filename_to_list (self .inputs .source ):
0 commit comments