translate_image

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

translate_image(image: sitk.Image, shift_voxels: Sequence[float], interpolator: str = 'bspline', default_value: float = 0.0) → sitk.Image[source]

Translate image content by a (sub-)voxel shift, resampled on the same grid.

Parameters:
  • image – Source image.

  • shift_voxels – Shift in VOXEL units, SimpleITK (x, y, z) axis order; fractions of a voxel are the intended use. The physical offset is direction @ (shift * spacing).

  • interpolator – "bspline" (paper default), "linear" or "nearest" (required for label masks).

  • default_value – Intensity for voxels mapped outside the source.

Returns:

The translated image on image’s grid.

Raises:

ValueError – If shift_voxels does not have exactly 3 components.