33 #include "boost/format.hpp" 52 bool operator()(T
val)
const {
53 return ((val.mask() & _badPixel) == 0) ? true :
false;
62 struct CheckKnownValue {
66 bool operator()(T val)
const {
81 template <
typename CoaddT,
typename WeightPixelT,
typename isVal
idPixel>
91 if (coadd.getBBox() != weightMap.
getBBox()) {
93 (
boost::format(
"coadd and weightMap parent bboxes differ: %s != %s") %
98 overlapBBox.
clip(image.getBBox());
99 if (overlapBBox.isEmpty()) {
107 isValidPixel
const isValid(badPixelMask);
108 for (
int y = 0, endY = imageView.getHeight();
y != endY; ++
y) {
109 typename CoaddT::const_x_iterator imageIter = imageView.row_begin(
y);
110 typename CoaddT::const_x_iterator
const imageEndIter = imageView.row_end(
y);
111 typename CoaddT::x_iterator coaddIter = coaddView.row_begin(
y);
112 typename WeightMapT::x_iterator weightMapIter = weightMapView.row_begin(
y);
113 for (; imageIter != imageEndIter; ++imageIter, ++coaddIter, ++weightMapIter) {
115 typename CoaddT::SinglePixel pix = *imageIter;
126 template <
typename CoaddPixelT,
typename WeightPixelT>
135 return addToCoaddImpl<Image, WeightPixelT, CheckKnownValue>(coadd, weightMap,
image, 0x0,
weight);
138 template <
typename CoaddPixelT,
typename WeightPixelT>
150 return addToCoaddImpl<Image,WeightPixelT,CheckMask>(coadd, weightMap, maskedImage, badPixelMask,
weight);
156 #define MASKEDIMAGE(IMAGEPIXEL) afwImage::MaskedImage<IMAGEPIXEL, \ 157 afwImage::MaskPixel, afwImage::VariancePixel> 158 #define INSTANTIATE(COADDPIXEL, WEIGHTPIXEL) \ 159 template lsst::afw::geom::Box2I coaddUtils::addToCoadd<COADDPIXEL, WEIGHTPIXEL>( \ 160 afwImage::Image<COADDPIXEL> &coadd, \ 161 afwImage::Image<WEIGHTPIXEL> &weightMap, \ 162 afwImage::Image<COADDPIXEL> const &image, \ 166 template lsst::afw::geom::Box2I coaddUtils::addToCoadd<COADDPIXEL, WEIGHTPIXEL>( \ 167 MASKEDIMAGE(COADDPIXEL) &coadd, \ 168 afwImage::Image<WEIGHTPIXEL> &weightMap, \ 169 MASKEDIMAGE(COADDPIXEL) const &image, \ 170 afwImage::MaskPixel const badPixelMask, \ float Pixel
Typedefs to be used for pixel values.
ImageT::SinglePixel badPixel(typename ImageT::Pixel bad=0)
Return a value indicating a bad pixel for the given Image type.
lsst::geom::Box2I getBBox(ImageOrigin origin=PARENT) const
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
A class to manipulate images, masks, and variance as a single object.
afw::table::Key< double > weight
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
void clip(Box2I const &other) noexcept
Shrink this to ensure that other.contains(*this).
Reports invalid arguments.
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
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
float VariancePixel
default type for MaskedImage variance images
An integer coordinate rectangle.
A class to represent a 2-dimensional array of pixels.
#define INSTANTIATE(FROMSYS, TOSYS)