23 #include "ndarray/eigen.h" 28 namespace lsst {
namespace meas {
namespace base {
30 FlagDefinitionList flagDefinitions;
38 return flagDefinitions;
51 _centroidExtractor(schema, name, true),
52 _centroidChecker(schema, name, ctrl.doFootprintCheck, ctrl.maxDistToPeak)
63 result.
x = center.getX();
64 result.
y = center.getY();
65 measRecord.
set(_centroidKey, result);
70 int x = center.getX();
71 int y = center.getY();
76 if (x < 1 || x >= image.getWidth() - 1 || y < 1 || y >= image.getHeight() - 1) {
85 ImageT::xy_locator im = image.xy_at(x, y);
88 (im(-1, 1) + im( 0, 1) + im( 1, 1) +
89 im(-1, 0) + im( 0, 0) + im( 1, 0) +
90 im(-1, -1) + im( 0, -1) + im( 1, -1))
102 -im(-1, 1) + im( 1, 1) +
103 -im(-1, 0) + im( 1, 0) +
104 -im(-1, -1) + im( 1, -1);
106 (im(-1, 1) + im( 0, 1) + im( 1, 1)) -
107 (im(-1, -1) + im( 0, -1) + im( 1, -1));
111 measRecord.
set(_centroidKey, result);
112 _centroidChecker(measRecord);
129 if (flag == NaiveCentroidAlgorithm::FAILURE)
continue;
130 if (
mapper.getInputSchema().getNames().count(
std::size_t size() const
return the current size (number of defined elements) of the collection
NaiveCentroidAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
double indexToPosition(double ind)
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
A reusable struct for centroid measurements.
static FlagDefinition const EDGE
CentroidElement x
x (column) coordinate of the measured position
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=nullptr) const
Handle an exception thrown by the current algorithm by setting flags in the given record...
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
Called to measure a single child source in an image.
MaskedImageT getMaskedImage()
static FlagDefinitionList const & getFlagDefinitions()
static FlagDefinition const NO_COUNTS
std::unique_ptr< SchemaItem< U > > result
#define LSST_EXCEPT(type,...)
Algorithm provides no uncertainy information at all.
double background
"Value to subtract from the image pixel values" ;
void handleFailure(afw::table::BaseRecord &record, MeasurementError const *error=nullptr) const
Handle an expected or unexpected Exception thrown by a measurement algorithm.
A FunctorKey for CentroidResult.
void set(Key< T > const &key, U const &value)
CentroidElement y
y (row) coordinate of the measured position
A C++ control class to handle NaiveCentroidAlgorithm's configuration.
vector-type utility class to build a collection of FlagDefinitions
static FlagDefinition const FAILURE