Interpolation

namespace yagit
namespace Interpolation

Functions

ImageData linearAlongAxis(const ImageData &img, float spacing, ImageAxis axis)

Linear interpolation along axis with new spacing.

Parameters:
  • img – Image to interpolate. It can be 1D, 2D, or 3D image - interpolation is done along one axis and won’t take into account other axes.

  • spacing – New spacing by which interpolation is performed

  • axis – Axis along which interpolation is performed

Returns:

Interpolated image with new spacing

ImageData linearAlongAxis(const ImageData &img, float gridOffset, float spacing, ImageAxis axis)

Linear interpolation along axis on new grid with offset and spacing.

On an infinite grid spanning all directions, utilizing new offset and spacing, we determine the values that are on this grid that fall within the interpolated image.

Parameters:
  • img – Image to interpolate. It can be 1D, 2D, or 3D image - interpolation is done along one axis and won’t take into account other axes.

  • gridOffset – Offset of interpolation grid. New grid on which image is interpolated will be offsetted by this value

  • spacing – New spacing by which interpolation is performed

  • axis – Axis along which interpolation is performed

Returns:

Image interpolated on new grid

ImageData linearAlongAxis(const ImageData &targetImg, const ImageData &refImg, ImageAxis axis)

Linear interpolation along axis on the grid of refImg.

On an infinite grid spanning all directions, utilizing offset and spacing of refImg, we determine the values that are on this grid that fall within the interpolated image.

Parameters:
  • targetImg – Image to interpolate

  • refImg – Image from which offset and spacing is retrieved and used to create grid on which interpolation is performed

  • axis – Axis along which interpolation is performed

Returns:

Image interpolated on the grid of refImg

ImageData bilinearOnPlane(const ImageData &img, float firstAxisSpacing, float secondAxisSpacing, ImagePlane plane)

Bilinear interpolation on plane with new spacing.

Parameters:
  • img – Image to interpolate. It can be 1D, 2D, or 3D image - interpolation is done on one plane and won’t take into account other planes.

  • firstAxisSpacing – First spacing by which interpolation is performed. E.g., when interpolating on plane YX, firstAxisSpacing is applied to Y axis.

  • secondAxisSpacing – Second spacing by which interpolation is performed. E.g., when interpolating on plane YX, secondAxisSpacing is applied to X axis.

  • plane – Plane on which interpolation is performed

Returns:

Interpolated image with new spacing

ImageData bilinearOnPlane(const ImageData &img, float firstAxisGridOffset, float secondAxisGridOffset, float firstAxisSpacing, float secondAxisSpacing, ImagePlane plane)

Bilinear interpolation on plane on new grid with offset and spacing.

On an infinite grid spanning all directions, utilizing new offsets and spacings, we determine the values that are on this grid that fall within the interpolated image.

Parameters:
  • img – Image to interpolate. It can be 1D, 2D, or 3D image - interpolation is done on one plane and won’t take into account other planes.

  • firstAxisGridOffset – First offset of interpolation grid. E.g., when interpolating on plane YX, firstAxisOffset is applied to Y axis. New grid on which image is interpolated will be offsetted by this value.

  • secondAxisGridOffset – Second offset of interpolation grid. E.g., when interpolating on plane YX, secondAxisOffset is applied to X axis. New grid on which image is interpolated will be offsetted by this value.

  • firstAxisSpacing – First spacing by which interpolation is performed. E.g., when interpolating on plane YX, firstAxisSpacing is applied to Y axis.

  • secondAxisSpacing – Second spacing by which interpolation is performed. E.g., when interpolating on plane YX, secondAxisSpacing is applied to X axis.

  • plane – Plane on which interpolation is performed

Returns:

Image interpolated on new grid

ImageData bilinearOnPlane(const ImageData &targetImg, const ImageData &refImg, ImagePlane plane)

Bilinear interpolation on plane on the grid of refImg.

On an infinite grid spanning all directions, utilizing offset and spacing of refImg, we determine the values that are on this grid that fall within the interpolated image.

Parameters:
  • targetImg – Image to interpolate

  • refImg – Image from which offset and spacing is retrieved and used to create grid on which interpolation is performed

  • plane – Plane on which interpolation is performed

Returns:

Image interpolated on the grid of refImg

ImageData trilinear(const ImageData &img, const DataSpacing &spacing)

Trilinear interpolation - along all axes (Z, Y, X) - with new spacing.

Parameters:
  • img – Image to interpolate

  • spacing – New spacing by which interpolation is performed

Returns:

Interpolated image with new spacing

ImageData trilinear(const ImageData &img, const DataOffset &gridOffset, const DataSpacing &spacing)

Trilinear interpolation - along all axes (Z, Y, X) - on new grid with offset and spacing.

On an infinite grid spanning all directions, utilizing new offset and spacing, we determine the values that are on this grid that fall within the interpolated image.

Parameters:
  • img – Image to interpolate

  • gridOffset – Offset of interpolation grid. New grid on which image is interpolated will be offsetted by this value

  • spacing – New spacing by which interpolation is performed

Returns:

Image interpolated on new grid

ImageData trilinear(const ImageData &targetImg, const ImageData &refImg)

Trilinear interpolation - along all axes (Z, Y, X) - on the grid of refImg.

On an infinite grid spanning all directions, utilizing offset and spacing of refImg, we determine the values that are on this grid that fall within the interpolated image.

Parameters:
  • targetImg – Image to interpolate

  • refImg – Image from which offset and spacing is retrieved and used to create grid on which interpolation is performed

Returns:

Image interpolated on the grid of refImg

std::optional<float> bilinearAtPoint(const ImageData &img, uint32_t frame, float y, float x)

Bilinear interpolation at point inside image.

Parameters:
  • img – Image on which interpolation is performed

  • frame – Axial frame where interpolation is performed

  • y – Y coordinate of the point where interpolation is performed

  • x – X coordinate of the point where interpolation is performed

Returns:

If the point is inside the image, then an interpolated value is returned

std::optional<float> trilinearAtPoint(const ImageData &img, float z, float y, float x)

Trilinear interpolation at point inside image.

Parameters:
  • img – Image on which interpolation is performed

  • z – Z coordinate of the point where interpolation is performed

  • y – Y coordinate of the point where interpolation is performed

  • x – X coordinate of the point where interpolation is performed

Returns:

If the point is inside the image, then an interpolated value is returned