25 #ifndef LSST_AFW_MATH_CONVOLVEIMAGE_H
26 #define LSST_AFW_MATH_CONVOLVEIMAGE_H
61 bool doNormalize =
true,
62 bool doCopyEdge =
false,
63 int maxInterpolationDistance = 10,
96 template <
typename OutImageT,
typename InImageT>
100 InImageT
const &inImage1,
102 InImageT
const &inImage2);
104 template <
typename OutImageT,
typename InImageT>
106 typename InImageT::const_xy_locator inImageLocator,
111 template <
typename OutImageT,
typename InImageT>
113 typename InImageT::const_xy_locator inImageLocator,
114 std::vector<lsst::afw::math::Kernel::Pixel>
const& kernelColList,
115 std::vector<lsst::afw::math::Kernel::Pixel>
const& kernelRowList);
117 template <
typename OutImageT,
typename InImageT,
typename KernelT>
119 OutImageT& convolvedImage,
120 InImageT
const& inImage,
121 KernelT
const& kernel,
124 template <
typename OutImageT,
typename InImageT,
typename KernelT>
126 OutImageT& convolvedImage,
127 InImageT
const& inImage,
128 KernelT
const& kernel,
130 bool doCopyEdge =
false);
137 template <
typename ImageT>
142 typedef typename ImageT::SinglePixel SinglePixelT;
144 std::numeric_limits<SinglePixelT>::has_quiet_NaN ?
145 std::numeric_limits<SinglePixelT>::quiet_NaN() : 0);
156 template <
typename MaskedImageT>
161 typedef typename MaskedImageT::Image::Pixel ImagePixelT;
162 typedef typename MaskedImageT::Variance::Pixel VariancePixelT;
164 return typename MaskedImageT::SinglePixel(
165 std::numeric_limits<ImagePixelT>::has_quiet_NaN ?
166 std::numeric_limits<ImagePixelT>::quiet_NaN() : 0,
167 MaskedImageT::Mask::getPlaneBitMask(
"NO_DATA"),
168 std::numeric_limits<VariancePixelT>::infinity());
185 template <
typename OutImageT,
typename InImageT>
187 typename InImageT::const_xy_locator inImageLocator,
194 typename OutImageT::SinglePixel outValue = 0;
195 for (
int kRow = 0; kRow != kHeight; ++kRow) {
197 kernelLocator + lsst::afw::image::detail::difference_type(kWidth, 0);
198 kernelLocator != kEnd; ++inImageLocator.x(), ++kernelLocator.x()) {
201 outValue += *inImageLocator*kVal;
205 inImageLocator += lsst::afw::image::detail::difference_type(-kWidth, 1);
206 kernelLocator += lsst::afw::image::detail::difference_type(-kWidth, 1);
221 template <
typename OutImageT,
typename InImageT>
223 typename InImageT::const_xy_locator inImageLocator,
224 std::vector<lsst::afw::math::Kernel::Pixel>
const &kernelXList,
226 std::vector<lsst::afw::math::Kernel::Pixel>
const &kernelYList)
228 typedef typename std::vector<lsst::afw::math::Kernel::Pixel>::const_iterator k_iter;
230 typedef typename OutImageT::SinglePixel OutT;
232 for (k_iter kernelYIter = kernelYList.begin(), yEnd = kernelYList.end();
233 kernelYIter != yEnd; ++kernelYIter) {
236 for (k_iter kernelXIter = kernelXList.begin(), xEnd = kernelXList.end();
237 kernelXIter != xEnd; ++kernelXIter, ++inImageLocator.x()) {
240 outValueY += *inImageLocator*kValX;
244 double const kValY = *kernelYIter;
246 outValue += outValueY*kValY;
249 inImageLocator += lsst::afw::image::detail::difference_type(-kernelXList.size(), 1);
256 #endif // !defined(LSST_AFW_MATH_CONVOLVEIMAGE_H)
void scaledPlus(OutImageT &outImage, double c1, InImageT const &inImage1, double c2, InImageT const &inImage2)
An include file to include the header files for lsst::afw::geom.
Declare the Kernel class and subclasses.
OutImageT::SinglePixel convolveAtAPoint(typename InImageT::const_xy_locator inImageLocator, typename lsst::afw::image::Image< lsst::afw::math::Kernel::Pixel >::const_xy_locator kernelLocator, int kWidth, int kHeight)
Apply convolution kernel to an image at one point.
Include files required for standard LSST Exception handling.
Parameters to control convolution.
bool _doNormalize
normalize the kernel to sum=1?
void setDoCopyEdge(bool doCopyEdge)
bool _doCopyEdge
instead of setting them to the standard edge pixel?
void setDoNormalize(bool doNormalize)
DevicePreference
A type used to select whether to use CPU or GPU device.
A traits class for MaskedImage.
bool getDoNormalize() const
void setMaxInterpolationDistance(int maxInterpolationDistance)
Interface for CPU/GPU device selection.
lsst::afw::gpu::DevicePreference _devicePreference
choose CPU or GPU acceleration
ImageT::SinglePixel edgePixel(lsst::afw::image::detail::Image_tag)
Return an off-the-edge pixel appropriate for a given Image type.
lsst::afw::gpu::DevicePreference getDevicePreference() const
void setDevicePreference(lsst::afw::gpu::DevicePreference devicePreference)
_view_t::xy_locator::const_t const_xy_locator
A const_xy_locator.
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, ConvolutionControl const &convolutionControl=ConvolutionControl())
Convolve an Image or MaskedImage with a Kernel, setting pixels of an existing output image...
const DevicePreference DEFAULT_DEVICE_PREFERENCE
Default DevicePreference value.
Implementation of the Class MaskedImage.
ConvolutionControl(bool doNormalize=true, bool doCopyEdge=false, int maxInterpolationDistance=10, lsst::afw::gpu::DevicePreference devicePreference=lsst::afw::gpu::DEFAULT_DEVICE_PREFERENCE)
bool getDoCopyEdge() const
int _maxInterpolationDistance
over which to attempt interpolation
int getMaxInterpolationDistance() const