lsst.afw g1f6fc4ca13+8b5155b42b
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::afw::math::detail::KernelImagesForRegion Class Reference

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

#include <Convolve.h>

Public Types

enum  Location { BOTTOM_LEFT , BOTTOM_RIGHT , TOP_LEFT , TOP_RIGHT }
 locations of various points in the region More...
 
using KernelConstPtr = std::shared_ptr< const lsst::afw::math::Kernel >
 
using Image = lsst::afw::image::Image< lsst::afw::math::Kernel::Pixel >
 
using ImagePtr = std::shared_ptr< Image >
 
using ImageConstPtr = std::shared_ptr< const Image >
 

Public Member Functions

 KernelImagesForRegion (KernelConstPtr kernelPtr, lsst::geom::Box2I const &bbox, lsst::geom::Point2I const &xy0, bool doNormalize)
 Construct a KernelImagesForRegion. More...
 
 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. More...
 
lsst::geom::Box2I getBBox () const
 Get the bounding box for the region. More...
 
lsst::geom::Point2I getXY0 () const
 Get xy0 of the image. More...
 
bool getDoNormalize () const
 Get the doNormalize parameter. More...
 
ImagePtr getImage (Location location) const
 Return the image and sum at the specified location. More...
 
KernelConstPtr getKernel () const
 Get the kernel (as a shared pointer to const) More...
 
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) More...
 
bool computeNextRow (RowOfKernelImagesForRegion &regionRow) const
 Compute next row of subregions. More...
 

Static Public Member Functions

static int getMinInterpolationSize ()
 Get the minInterpolationSize class constant. More...
 

Detailed Description

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.

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.
The bounding box for the region applies to the parent image.

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!

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

Definition at line 172 of file Convolve.h.

Member Typedef Documentation

◆ Image

Definition at line 175 of file Convolve.h.

◆ ImageConstPtr

Definition at line 177 of file Convolve.h.

◆ ImagePtr

Definition at line 176 of file Convolve.h.

◆ KernelConstPtr

Definition at line 174 of file Convolve.h.

Member Enumeration Documentation

◆ 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).

Enumerator
BOTTOM_LEFT 
BOTTOM_RIGHT 
TOP_LEFT 
TOP_RIGHT 

Definition at line 192 of file Convolve.h.

Constructor & Destructor Documentation

◆ KernelImagesForRegion() [1/2]

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

Construct a KernelImagesForRegion.

Parameters
kernelPtrkernel
bboxbounding box of region of an image for which we want to compute kernel images (inclusive and relative to parent image)
xy0xy0 of image for which we want to compute kernel images
doNormalizenormalize the kernel images?
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif kernelPtr is null

Definition at line 45 of file KernelImagesForRegion.cc.

◆ KernelImagesForRegion() [2/2]

lsst::afw::math::detail::KernelImagesForRegion::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.

Parameters
kernelPtrkernel
bboxbounding box of region of an image for which we want to compute kernel images (inclusive and relative to parent image)
xy0xy0 of image
doNormalizenormalize the kernel images?
bottomLeftImagePtrkernel image and sum at bottom left of region
bottomRightImagePtrkernel image and sum at bottom right of region
topLeftImagePtrkernel image and sum at top left of region
topRightImagePtrkernel image and sum at top right of region
Exceptions
lsst::pex::exceptions::InvalidParameterErrorif kernelPtr is null
lsst::pex::exceptions::InvalidParameterErrorif an image has the wrong dimensions
Warning
: if any images are incorrect you will get a mess.

Definition at line 58 of file KernelImagesForRegion.cc.

Member Function Documentation

◆ computeNextRow()

bool lsst::afw::math::detail::KernelImagesForRegion::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.

Parameters
[in,out]regionRowRowOfKernelImagesForRegion object
Returns
true if a new row was computed, false if supplied RowOfKernelImagesForRegion is for the last row.

Definition at line 110 of file KernelImagesForRegion.cc.

◆ getBBox()

lsst::geom::Box2I lsst::afw::math::detail::KernelImagesForRegion::getBBox ( ) const
inline

Get the bounding box for the region.

Definition at line 234 of file Convolve.h.

◆ getDoNormalize()

bool lsst::afw::math::detail::KernelImagesForRegion::getDoNormalize ( ) const
inline

Get the doNormalize parameter.

Definition at line 242 of file Convolve.h.

◆ getImage()

KernelImagesForRegion::ImagePtr lsst::afw::math::detail::KernelImagesForRegion::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
locationlocation of image

Definition at line 77 of file KernelImagesForRegion.cc.

◆ getKernel()

KernelConstPtr lsst::afw::math::detail::KernelImagesForRegion::getKernel ( ) const
inline

Get the kernel (as a shared pointer to const)

Definition at line 254 of file Convolve.h.

◆ getMinInterpolationSize()

static int lsst::afw::math::detail::KernelImagesForRegion::getMinInterpolationSize ( )
inlinestatic

Get the minInterpolationSize class constant.

Definition at line 278 of file Convolve.h.

◆ getPixelIndex()

lsst::geom::Point2I lsst::afw::math::detail::KernelImagesForRegion::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
locationlocation for which to return pixel index

Definition at line 88 of file KernelImagesForRegion.cc.

◆ getXY0()

lsst::geom::Point2I lsst::afw::math::detail::KernelImagesForRegion::getXY0 ( ) const
inline

Get xy0 of the image.

Definition at line 238 of file Convolve.h.


The documentation for this class was generated from the following files: