@@ -187,6 +187,8 @@ def _parse_inputs(self):
187
187
188
188
def _list_outputs (self ):
189
189
outputs = self ._outputs ().get ()
190
+ resliced_all = self .inputs .write_which [0 ] > 0
191
+ resliced_mean = self .inputs .write_which [1 ] > 0
190
192
if isdefined (self .inputs .in_files ):
191
193
outputs ['realignment_parameters' ] = []
192
194
for imgf in self .inputs .in_files :
@@ -206,16 +208,19 @@ def _list_outputs(self):
206
208
else :
207
209
first_image = self .inputs .in_files [0 ]
208
210
209
- outputs ['mean_image' ] = fname_presuffix (first_image , prefix = 'mean' )
210
- outputs ['realigned_files' ] = []
211
- for imgf in filename_to_list (self .inputs .in_files ):
212
- realigned_run = []
213
- if isinstance (imgf ,list ):
214
- for inner_imgf in filename_to_list (imgf ):
215
- realigned_run .append (fname_presuffix (inner_imgf , prefix = self .inputs .out_prefix ))
216
- else :
217
- realigned_run = fname_presuffix (imgf , prefix = self .inputs .out_prefix )
218
- outputs ['realigned_files' ].append (realigned_run )
211
+ if resliced_mean :
212
+ outputs ['mean_image' ] = fname_presuffix (first_image , prefix = 'mean' )
213
+
214
+ if resliced_all :
215
+ outputs ['realigned_files' ] = []
216
+ for imgf in filename_to_list (self .inputs .in_files ):
217
+ realigned_run = []
218
+ if isinstance (imgf ,list ):
219
+ for inner_imgf in filename_to_list (imgf ):
220
+ realigned_run .append (fname_presuffix (inner_imgf , prefix = self .inputs .out_prefix ))
221
+ else :
222
+ realigned_run = fname_presuffix (imgf , prefix = self .inputs .out_prefix )
223
+ outputs ['realigned_files' ].append (realigned_run )
219
224
return outputs
220
225
221
226
0 commit comments