rotate_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.

rotate_image(image: sitk.Image, angle_degrees: float, axis: str = 'z', interpolator: str = 'bspline', default_value: float = 0.0) → sitk.Image[source]

Rotate image content about the image centre, resampled on the same grid.

Parameters:
  • image – Source image.

  • angle_degrees – Rotation angle in degrees; the paper uses 0.5. The positive sense is counterclockwise looking down the positive axis towards the origin (right-hand rule about axis).

  • axis – Axis to rotate around: "x", "y" or "z" ("z" is the axial in-plane axis, the paper’s choice).

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

  • default_value – Intensity for voxels mapped outside the source.

Returns:

The rotated image on image’s grid.

Raises:

ValueError – For an unknown axis.