deepali.utils.simpleitk.sample#

Functions to resample image data.

Module Contents#

Functions#

resample_image(→ SimpleITK.Image)

Interpolate image values at grid points of reference image.

warp_image(→ SimpleITK.Image)

Interpolate image values at displaced output grid points.

interpolate_ndimage(→ numpy.ndarray)

Use scipy.ndimage.map_coordinates to interpolate image.

interpolate_regular_grid(→ numpy.ndarray)

Use scipy.interpolate.RegularGridInterpolator to interpolate image data.

interpolate_griddata(→ numpy.ndarray)

Interpolate image similar to scipy.interpolate.griddata.

resample_image(image: SimpleITK.Image, reference: Union[deepali.utils.simpleitk.grid.GridAttrs, SimpleITK.Image], interpolator: int = sitk.sitkLinear, padding_value: float = 0) SimpleITK.Image[source]#

Interpolate image values at grid points of reference image.

Parameters
  • image – Scalar or vector-valued image to evaluate at the specified points.

  • reference – Sampling grid on which to evaluate interpolated image. If a path is specified,

  • interpolator – Enumeration value of SimpleITK interpolator to use.

  • padding_value – Output value when sampling point is outside the input image domain.

Returns

Image interpolated at reference grid points.

Return type

output

warp_image(image: SimpleITK.Image, displacement: SimpleITK.Image, reference: Optional[SimpleITK.Image] = None, interpolator: int = sitk.sitkLinear, padding_value: float = 0) SimpleITK.Image[source]#

Interpolate image values at displaced output grid points.

Parameters
  • image – Scalar or vector-valued image to evaluate at the specified points.

  • displacement – Sampling grid on which to evaluate interpolated continuous image.

  • interpolator – Enumeration value of SimpleITK interpolator to use.

  • padding_value – Output value when sampling point is outside the input image domain.

Returns

Image interpolated at displacement field grid points at the input image

positions obtained by adding the given displacement to these grid coordinates.

Return type

output

interpolate_ndimage(image: SimpleITK.Image, points: numpy.ndarray, padding_value: float = 0, order: int = 1) numpy.ndarray[source]#

Use scipy.ndimage.map_coordinates to interpolate image.

interpolate_regular_grid(image: SimpleITK.Image, points: numpy.ndarray, padding_value: float = 0) numpy.ndarray[source]#

Use scipy.interpolate.RegularGridInterpolator to interpolate image data.

interpolate_griddata(image: SimpleITK.Image, points: numpy.ndarray) numpy.ndarray[source]#

Interpolate image similar to scipy.interpolate.griddata.

This method should only be used for comparison. The used Delaunay triangulation is not suited for interpolating image data sampled on a regular grid.

Use warp_image (for regularly spaced points) or interpolate_image.