35 #ifndef LSST_IP_DIFFIM_IMAGESTATISTICS_H
36 #define LSST_IP_DIFFIM_IMAGESTATISTICS_H
39 #include "boost/shared_ptr.hpp"
57 template <
typename PixelT>
60 typedef boost::shared_ptr<ImageStatistics>
Ptr;
66 std::vector<std::string> detBadMaskPlanes = policy.
getStringArray(
"badMaskPlanes");
67 for (std::vector<std::string>::iterator mi = detBadMaskPlanes.begin();
68 mi != detBadMaskPlanes.end(); ++mi){
73 lsst::pex::logging::TTrace<6>(
"lsst.ip.diffim.ImageStatistics",
74 "Cannot update bad bit mask with %s", (*mi).c_str());
75 lsst::pex::logging::TTrace<7>(
"lsst.ip.diffim.ImageStatistics",
100 y0 = std::max(0, image.
getHeight()/2 - core);
102 x0 = std::max(0, image.
getWidth()/2 - core);
106 for (
int y = y0;
y != y1; ++
y) {
109 if (!((*ptr).mask() &
_bpMask)) {
110 double const ivar = 1. / (*ptr).variance();
111 if (lsst::utils::lsst_isfinite(ivar)) {
112 _xsum += (*ptr).image() * sqrt(ivar);
113 _x2sum += (*ptr).image() * (*ptr).image() * ivar;
119 if ((!lsst::utils::lsst_isfinite(
_xsum)) || (!lsst::utils::lsst_isfinite(
_x2sum))) {
121 "Nan/Inf in ImageStatistics.apply");
130 return (
_npix > 0) ?
_xsum/
_npix : std::numeric_limits<double>::quiet_NaN();
135 std::numeric_limits<double>::quiet_NaN();
146 if ( fabs(
getMean()) > policy.
getDouble(
"maximumFootprintResidualMean") )
return false;
147 if (
getRms() > policy.
getDouble(
"maximumFootprintResidualStd") )
return false;
boost::uint16_t MaskPixel
StringArray getStringArray(const std::string &name) const
int getWidth() const
Return the number of columns in the image.
void apply(lsst::afw::image::MaskedImage< PixelT > const &image)
a container for holding hierarchical configuration data in memory.
virtual ~ImageStatistics()
definition of the Trace messaging facilities
lsst::afw::image::MaskPixel _bpMask
double getDouble(const std::string &name) const
void setBpMask(lsst::afw::image::MaskPixel bpMask)
lsst::afw::image::MaskedImage< PixelT >::x_iterator x_iterator
table::Key< table::Array< Kernel::Pixel > > image
An iterator to the MaskedImage.
x_iterator x_at(int x, int y) const
Return an x_iterator at the point (x, y)
An include file to include the header files for lsst::afw::image.
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR'd together.
boost::shared_ptr< ImageStatistics > Ptr
A class to manipulate images, masks, and variance as a single object.
Class to calculate difference image statistics.
virtual char const * what(void) const
ImageStatistics(lsst::pex::policy::Policy const &policy)
#define LSST_EXCEPT(type,...)
bool evaluateQuality(lsst::pex::policy::Policy const &policy)
void apply(lsst::afw::image::MaskedImage< PixelT > const &image, int core)
double getVariance() const
int getHeight() const
Return the number of rows in the image.
lsst::afw::image::MaskPixel getBpMask()