23 #ifndef LSST_MEAS_EXTENSIONS_simpleShape_h_INCLUDED
24 #define LSST_MEAS_EXTENSIONS_simpleShape_h_INCLUDED
28 #include "lsst/pex/config.h"
29 #include "lsst/afw/geom/ellipses.h"
30 #include "lsst/afw/table.h"
31 #include "lsst/afw/image.h"
32 #include "lsst/meas/base/Algorithm.h"
33 #include "lsst/meas/base.h"
35 namespace lsst {
namespace meas {
namespace extensions {
namespace simpleShape {
45 LSST_CONTROL_FIELD(
sigma,
double,
"Sigma of circular Gaussian used as weight function, in pixels");
46 LSST_CONTROL_FIELD(
nSigmaRegion,
double,
"Maximum radius for pixels to include, in units of sigma");
54 afw::table::Schema & schema,
55 std::string
const & name
84 lsst::meas::base::FlagHandler
const &
getFlagHandler()
const {
return _flagHandler; }
87 lsst::afw::table::QuadrupoleKey _shapeResult;
88 lsst::afw::table::Point2DKey _centroidResult;
89 lsst::afw::table::CovarianceMatrixKey<double, 5 > _uncertantyResult;
90 lsst::meas::base::FlagHandler _flagHandler;
94 class SimpleShape :
public lsst::meas::base::SimpleAlgorithm {
104 SimpleShape(
Control const & ctrl, std::string
const & name, afw::table::Schema & schema);
116 template <
typename T>
118 afw::geom::ellipses::Ellipse
const & weight,
119 afw::image::MaskedImage<T>
const & image,
120 double nSigmaRegion=3.0
151 Eigen::Matrix<double,6,1>
const & q,
152 afw::geom::ellipses::Quadrupole & quadrupole,
153 afw::geom::Point2D & center
179 afw::geom::ellipses::Quadrupole
const & weight,
180 afw::geom::ellipses::Quadrupole & ellipse,
181 afw::geom::Point2D & center
185 afw::table::SourceRecord & measRecord,
186 afw::image::Exposure<float>
const & exposure
190 afw::table::SourceRecord & measRecord,
191 lsst::meas::base::MeasurementError * error=NULL
197 lsst::meas::base::SafeCentroidExtractor _centroidExtractor;
210 std::bitset<SimpleShape::N_FLAGS>
flags;
222 #endif // !LSST_MEAS_EXTENSIONS_simpleShape_h_INCLUDED
bool getFlag(int index) const
Struct to hold the results of SimpleShape when we don't run it as a plugin.
static base::FlagDefinitionList const & getFlagDefinitions()
Eigen::Matrix< double, 5, 5 > covariance
Matrix of uncertainties; ordered Ixx, Iyy, Ixy, Ix, Iy.
bool operator!=(SimpleShapeResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
lsst::meas::base::FlagHandler const & getFlagHandler() const
static Eigen::Matrix< double, 5, 5 > correctWeightedMoments(afw::geom::ellipses::Quadrupole const &weight, afw::geom::ellipses::Quadrupole &ellipse, afw::geom::Point2D ¢er)
Correct moments measured with a Gaussian weight function by assuming the data was also an elliptical ...
static Eigen::Matrix< double, 5, 6 > convertRawMoments(Eigen::Matrix< double, 6, 1 > const &q, afw::geom::ellipses::Quadrupole &quadrupole, afw::geom::Point2D ¢er)
Convert linear raw moments into an ellipse and centroid, and return the derivative of the conversion...
static base::FlagDefinition const FAILURE
virtual void fail(afw::table::SourceRecord &measRecord, lsst::meas::base::MeasurementError *error=NULL) const
SimpleShapeResult()
Constructor; initializes everything to Nan.
SimpleShape(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
A C++ control class to handle SdssShapeAlgorithm's configuration.
static unsigned int const N_FLAGS
static SimpleShapeResult computeMoments(afw::geom::ellipses::Ellipse const &weight, afw::image::MaskedImage< T > const &image, double nSigmaRegion=3.0)
Compute the Gaussian-weighted moments of an image.
std::bitset< SimpleShape::N_FLAGS > flags
double nSigmaRegion
"Maximum radius for pixels to include, in units of sigma" ;
static SimpleShapeResultKey addFields(afw::table::Schema &schema, std::string const &name)
afw::geom::Point2D center
Measured first moments, or the input center if !recentroid.
bool operator==(SimpleShapeResultKey const &other) const
Compare the FunctorKey for equality with another, using the underlying Keys.
double sigma
"Sigma of circular Gaussian used as weight function, in pixels" ;
bool isValid() const
Return True if the key is valid.
virtual void set(afw::table::BaseRecord &record, SimpleShapeResult const &value) const
afw::geom::ellipses::Quadrupole ellipse
Measured second moments.
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
SimpleShapeControl Control