24 #include <boost/format.hpp>
33 namespace math = lsst::afw::math;
34 namespace pexLogging = lsst::pex::logging;
41 if (typeStr.compare(
"bitmask") == 0) {
43 }
else if (typeStr.compare(
"value") == 0) {
45 }
else if (typeStr.compare(
"stdev") == 0) {
47 }
else if (typeStr.compare(
"variance") == 0) {
49 }
else if (typeStr.compare(
"pixel_stdev") == 0) {
53 lsst::pex::exceptions::InvalidParameterError,
54 (
boost::format(
"Unsupported Threshold type: %s") % typeStr).str()
62 }
else if (type ==
STDEV) {
68 lsst::pex::exceptions::InvalidParameterError,
69 (
boost::format(
"Unsopported Threshold type: %d") % type).str()
84 lsst::pex::exceptions::InvalidParameterError,
96 lsst::pex::exceptions::InvalidParameterError,
100 return _value*std::sqrt(param);
103 lsst::pex::exceptions::InvalidParameterError,
109 template<
typename ImageT>
117 pexLogging::TTrace<3>(
"afw.detection",
"St. Dev = %g", sd);
140 std::string
const typeStr,
150 #define INSTANTIATE(TYPE) \
151 template double Threshold::getValue(image::TYPE<unsigned short> const&) const; \
152 template double Threshold::getValue(image::TYPE<int> const&) const; \
153 template double Threshold::getValue(image::TYPE<float> const&) const; \
154 template double Threshold::getValue(image::TYPE<double> const&) const; \
155 template double Threshold::getValue(image::TYPE<boost::uint64_t> const&) const;
double getValue(Property const prop=NOTHING) const
Return the value of the desired property (if specified in the constructor)
definition of the Trace messaging facilities
Use number of sigma given per-pixel s.d.
A Threshold is used to pass a threshold value to detection algorithms.
double _value
value of threshold, to be interpreted via _type
ThresholdType _type
type of threshold
estimate sample N-sigma clipped stdev (N set in StatisticsControl, default=3)
table::Key< table::Array< Kernel::Pixel > > image
Use (pixels & (given mask))
static std::string getTypeString(ThresholdType const &type)
Use number of sigma given variance.
Threshold createThreshold(const double value, const std::string type="value", const bool polarity=true)
Factory method for creating Threshold objects.
Represent a detection threshold.
double getValue(const double param=-1) const
#define LSST_EXCEPT(type,...)
ThresholdType
Types of threshold:
Use number of sigma given s.d.
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Compute Image Statistics.
static ThresholdType parseTypeString(std::string const &typeStr)
Implementation of the Class MaskedImage.
#define INSTANTIATE(TYPE)
Include files required for standard LSST Exception handling.