35 #ifndef LSST_IP_DIFFIM_IMAGESTATISTICS_H 36 #define LSST_IP_DIFFIM_IMAGESTATISTICS_H 58 template <
typename PixelT>
65 _xsum(0.), _x2sum(0.), _npix(0), _bpMask(0) {
69 mi != detBadMaskPlanes.
end(); ++mi){
75 "Cannot update bad bit mask with %s", (*mi).c_str());
84 void reset() { _xsum = _x2sum = 0.; _npix = 0;}
107 for (
int y = y0;
y != y1; ++
y) {
110 if (!((*ptr).mask() & _bpMask)) {
111 double const ivar = 1. / (*ptr).variance();
113 _xsum += (*ptr).image() * sqrt(ivar);
114 _x2sum += (*ptr).image() * (*ptr).image() * ivar;
122 "Nan/Inf in ImageStatistics.apply");
135 return (_npix > 1) ? (_x2sum/_npix - _xsum/_npix * _xsum/_npix) * _npix/(_npix-1.) :
147 if ( fabs(
getMean()) > policy.
getDouble(
"maximumFootprintResidualMean") )
return false;
148 if (
getRms() > policy.
getDouble(
"maximumFootprintResidualStd") )
return false;
void apply(lsst::afw::image::MaskedImage< PixelT > const &image)
std::shared_ptr< ImageStatistics > Ptr
a container for holding hierarchical configuration data in memory.
virtual ~ImageStatistics()
Provides consistent interface for LSST exceptions.
void setBpMask(lsst::afw::image::MaskPixel bpMask)
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
lsst::afw::image::MaskedImage< PixelT >::x_iterator x_iterator
x_iterator x_at(int x, int y) const
Return an x_iterator at the point (x, y)
LSST DM logging module built on log4cxx.
An iterator to the MaskedImage.
virtual char const * what(void) const noexcept
Return a character string summarizing this exception.
int getHeight() const
Return the number of rows in the image.
A base class for image defects.
double getVariance() const
A class to manipulate images, masks, and variance as a single object.
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR'd together.
Class to calculate difference image statistics.
double getDouble(const std::string &name) const
return a double value associated with the given name.
ImageStatistics(lsst::pex::policy::Policy const &policy)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
bool evaluateQuality(lsst::pex::policy::Policy const &policy)
void apply(lsst::afw::image::MaskedImage< PixelT > const &image, int core)
int getWidth() const
Return the number of columns in the image.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
lsst::afw::image::MaskPixel getBpMask()
StringArray getStringArray(const std::string &name) const
return an array of values associated with the given name