Class KernelImagesForRegion¶
Defined in File Convolve.h
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
¶
-
Public Functions
-
KernelImagesForRegion
(KernelConstPtr kernelPtr, lsst::geom::Box2I const &bbox, lsst::geom::Point2I const &xy0, bool doNormalize)¶ Construct a KernelImagesForRegion
- Parameters
kernelPtr
: kernelbbox
: 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 imagesdoNormalize
: 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
: kernelbbox
: bounding box of region of an image for which we want to compute kernel images (inclusive and relative to parent image)xy0
: xy0 of imagedoNormalize
: normalize the kernel images?bottomLeftImagePtr
: kernel image and sum at bottom left of regionbottomRightImagePtr
: kernel image and sum at bottom right of regiontopLeftImagePtr
: kernel image and sum at top left of regiontopRightImagePtr
: kernel image and sum at top right of region
- Exceptions
lsst::pex::exceptions::InvalidParameterError
: if kernelPtr is nulllsst::pex::exceptions::InvalidParameterError
: if an image has the wrong dimensions
-
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 ®ionRow) 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
[inout] regionRow
: RowOfKernelImagesForRegion object
Public Static Functions
-
static int
getMinInterpolationSize
()¶ Get the minInterpolationSize class constant