25#ifndef LSST_AFW_MATH_DETAIL_CONVOLVE_H
26#define LSST_AFW_MATH_DETAIL_CONVOLVE_H
40#define IS_INSTANCE(A, B) (dynamic_cast<B const*>(&(A)) != NULL)
67template <
typename OutImageT,
typename InImageT>
79template <
typename OutImageT,
typename InImageT>
80void basicConvolve(OutImageT& convolvedImage, InImageT
const& inImage,
105template <
typename OutImageT,
typename InImageT>
106void basicConvolve(OutImageT& convolvedImage, InImageT
const& inImage,
118template <
typename OutImageT,
typename InImageT>
119void basicConvolve(OutImageT& convolvedImage, InImageT
const& inImage,
146template <
typename OutImageT,
typename InImageT>
288 void _computeImage(
Location location)
const;
303 void _moveUp(
bool isFirst,
int newHeight);
306 static inline int _computeNextSubregionLength(
int length,
int nDivisions);
326 static int const _MinInterpolationSize;
350 RegionList::const_iterator
begin()
const {
return _regionList.
begin(); };
354 RegionList::const_iterator
end()
const {
return _regionList.
end(); };
358 RegionList::iterator
begin() {
return _regionList.
begin(); };
362 RegionList::iterator
end() {
return _regionList.
end(); };
380 bool hasData()
const {
return static_cast<bool>(_regionList[0]); };
410template <
typename OutImageT,
typename InImageT>
448template <
typename OutImageT,
typename InImageT>
464inline int KernelImagesForRegion::_computeNextSubregionLength(
468 return static_cast<int>(
469 std::floor(0.5 + (
static_cast<double>(
length) /
static_cast<double>(nDivisions))));
478inline void KernelImagesForRegion::_insertImage(Location location,
482 if (_kernelPtr->
getDimensions() != imagePtr->getDimensions()) {
484 os <<
"image dimensions = ( " << imagePtr->getWidth() <<
", " << imagePtr->getHeight() <<
") != ("
485 << _kernelPtr->
getWidth() <<
", " << _kernelPtr->
getHeight() <<
") = kernel dimensions";
488 _imagePtrList[location] = imagePtr;
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
afw::table::PointKey< int > dimensions
Parameters to control convolution.
A kernel that has only one non-zero pixel (of value 1)
Kernels are used for convolution with MaskedImages and (eventually) Images.
lsst::geom::Extent2I const getDimensions() const
Return the Kernel's dimensions (width, height)
int getHeight() const
Return the Kernel's height.
int getWidth() const
Return the Kernel's width.
A kernel that is a linear combination of fixed basis kernels.
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
A collection of Kernel images for special locations on a rectangular region of an image.
KernelConstPtr getKernel() const
Get the kernel (as a shared pointer to const)
Location
locations of various points in the region
KernelImagesForRegion(KernelConstPtr kernelPtr, lsst::geom::Box2I const &bbox, lsst::geom::Point2I const &xy0, bool doNormalize)
Construct a KernelImagesForRegion.
bool computeNextRow(RowOfKernelImagesForRegion ®ionRow) const
Compute next row of subregions.
lsst::geom::Point2I getPixelIndex(Location location) const
Compute pixel index of a given location, relative to the parent image (thus offset by bottom left cor...
ImagePtr getImage(Location location) const
Return the image and sum at the specified location.
bool getDoNormalize() const
Get the doNormalize parameter.
std::shared_ptr< Image > ImagePtr
lsst::geom::Box2I getBBox() const
Get the bounding box for the region.
lsst::geom::Point2I getXY0() const
Get xy0 of the image.
std::shared_ptr< const lsst::afw::math::Kernel > KernelConstPtr
static int getMinInterpolationSize()
Get the minInterpolationSize class constant.
A row of KernelImagesForRegion.
RegionList::iterator end()
Return the end iterator for the list.
std::vector< std::shared_ptr< KernelImagesForRegion > > RegionList
RowOfKernelImagesForRegion(int nx, int ny)
Construct a RowOfKernelImagesForRegion.
std::shared_ptr< KernelImagesForRegion > back()
Return the last region in the list.
RegionList::const_iterator begin() const
Return the begin iterator for the list.
RegionList::const_iterator ConstIterator
RegionList::iterator Iterator
std::shared_ptr< KernelImagesForRegion > front()
Return the first region in the list.
RegionList::iterator begin()
Return the begin iterator for the list.
RegionList::const_iterator end() const
Return the end iterator for the list.
std::shared_ptr< KernelImagesForRegion const > getRegion(int ind) const
get the specified region (range-checked)
An integer coordinate rectangle.
Reports invalid arguments.
void convolveRegionWithInterpolation(OutImageT &outImage, InImageT const &inImage, KernelImagesForRegion const ®ion, ConvolveWithInterpolationWorkingImages &workingImages)
Convolve a region of an Image or MaskedImage with a spatially varying Kernel using interpolation.
void convolveWithInterpolation(OutImageT &outImage, InImageT const &inImage, lsst::afw::math::Kernel const &kernel, ConvolutionControl const &convolutionControl)
Convolve an Image or MaskedImage with a spatially varying Kernel using linear interpolation.
void basicConvolve(OutImageT &convolvedImage, InImageT const &inImage, lsst::afw::math::Kernel const &kernel, lsst::afw::math::ConvolutionControl const &convolutionControl)
Low-level convolution function that does not set edge pixels.
void convolveWithBruteForce(OutImageT &convolvedImage, InImageT const &inImage, lsst::afw::math::Kernel const &kernel, lsst::afw::math::ConvolutionControl const &convolutionControl)
Convolve an Image or MaskedImage with a Kernel by computing the kernel image at every point.
A base class for image defects.
kernel images used by convolveRegionWithInterpolation
ConvolveWithInterpolationWorkingImages(lsst::geom::Extent2I const &dimensions)