Class KernelImagesForRegion

Class Documentation

class KernelImagesForRegion

A collection of Kernel images for special locations on a rectangular region of an image

See the Location enum for a list of those special locations.

This is a low-level helper class for recursive convolving with interpolation. Many of these objects may be created during a convolution, and many will share kernel images. It uses shared pointers to kernels and kernel images for increased speed and decreased memory usage (at the expense of safety). Note that null pointers are NOT acceptable for the constructors!

Warning

The kernel images along the top and right edges are computed one row or column past the bounding box. This allows abutting KernelImagesForRegion to share corner and edge kernel images, which is useful when dividing a KernelImagesForRegion into subregions.

Warning

The bounding box for the region applies to the parent image.

Also note that it uses lazy evaluation: images are computed when they are wanted.

Public Types

enum Location

locations of various points in the region

RIGHT and TOP are one column/row beyond the region’s bounding box. Thus adjacent regions share corner images.

The posiitions are: BOTTOM_LEFT, BOTTOM_RIGHT, TOP_LEFT, TOP_RIGHT

These locations always refer to the center of a pixel. Thus if the region has an odd size along an axis (so that the span to the top and right, which are one beyond, is even), the middle pixel will be 1/2 pixel off from the true center along that axis (in an unspecified direction).

Values:

BOTTOM_LEFT
BOTTOM_RIGHT
TOP_LEFT
TOP_RIGHT
typedef std::shared_ptr<lsst::afw::math::Kernel const> KernelConstPtr
typedef lsst::afw::image::Image<lsst::afw::math::Kernel::Pixel> Image
typedef std::shared_ptr<Image> ImagePtr
typedef std::shared_ptr<Image const> ImageConstPtr

Public Functions

KernelImagesForRegion(KernelConstPtr kernelPtr, lsst::geom::Box2I const &bbox, lsst::geom::Point2I const &xy0, bool doNormalize)

Construct a KernelImagesForRegion

Parameters
  • kernelPtr: kernel

  • bbox: bounding box of region of an image for which we want to compute kernel images (inclusive and relative to parent image)

  • xy0: xy0 of image for which we want to compute kernel images

  • doNormalize: normalize the kernel images?

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if kernelPtr is null

KernelImagesForRegion(KernelConstPtr kernelPtr, lsst::geom::Box2I const &bbox, lsst::geom::Point2I const &xy0, bool doNormalize, ImagePtr bottomLeftImagePtr, ImagePtr bottomRightImagePtr, ImagePtr topLeftImagePtr, ImagePtr topRightImagePtr)

Construct a KernelImagesForRegion with some or all corner images

Null corner image pointers are ignored.

Warning

: if any images are incorrect you will get a mess.

Parameters
  • kernelPtr: kernel

  • bbox: bounding box of region of an image for which we want to compute kernel images (inclusive and relative to parent image)

  • xy0: xy0 of image

  • doNormalize: normalize the kernel images?

  • bottomLeftImagePtr: kernel image and sum at bottom left of region

  • bottomRightImagePtr: kernel image and sum at bottom right of region

  • topLeftImagePtr: kernel image and sum at top left of region

  • topRightImagePtr: kernel image and sum at top right of region

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if kernelPtr is null

  • lsst::pex::exceptions::InvalidParameterError: if an image has the wrong dimensions

lsst::geom::Box2I getBBox() const

Get the bounding box for the region

lsst::geom::Point2I getXY0() const

Get xy0 of the image

bool getDoNormalize() const

Get the doNormalize parameter

ImagePtr getImage(Location location) const

Return the image and sum at the specified location

If the image has not yet been computed, it is computed at this time.

Parameters
  • location: location of image

KernelConstPtr getKernel() const

Get the kernel (as a shared pointer to const)

lsst::geom::Point2I getPixelIndex(Location location) const

Compute pixel index of a given location, relative to the parent image (thus offset by bottom left corner of bounding box)

Parameters
  • location: location for which to return pixel index

bool computeNextRow(RowOfKernelImagesForRegion &regionRow) const

Compute next row of subregions

For the first row call with a new RowOfKernelImagesForRegion (with the desired number of columns and rows). Every subequent call updates the data in the RowOfKernelImagesForRegion.

Return

true if a new row was computed, false if supplied RowOfKernelImagesForRegion is for the last row.

Parameters

Public Static Functions

static int getMinInterpolationSize()

Get the minInterpolationSize class constant