33 namespace pexExcept = lsst::pex::exceptions;
35 namespace afwGeom = lsst::afw::geom;
36 namespace coaddChiSq = lsst::coadd::chisquared;
38 template <
typename CoaddPixelT,
typename WeightPixelT>
52 if (coadd.getBBox() != weightMap.
getBBox()) {
54 (
boost::format(
"coadd and weightMap parent bboxes differ: %s != %s") %
55 coadd.getBBox() % weightMap.
getBBox()).str());
68 for (
int y = 0, endY = imageView.getHeight();
y != endY; ++
y) {
69 typename Coadd::const_x_iterator imageIter = imageView.row_begin(
y);
70 typename Coadd::const_x_iterator
const imageEndIter = imageView.row_end(
y);
71 typename Coadd::x_iterator coaddIter = coaddView.row_begin(
y);
72 typename WeightMap::x_iterator weightMapIter = weightMapView.row_begin(
y);
73 for (; imageIter != imageEndIter; ++imageIter, ++coaddIter, ++weightMapIter) {
74 if ((imageIter.mask() & badPixelMask) == 0) {
75 CoaddPixelT value = imageIter.image() * imageIter.image() / imageIter.variance();
76 coaddIter.image() += value;
77 coaddIter.mask() |= imageIter.mask();
89 #define MASKEDIMAGE(IMAGEPIXEL) afwImage::MaskedImage<IMAGEPIXEL, \
90 afwImage::MaskPixel, afwImage::VariancePixel>
91 #define INSTANTIATE(COADDPIXEL, WEIGHTPIXEL) \
92 template afwGeom::Box2I coaddChiSq::addToCoadd<COADDPIXEL, WEIGHTPIXEL>( \
93 MASKEDIMAGE(COADDPIXEL) &coadd, \
94 afwImage::Image<WEIGHTPIXEL> &weightMap, \
95 MASKEDIMAGE(COADDPIXEL) const &image, \
96 afwImage::MaskPixel const badPixelMask, \
tbl::Key< double > weight
Include files required for standard LSST Exception handling.
boost::uint16_t MaskPixel
#define INSTANTIATE(MATCH)
geom::Box2I getBBox(ImageOrigin origin=PARENT) const
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
A class to manipulate images, masks, and variance as a single object.
bool isEmpty() const
Return true if the box contains no points.
#define LSST_EXCEPT(type,...)
lsst::afw::geom::Box2I addToCoadd(lsst::afw::image::Image< CoaddPixelT > &coadd, lsst::afw::image::Image< WeightPixelT > &weightMap, lsst::afw::image::Image< CoaddPixelT > const &image, WeightPixelT weight)
add good pixels from an image to a coadd and associated weight map
void clip(Box2I const &other)
Shrink this to ensure that other.contains(*this).
float VariancePixel
! default type for Masks and MaskedImage Masks
A class to represent a 2-dimensional array of pixels.