28 #include "ndarray/eigen.h" 
   41 template <
typename MaskedImageT>
 
   44     explicit FootprintBits() : _bits(0) {}
 
   47     void reset() { _bits = 0x0; }
 
   60 typedef afw::image::MaskedImage<float> MaskedImageF;
 
   63                  const FootprintBits<MaskedImageF>& func, afw::table::SourceRecord& measRecord) {
 
   64     for (
auto const& i : maskFlagToPixelFlag) {
 
   66             if (func.getBits() & MaskedImageF::Mask::getPlaneBitMask(i.first)) {
 
   67                 measRecord.set(i.second, 
true);
 
   69         } 
catch (pex::exceptions::InvalidParameterError& err) {
 
   80     _generalFailureKey = 
schema.addField<afw::table::Flag>(
 
   81             name + 
"_flag", 
"General failure flag, set if anything went wrong");
 
   83             schema.addField<afw::table::Flag>(
name + 
"_flag" + 
"_offimage", 
"Source center is off image");
 
   85     _anyKeys[
"EDGE"] = 
schema.addField<afw::table::Flag>(
 
   86             name + 
"_flag_edge", 
"Source is outside usable exposure region (masked EDGE or NO_DATA)");
 
   87     _anyKeys[
"INTRP"] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_interpolated",
 
   88                                                           "Interpolated pixel in the Source footprint");
 
   89     _anyKeys[
"SAT"] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_saturated",
 
   90                                                         "Saturated pixel in the Source footprint");
 
   92             schema.addField<afw::table::Flag>(
name + 
"_flag_cr", 
"Cosmic ray in the Source footprint");
 
   94             schema.addField<afw::table::Flag>(
name + 
"_flag_bad", 
"Bad pixel in the Source footprint");
 
   95     _anyKeys[
"SUSPECT"] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_suspect",
 
   96                                                             "Source's footprint includes suspect pixels");
 
   98     _centerKeys[
"INTRP"] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_interpolatedCenter",
 
   99                                                              "Interpolated pixel in the Source center");
 
  100     _centerKeys[
"SAT"] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_saturatedCenter",
 
  101                                                            "Saturated pixel in the Source center");
 
  103             schema.addField<afw::table::Flag>(
name + 
"_flag_crCenter", 
"Cosmic ray in the Source center");
 
  104     _centerKeys[
"SUSPECT"] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_suspectCenter",
 
  105                                                                "Source's center is close to suspect pixels");
 
  111         _centerKeys[i] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_" + maskName + 
"Center",
 
  112                                                            "Source center is close to " + i + 
" pixels");
 
  118         _anyKeys[i] = 
schema.addField<afw::table::Flag>(
name + 
"_flag_" + maskName,
 
  119                                                         "Source footprint includes " + i + 
" pixels");
 
  126     FootprintBits<MaskedImageF> func;
 
  130     if (measRecord.
getTable()->getCentroidKey().isValid()) {
 
  135                               "Center point passed to PixelFlagsAlgorithm is NaN");
 
  140         measRecord.
set(_generalFailureKey, 
true);
 
  149         if (!footprint || footprint->getPeaks().empty()) {
 
  152             center.setX(footprint->getPeaks().front().getFx());
 
  153             center.setY(footprint->getPeaks().front().getFy());
 
  159         measRecord.
set(_offImageKey, 
true);
 
  160         measRecord.
set(_anyKeys.
at(
"EDGE"), 
true);
 
  165     footprint.
getSpans()->clippedTo(mimage.getBBox())->applyFunctor(func, *(mimage.getMask()));
 
  169         if (func.getBits() & MaskedImageF::Mask::getPlaneBitMask(
"NO_DATA")) {
 
  170             measRecord.
set(_anyKeys.
at(
"EDGE"), 
true);
 
  177     updateFlags(_anyKeys, func, measRecord);
 
  186     middle.
getSpans()->clippedTo(mimage.getBBox())->applyFunctor(func, *(mimage.getMask()));
 
  189     updateFlags(_centerKeys, func, measRecord);
 
  193     measRecord.
set(_generalFailureKey, 
true);