Skip to content

Commit 774f41d

Browse files
committed
fix: use aggregate_outputs instead of _list_outputs
1 parent 051c1e5 commit 774f41d

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

nipype/interfaces/ants/utils.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ class ImageMath(ANTSCommand):
9898
input_spec = _ImageMathInputSpec
9999
output_spec = _ImageMathOuputSpec
100100

101-
def _list_outputs(self):
102-
outputs = super(ImageMath, self)._list_outputs()
101+
def aggregate_outputs(self, runtime=None, needed_outputs=None):
102+
"""Overload the aggregation with header replacement, if required."""
103+
outputs = super(ImageMath, self).aggregate_outputs(
104+
runtime, needed_outputs)
103105
if self.inputs.copy_header: # Fix headers
104-
_copy_header(self.inputs.op1, outputs["output_image"], keep_dtype=True)
106+
_copy_header(
107+
self.inputs.op1, outputs["output_image"], keep_dtype=True
108+
)
105109
return outputs
106110

107111

@@ -199,8 +203,10 @@ def _format_arg(self, name, trait_spec, value):
199203

200204
return super(ResampleImageBySpacing, self)._format_arg(name, trait_spec, value)
201205

202-
def _list_outputs(self):
203-
outputs = super(ResampleImageBySpacing, self)._list_outputs()
206+
def aggregate_outputs(self, runtime=None, needed_outputs=None):
207+
"""Overload the aggregation with header replacement, if required."""
208+
outputs = super(ResampleImageBySpacing, self).aggregate_outputs(
209+
runtime, needed_outputs)
204210
if self.inputs.copy_header: # Fix headers
205211
_copy_header(
206212
self.inputs.input_image, outputs["output_image"], keep_dtype=True
@@ -293,8 +299,10 @@ class ThresholdImage(ANTSCommand):
293299
input_spec = _ThresholdImageInputSpec
294300
output_spec = _ThresholdImageOutputSpec
295301

296-
def _list_outputs(self):
297-
outputs = super(ThresholdImage, self)._list_outputs()
302+
def aggregate_outputs(self, runtime=None, needed_outputs=None):
303+
"""Overload the aggregation with header replacement, if required."""
304+
outputs = super(ThresholdImage, self).aggregate_outputs(
305+
runtime, needed_outputs)
298306
if self.inputs.copy_header: # Fix headers
299307
_copy_header(
300308
self.inputs.input_image, outputs["output_image"], keep_dtype=True

0 commit comments

Comments
 (0)