49 template <
typename OutImageT,
typename InImageT>
52 if (outImage.getDimensions() != inImage.getDimensions()) {
54 os <<
"outImage dimensions = ( " << outImage.getWidth() <<
", " << outImage.getHeight() <<
") != (" 55 << inImage.getWidth() <<
", " << inImage.getHeight() <<
") = inImage dimensions";
65 LOGL_DEBUG(
"TRACE5.afw.math.convolve.convolveWithInterpolation",
66 "convolveWithInterpolation: full bbox minimum=(%d, %d), extent=(%d, %d)", fullBBox.getMinX(),
67 fullBBox.getMinY(), fullBBox.getWidth(), fullBBox.getHeight());
68 LOGL_DEBUG(
"TRACE5.afw.math.convolve.convolveWithInterpolation",
69 "convolveWithInterpolation: goodRegion bbox minimum=(%d, %d), extent=(%d, %d)",
76 LOGL_DEBUG(
"TRACE3.afw.math.convolve.convolveWithInterpolation",
77 "convolveWithInterpolation: divide into %d x %d subregions", nx, ny);
83 rgnIter != rgnEnd; ++rgnIter) {
84 LOGL_DEBUG(
"TRACE5.afw.math.convolve.convolveWithInterpolation",
85 "convolveWithInterpolation: bbox minimum=(%d, %d), extent=(%d, %d)",
86 (*rgnIter)->getBBox().getMinX(), (*rgnIter)->getBBox().getMinY(),
87 (*rgnIter)->getBBox().getWidth(), (*rgnIter)->getBBox().getHeight());
93 template <
typename OutImageT,
typename InImageT>
97 typedef typename OutImageT::xy_locator OutLocator;
98 typedef typename InImageT::const_xy_locator InConstLocator;
100 typedef KernelImage::const_xy_locator KernelConstLocator;
113 double xfrac = 1.0 /
static_cast<double>(goodBBox.
getWidth());
114 double yfrac = 1.0 /
static_cast<double>(goodBBox.
getHeight());
120 KernelConstLocator
const kernelLocator = workingImages.
kernelImage.
xy_at(0, 0);
126 InConstLocator inLocator = inImage.xy_at(fullBBox.
getMinX(), fullBBox.
getMinY());
127 OutLocator outLocator = outImage.xy_at(goodBBox.
getMinX(), goodBBox.
getMinY());
129 auto inLocatorInitialPosition = inLocator;
130 auto outLocatorInitialPosition = outLocator;
134 *outLocator = math::convolveAtAPoint<OutImageT, InImageT>(
135 inLocator, kernelLocator, kernelDimensions.getX(), kernelDimensions.getY());
157 inLocator = inLocatorInitialPosition;
158 outLocator = outLocatorInitialPosition;
168 #define IMAGE(PIXTYPE) image::Image<PIXTYPE> 169 #define MASKEDIMAGE(PIXTYPE) image::MaskedImage<PIXTYPE, image::MaskPixel, image::VariancePixel> 172 #define INSTANTIATE_IM_OR_MI(IMGMACRO, OUTPIXTYPE, INPIXTYPE) \ 173 template void convolveWithInterpolation(IMGMACRO(OUTPIXTYPE) &, IMGMACRO(INPIXTYPE) const &, \ 174 math::Kernel const &, math::ConvolutionControl const &); \ 175 NL template void convolveRegionWithInterpolation(IMGMACRO(OUTPIXTYPE) &, IMGMACRO(INPIXTYPE) const &, \ 176 KernelImagesForRegion const &, \ 177 ConvolveWithInterpolationWorkingImages &); 179 #define INSTANTIATE(OUTPIXTYPE, INPIXTYPE) \ 180 INSTANTIATE_IM_OR_MI(IMAGE, OUTPIXTYPE, INPIXTYPE) \ 181 INSTANTIATE_IM_OR_MI(MASKEDIMAGE, OUTPIXTYPE, INPIXTYPE)
void scaledPlus(OutImageT &outImage, double c1, InImageT const &inImage1, double c2, InImageT const &inImage2)
Compute the scaled sum of two images.
lsst::geom::Box2I getBBox() const
Get the bounding box for the region.
int getHeight() const noexcept
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.
ImagePtr getImage(Location location) const
Return the image and sum at the specified location.
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
kernel images used by convolveRegionWithInterpolation
LSST DM logging module built on log4cxx.
RegionList::const_iterator ConstIterator
A base class for image defects.
bool computeNextRow(RowOfKernelImagesForRegion ®ionRow) const
Compute next row of subregions.
void assign(ImageBase const &rhs, lsst::geom::Box2I const &bbox=lsst::geom::Box2I(), ImageOrigin origin=PARENT)
Copy pixels from another image to a specified subregion of this image.
int getMaxInterpolationDistance() const
int getWidth() const noexcept
A row of KernelImagesForRegion.
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.
lsst::geom::Extent2I const getDimensions() const
Return the Kernel's dimensions (width, height)
int getMinX() const noexcept
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
lsst::geom::Box2I shrinkBBox(lsst::geom::Box2I const &bbox) const
Given a bounding box for an image one wishes to convolve with this kernel, return the bounding box fo...
Reports invalid arguments.
bool getDoNormalize() const
KernelConstPtr getKernel() const
Get the kernel (as a shared pointer to const)
Kernels are used for convolution with MaskedImages and (eventually) Images.
xy_locator xy_at(int x, int y) const
Return an xy_locator at the point (x, y) in the image.
An integer coordinate rectangle.
A collection of Kernel images for special locations on a rectangular region of an image...
virtual std::shared_ptr< Kernel > clone() const =0
Return a pointer to a deep copy of this kernel.
int getMinY() const noexcept
#define INSTANTIATE(FROMSYS, TOSYS)