25#include <boost/format.hpp>
38 if (typeStr.
compare(
"bitmask") == 0) {
40 }
else if (typeStr.
compare(
"value") == 0) {
42 }
else if (typeStr.
compare(
"stdev") == 0) {
44 }
else if (typeStr.
compare(
"variance") == 0) {
46 }
else if (typeStr.
compare(
"pixel_stdev") == 0) {
50 (boost::format(
"Unsupported Threshold type: %s") % typeStr).
str());
63 (boost::format(
"Unsopported Threshold type: %d") %
type).
str());
72 (boost::format(
"St. dev. must be > 0: %g") % param).
str());
74 return _value * param;
82 (boost::format(
"Variance must be > 0: %g") % param).
str());
87 (boost::format(
"Unsupported type: %d") % _type).
str());
91template <
typename ImageT>
98 LOGL_DEBUG(
"lsst.afw.detection.threshold",
"St. Dev = %g", sd);
116#define INSTANTIATE(TYPE) \
117 template double Threshold::getValue(image::TYPE<unsigned short> const&) const; \
118 template double Threshold::getValue(image::TYPE<int> const&) const; \
119 template double Threshold::getValue(image::TYPE<float> const&) const; \
120 template double Threshold::getValue(image::TYPE<double> const&) const; \
121 template double Threshold::getValue(image::TYPE<std::uint64_t> const&) const;
#define INSTANTIATE(FROMSYS, TOSYS)
#define LSST_EXCEPT(type,...)
#define LOGL_DEBUG(logger, message...)
A Threshold is used to pass a threshold value to detection algorithms.
static std::string getTypeString(ThresholdType const &type)
static ThresholdType parseTypeString(std::string const &typeStr)
double getValue(const double param=-1) const
return value of threshold, to be interpreted via type
ThresholdType
Types of threshold:
@ VARIANCE
Use number of sigma given variance.
@ PIXEL_STDEV
Use number of sigma given per-pixel s.d.
@ STDEV
Use number of sigma given s.d.
@ BITMASK
Use (pixels & (given mask))
A class to evaluate image statistics.
double getValue(Property const prop=NOTHING) const
Return the value of the desired property (if specified in the constructor)
Threshold createThreshold(const double value, const std::string type="value", const bool polarity=true)
Factory method for creating Threshold objects.
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
@ STDEVCLIP
estimate sample N-sigma clipped stdev (N set in StatisticsControl, default=3)