25 #ifndef LSST_AFW_MATH_DETAIL_CONVOLVE_H
26 #define LSST_AFW_MATH_DETAIL_CONVOLVE_H
46 #define IS_INSTANCE(A, B) (dynamic_cast<B const*>(&(A)) != NULL)
53 template <
typename OutImageT,
typename InImageT>
55 OutImageT& convolvedImage,
56 InImageT
const& inImage,
60 template <
typename OutImageT,
typename InImageT>
62 OutImageT& convolvedImage,
63 InImageT
const& inImage,
67 template <
typename OutImageT,
typename InImageT>
69 OutImageT& convolvedImage,
70 InImageT
const& inImage,
74 template <
typename OutImageT,
typename InImageT>
76 OutImageT& convolvedImage,
77 InImageT
const& inImage,
81 template <
typename OutImageT,
typename InImageT>
83 OutImageT &convolvedImage,
84 InImageT
const& inImage,
89 class RowOfKernelImagesForRegion;
182 void _moveUp(
bool isFirst,
int newHeight);
254 template <
typename OutImageT,
typename InImageT>
257 InImageT
const &inImage,
283 template <
typename OutImageT,
typename InImageT>
286 InImageT
const &inImage,
307 (static_cast<double>(length) / static_cast<double>(nDivisions))));
321 if (_kernelPtr->getDimensions() != imagePtr->getDimensions()) {
322 std::ostringstream os;
323 os <<
"image dimensions = ( "
324 << imagePtr->getWidth() <<
", " << imagePtr->getHeight()
325 <<
") != (" << _kernelPtr->getWidth() <<
", " << _kernelPtr->getHeight()
326 <<
") = kernel dimensions";
327 throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError, os.str());
329 _imagePtrList[location] = imagePtr;
333 #endif // !defined(LSST_AFW_MATH_DETAIL_CONVOLVE_H)
lsst::afw::geom::Point2I getPixelIndex(Location location) const
Compute pixel index of a given location, relative to the parent image (thus offset by bottom left cor...
An include file to include the header files for lsst::afw::geom.
Declare the Kernel class and subclasses.
void _insertImage(Location location, ImagePtr imagePtr) const
Insert an image in the cache.
RowOfKernelImagesForRegion(int nx, int ny)
Construct a RowOfKernelImagesForRegion.
bool computeNextRow(RowOfKernelImagesForRegion ®ionRow) const
Compute next row of subregions.
boost::shared_ptr< lsst::afw::math::Kernel const > KernelConstPtr
void _computeImage(Location location) const
Compute image at a particular location.
RegionList::const_iterator ConstIterator
bool getDoNormalize() const
Get the doNormalize parameter.
boost::shared_ptr< KernelImagesForRegion > front()
Return the first region in the list.
RegionList::const_iterator begin() const
Return the begin iterator for the list.
Include files required for standard LSST Exception handling.
static int getMinInterpolationSize()
Get the minInterpolationSize class constant.
KernelConstPtr _kernelPtr
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...
Parameters to control convolution.
std::shared_ptr< Persistable > Ptr
boost::shared_ptr< KernelImagesForRegion const > getRegion(int ind) const
get the specified region (range-checked)
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Location
locations of various points in the region
static std::vector< int > _computeSubregionLengths(int length, int nDivisions)
Compute length of each subregion for a region divided into nDivisions pieces of approximately equal l...
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...
boost::shared_ptr< Image const > ImageConstPtr
std::vector< ImagePtr > _imagePtrList
An integer coordinate rectangle.
kernel images used by convolveRegionWithInterpolation
table::Key< table::Array< Kernel::Pixel > > image
std::vector< boost::shared_ptr< KernelImagesForRegion > > RegionList
RegionList::const_iterator end() const
Return the end iterator for the list.
lsst::afw::image::Image< lsst::afw::math::Kernel::Pixel > Image
afw::table::PointKey< int > dimensions
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.
KernelConstPtr getKernel() const
Get the kernel (as a shared pointer to const)
A kernel that is a linear combination of fixed basis kernels.
std::vector< Location > LocationList
static int const _MinInterpolationSize
RegionList::iterator end()
Return the end iterator for the list.
RegionList::iterator begin()
Return the begin iterator for the list.
lsst::afw::geom::Box2I _bbox
lsst::afw::geom::Box2I getBBox() const
Get the bounding box for the region.
A row of KernelImagesForRegion.
void _moveUp(bool isFirst, int newHeight)
Move the region up one segment.
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.
KernelImagesForRegion(KernelConstPtr kernelPtr, lsst::afw::geom::Box2I const &bbox, lsst::afw::geom::Point2I const &xy0, bool doNormalize)
Construct a KernelImagesForRegion.
Convolve and convolveAtAPoint functions for Image and Kernel.
boost::shared_ptr< Image > ImagePtr
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
ImagePtr getImage(Location location) const
Return the image and sum at the specified location.
boost::shared_ptr< KernelImagesForRegion const > ConstPtr
Extent< int, N > floor(Extent< double, N > const &input)
Return the component-wise floor (round towards more negative).
static int _computeNextSubregionLength(int length, int nDivisions)
Compute length of next subregion if the region is to be divided into pieces of approximately equal le...
boost::shared_ptr< KernelImagesForRegion > back()
Return the last region in the list.
ConvolveWithInterpolationWorkingImages(geom::Extent2I const &dimensions)
lsst::afw::geom::Point2I getXY0() const
Get xy0 of the image.
Base class for all persistable classes.
Implementation of the Class MaskedImage.
lsst::afw::geom::Point2I _xy0
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
#define CONST_PTR(...)
A shared pointer to a const object.
Kernels are used for convolution with MaskedImages and (eventually) Images.
A collection of Kernel images for special locations on a rectangular region of an image...
A kernel that has only one non-zero pixel (of value 1)
RegionList::iterator Iterator