Skip to content

Commit

Permalink
fix: copy header for ResampleImageBySpacing
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Feb 28, 2020
1 parent dfe8501 commit df89399
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nipype/interfaces/ants/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ class _ResampleImageBySpacingInputSpec(ANTSCommandInputSpec):
nn_interp = traits.Bool(
argstr="%d", desc="nn interpolation", position=-1, requires=["addvox"]
)
copy_header = traits.Bool(
True,
mandatory=True,
usedefault=True,
desc="copy headers of the original image into the output (corrected) file",
)


class _ResampleImageBySpacingOutputSpec(TraitedSpec):
Expand Down Expand Up @@ -193,6 +199,14 @@ def _format_arg(self, name, trait_spec, value):

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

def _list_outputs(self):
outputs = super(ResampleImageBySpacing, self)._list_outputs()
if self.inputs.copy_header: # Fix headers
_copy_header(
self.inputs.input_image, outputs["output_image"], keep_dtype=True
)
return outputs


class _ThresholdImageInputSpec(ANTSCommandInputSpec):
dimension = traits.Int(
Expand Down

0 comments on commit df89399

Please sign in to comment.