50 #include "boost/format.hpp"
61 namespace detection = lsst::afw::detection;
63 namespace math = lsst::afw::math;
64 namespace pexLogging = lsst::pex::logging;
65 namespace geom = lsst::afw::geom;
71 typedef boost::uint64_t IdPixelT;
73 struct Threshold_traits {
75 struct ThresholdLevel_traits :
public Threshold_traits {
77 struct ThresholdPixelLevel_traits :
public Threshold_traits {
79 struct ThresholdBitmask_traits :
public Threshold_traits {
87 inline bool isBadPixel(T) {
92 inline bool isBadPixel(
float val) {
97 inline bool isBadPixel(
double val) {
104 int nbit(
unsigned long i) {
118 template <
typename ImageT>
121 explicit FindIdsInFootprint(ImageT
const&
image
122 ) : detection::FootprintFunctor<ImageT>(image), _ids(), _old(0) {}
130 void operator()(
typename ImageT::xy_locator loc,
134 typename ImageT::Pixel
val = loc(0, 0);
142 std::set<typename ImageT::Pixel>
const& getIds()
const {
147 std::set<typename ImageT::Pixel> _ids;
148 typename ImageT::Pixel _old;
187 bool const left = ctrl.
isLeft().first && ctrl.
isLeft().second;
189 bool const up = ctrl.
isUp().first && ctrl.
isUp().second;
190 bool const down = ctrl.
isDown().first && ctrl.
isDown().second;
194 throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
195 boost::format(
"The two FootprintSets must have the same region").str());
204 int const nLhs = lhsFootprints.size();
205 int const nRhs = rhsFootprints.size();
210 int const lhsIdNbit = nbit(nLhs);
211 int const lhsIdMask = (lhsIdNbit == 0) ? 0
x0 : (1 << lhsIdNbit) - 1;
213 if (std::size_t(nRhs << lhsIdNbit) > std::numeric_limits<IdPixelT>::max() - 1) {
214 throw LSST_EXCEPT(lsst::pex::exceptions::OverflowError,
215 (
boost::format(
"%d + %d footprints need too many bits; change IdPixelT typedef")
216 % nLhs % nRhs).str());
223 typedef std::map<int, std::set<boost::uint64_t> > OldIdMap;
224 OldIdMap overwrittenIds;
227 for (FootprintList::const_iterator ptr = lhsFootprints.begin(), end = lhsFootprints.end();
228 ptr != end; ++ptr, ++
id) {
233 growFootprint(*foot, rLhs, isotropic) : growFootprint(*foot, rLhs, left, right, up, down);
236 std::set<boost::uint64_t> overwritten;
237 foot->insertIntoImage(*idImage,
id,
true, 0
x0, &overwritten);
239 if (!overwritten.empty()) {
240 overwrittenIds.insert(overwrittenIds.end(), std::make_pair(
id, overwritten));
244 assert (
id <= std::size_t(1 << lhsIdNbit));
245 id = (1 << lhsIdNbit);
246 for (FootprintList::const_iterator ptr = rhsFootprints.begin(), end = rhsFootprints.end();
247 ptr != end; ++ptr,
id += (1 << lhsIdNbit)) {
252 growFootprint(*foot, rRhs, isotropic) : growFootprint(*foot, rRhs, left, right, up, down);
255 std::set<boost::uint64_t> overwritten;
256 foot->insertIntoImage(*idImage,
id,
true, lhsIdMask, &overwritten);
258 if (!overwritten.empty()) {
259 overwrittenIds.insert(overwrittenIds.end(), std::make_pair(
id, overwritten));
276 FindIdsInFootprint<image::Image<IdPixelT> > idFinder(*idImage);
277 for (FootprintList::iterator ptr = fs.getFootprints()->begin(),
278 end = fs.getFootprints()->end(); ptr != end; ++ptr) {
279 PTR(Footprint) foot = *ptr;
281 idFinder.apply(*foot);
283 std::set<boost::uint64_t> lhsFootprintIndxs, rhsFootprintIndxs;
285 for (std::set<IdPixelT>::iterator idptr = idFinder.getIds().begin(),
286 idend = idFinder.getIds().end(); idptr != idend; ++idptr) {
287 unsigned int indx = *idptr;
288 if ((indx & lhsIdMask) > 0) {
289 boost::uint64_t i = (indx & lhsIdMask) - 1;
290 lhsFootprintIndxs.insert(i);
294 OldIdMap::iterator mapPtr = overwrittenIds.find(indx);
295 if (mapPtr != overwrittenIds.end()) {
296 std::set<boost::uint64_t> &overwritten = mapPtr->second;
298 for (std::set<boost::uint64_t>::iterator ptr = overwritten.begin(),
299 end = overwritten.end(); ptr != end; ++ptr){
300 lhsFootprintIndxs.insert((*ptr & lhsIdMask) - 1);
307 boost::uint64_t i = indx - 1;
308 rhsFootprintIndxs.insert(i);
312 OldIdMap::iterator mapPtr = overwrittenIds.find(indx);
313 if (mapPtr != overwrittenIds.end()) {
314 std::set<boost::uint64_t> &overwritten = mapPtr->second;
316 for (std::set<boost::uint64_t>::iterator ptr = overwritten.begin(),
317 end = overwritten.end(); ptr != end; ++ptr) {
318 rhsFootprintIndxs.insert(*ptr - 1);
329 for (std::set<boost::uint64_t>::iterator ptr = lhsFootprintIndxs.begin(),
330 end = lhsFootprintIndxs.end(); ptr != end; ++ptr) {
331 boost::uint64_t i = *ptr;
332 assert (i < lhsFootprints.size());
335 int const nold = peaks.
size();
336 peaks.
insert(peaks.
end(), oldPeaks.begin(), oldPeaks.end());
344 for (std::set<boost::uint64_t>::iterator ptr = rhsFootprintIndxs.begin(),
345 end = rhsFootprintIndxs.end(); ptr != end; ++ptr) {
346 boost::uint64_t i = *ptr;
347 assert (i < rhsFootprints.size());
350 int const nold = peaks.
size();
351 peaks.
insert(peaks.
end(), oldPeaks.begin(), oldPeaks.end());
365 typedef boost::shared_ptr<IdSpan> Ptr;
367 explicit IdSpan(
int id,
int y,
int x0,
int x1,
double good) :
368 id(id), y(y), x0(x0), x1(x1), good(good) {}
377 struct IdSpanCompar :
public std::binary_function<const IdSpan::Ptr, const IdSpan::Ptr, bool> {
378 bool operator()(IdSpan::Ptr
const a, IdSpan::Ptr
const b) {
381 }
else if (a->id > b->id) {
384 return (a->y < b->y) ?
true :
false;
395 while (
id != aliases[
id]) {
396 resolved =
id = aliases[
id];
410 template <
typename ImageT>
413 explicit FindPeaksInFootprint(ImageT
const&
image,
416 ) : detection::FootprintFunctor<ImageT>(image),
417 _polarity(polarity), _peaks(peaks) {}
420 void operator()(
typename ImageT::xy_locator loc,
424 typename ImageT::Pixel val = loc(0, 0);
427 if (loc(-1, 1) > val || loc( 0, 1) > val || loc( 1, 1) > val ||
428 loc(-1, 0) > val || loc( 1, 0) > val ||
429 loc(-1, -1) > val || loc( 0, -1) > val || loc( 1, -1) > val) {
433 if (loc(-1, 1) < val || loc( 0, 1) < val || loc( 1, 1) < val ||
434 loc(-1, 0) < val || loc( 1, 0) < val ||
435 loc(-1, -1) < val || loc( 0, -1) < val || loc( 1, -1) < val) {
445 newPeak->setPeakValue(val);
455 template <typename ImageT>
456 class FindMaxInFootprint : public detection::FootprintFunctor<ImageT> {
458 explicit FindMaxInFootprint(ImageT
const&
image,
460 ) : detection::FootprintFunctor<ImageT>(image),
461 _polarity(polarity), _x(0), _y(0),
462 _min( std::numeric_limits<double>::max()),
463 _max(-std::numeric_limits<double>::max()) {}
468 _min = std::numeric_limits<double>::max();
469 _max = -std::numeric_limits<double>::max();
474 void operator()(
typename ImageT::xy_locator loc,
478 typename ImageT::Pixel val = loc(0, 0);
502 newPeak->setPeakValue(_polarity ? _max : _min);
510 template<typename ImageT, typename ThresholdT>
511 void findPeaks(
PTR(detection::Footprint) foot, ImageT const& img,
bool polarity, ThresholdT)
513 FindPeaksInFootprint<ImageT> peakFinder(img, polarity, foot->getPeaks());
514 peakFinder.apply(*foot, 1);
519 std::stable_sort(foot->getPeaks().getInternal().begin(), foot->getPeaks().getInternal().end(),
522 if (foot->getPeaks().empty()) {
523 FindMaxInFootprint<ImageT> maxFinder(img, polarity);
524 maxFinder.apply(*foot);
525 maxFinder.addPeak(foot->getPeaks());
530 template<
typename ImageT>
541 template<
typename ImagePixelT,
typename IterT>
542 static inline bool inFootprint(ImagePixelT pixVal, IterT,
543 bool polarity,
double thresholdVal, ThresholdLevel_traits) {
544 return (polarity ? pixVal : -pixVal) >= thresholdVal;
547 template<
typename ImagePixelT,
typename IterT>
548 static inline bool inFootprint(ImagePixelT pixVal, IterT var,
549 bool polarity,
double thresholdVal, ThresholdPixelLevel_traits) {
550 return (polarity ? pixVal : -pixVal) >= thresholdVal*::sqrt(*var);
553 template<
typename ImagePixelT,
typename IterT>
554 static inline bool inFootprint(ImagePixelT pixVal, IterT,
555 bool,
double thresholdVal, ThresholdBitmask_traits) {
556 return (pixVal & static_cast<long>(thresholdVal));
562 template<
typename IterT>
564 advancePtr(IterT varPtr, Threshold_traits) {
568 template<
typename IterT>
570 advancePtr(IterT varPtr, ThresholdPixelLevel_traits) {
578 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT,
typename ThresholdTraitT>
579 static void findFootprints(
584 double const footprintThreshold,
585 double const includeThresholdMultiplier,
597 double includeThreshold = footprintThreshold * includeThresholdMultiplier;
599 int const row0 = img.
getY0();
600 int const col0 = img.
getX0();
607 std::vector<int> id1(width + 2);
608 std::fill(id1.begin(), id1.end(), 0);
609 std::vector<int> id2(width + 2);
610 std::fill(id2.begin(), id2.end(), 0);
611 std::vector<int>::iterator idc = id1.begin() + 1;
612 std::vector<int>::iterator idp = id2.begin() + 1;
614 std::vector<int> aliases;
615 aliases.reserve(1 + height/20);
617 std::vector<IdSpan::Ptr> spans;
618 spans.reserve(aliases.capacity());
620 aliases.push_back(0);
628 for (
int y = 0; y != height; ++
y) {
629 if (idc == id1.begin() + 1) {
630 idc = id2.
begin() + 1;
631 idp = id1.begin() + 1;
633 idc = id1.begin() + 1;
634 idp = id2.begin() + 1;
636 std::fill_n(idc - 1, width + 2, 0);
639 bool good = (includeThresholdMultiplier == 1.0);
642 x_var_iterator varPtr = (var == NULL) ? NULL : var->
row_begin(y);
643 for (
int x = 0; x < width; ++
x, ++pixPtr, varPtr = advancePtr(varPtr, ThresholdTraitT())) {
644 ImagePixelT
const pixVal = *pixPtr;
646 if (isBadPixel(pixVal) ||
647 !inFootprint(pixVal, varPtr, polarity, footprintThreshold, ThresholdTraitT())) {
649 IdSpan::Ptr sp(
new IdSpan(in_span, y, x0, x - 1, good));
656 if (idc[x - 1] != 0) {
658 }
else if (idp[x - 1] != 0) {
660 }
else if (idp[x] != 0) {
662 }
else if (idp[x + 1] != 0) {
666 aliases.push_back(
id);
677 if (idp[x + 1] != 0 && idp[x + 1] !=
id) {
680 idc[
x] =
id = idp[x + 1];
683 if (!good && inFootprint(pixVal, varPtr, polarity, includeThreshold, ThresholdTraitT())) {
690 IdSpan::Ptr sp(
new IdSpan(in_span, y, x0, width - 1, good));
697 for (
unsigned int i = 0; i < spans.size(); i++) {
703 if (spans.size() > 0) {
704 std::sort(spans.begin(), spans.end(), IdSpanCompar());
710 if (spans.size() > 0) {
713 for (
unsigned int i = 0; i <= spans.size(); i++) {
714 if (i == spans.size() || spans[i]->id !=
id) {
718 for (; i0 < i; i0++) {
719 good |= spans[i0]->good;
720 fp->addSpan(spans[i0]->y + row0, spans[i0]->x0 + col0, spans[i0]->x1 + col0);
723 if (good && !(fp->getNpix() <
npixMin)) {
724 _footprints->push_back(fp);
728 if (i < spans.size()) {
737 typedef detection::FootprintSet::FootprintList::iterator fiterator;
738 for (fiterator ptr = _footprints->begin(), end = _footprints->end(); ptr != end; ++ptr) {
739 findPeaks(*ptr, img, polarity, ThresholdTraitT());
748 template<
typename ImagePixelT>
754 ) : lsst::daf::base::Citizen(typeid(this)),
755 _footprints(new FootprintList()),
756 _region(img.getBBox())
758 typedef float VariancePixelT;
760 findFootprints<ImagePixelT, afw::image::MaskPixel, VariancePixelT, ThresholdLevel_traits>(
776 template <
typename MaskPixelT>
781 ) : lsst::daf::base::Citizen(typeid(this)),
782 _footprints(new FootprintList()),
783 _region(msk.getBBox())
787 findFootprints<MaskPixelT, MaskPixelT, float, ThresholdBitmask_traits>(
793 findFootprints<MaskPixelT, MaskPixelT, float, ThresholdLevel_traits>(
799 throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
800 "You must specify a numerical threshold value with a Mask");
817 template<
typename ImagePixelT,
typename MaskPixelT>
821 std::string
const &planeName,
824 ) : lsst::daf::base::Citizen(typeid(this)),
825 _footprints(new FootprintList()),
827 geom::
Point2I(maskedImg.getX0(), maskedImg.getY0()),
828 geom::
Extent2I(maskedImg.getWidth(), maskedImg.getHeight())
835 findFootprints<ImagePixelT, MaskPixelT, VariancePixelT, ThresholdPixelLevel_traits>(
848 findFootprints<ImagePixelT, MaskPixelT, VariancePixelT, ThresholdLevel_traits>(
862 if (planeName ==
"") {
879 MaskFootprint(MaskT
const& mimage,
882 void operator()(
typename MaskT::xy_locator loc,
int,
int) {
889 MaskFootprint maskit(*maskedImg.
getMask(), bitPlane);
890 for (FootprintList::const_iterator fiter = _footprints->begin();
891 fiter != _footprints->end(); ++fiter
913 enum DIRECTION {DOWN = 0,
921 template<
typename MaskPixelT>
924 typedef std::vector<boost::shared_ptr<Startspan> > Ptr;
927 ~Startspan() {
delete _span; }
929 bool getSpan() {
return _span; }
930 bool Stop() {
return _stop; }
931 DIRECTION getDirection() {
return _direction; }
933 static int detectedPlane;
934 static int stopPlane;
936 detection::Span::Ptr
const _span;
937 DIRECTION _direction;
941 template<
typename MaskPixelT>
942 Startspan<MaskPixelT>::Startspan(detection::Span
const *span,
953 int const y = span->getY() - mask->
getY0();
954 for (
int x = span->getX0() - mask->
getX0(); x <= span->getX1() - mask->
getX0(); x++) {
955 if (mask(x, y, stopPlane)) {
963 template<
typename ImagePixelT,
typename MaskPixelT>
967 _image(image->getImage()),
968 _mask(image->getMask()) {}
971 bool add(detection::Span *span, DIRECTION
const dir,
bool addToMask =
true);
974 double const param = -1);
978 std::vector<typename Startspan<MaskPixelT>::Ptr> _spans;
984 template<
typename ImagePixelT,
typename MaskPixelT>
985 bool StartspanSet<ImagePixelT, MaskPixelT>::add(detection::Span *span,
988 if (dir == RESTART) {
989 if (add(span, UP) || add(span, DOWN,
false)) {
993 typename Startspan<MaskPixelT>::Ptr sspan(
new Startspan<MaskPixelT>(span, dir));
997 _spans.push_back(sspan);
1013 template<
typename ImagePixelT,
typename MaskPixelT>
1014 bool StartspanSet<ImagePixelT, MaskPixelT>::process(
1019 int const row0 = _image->getY0();
1020 int const col0 = _image->getOffsetCols();
1021 int const height = _image->getHeight();
1025 Startspan<MaskPixelT> *sspan = NULL;
1026 for (
auto iter = _spans.begin();
iter != _spans.end();
iter++) {
1028 if (sspan->getDirection() != DONE) {
1031 if (sspan->Stop()) {
1035 if (sspan == NULL || sspan->getDirection() == DONE) {
1038 if (sspan->Stop()) {
1044 DIRECTION
const dir = sspan->getDirection();
1048 int x0 = sspan->getSpan()->getX0() - col0;
1053 int const di = (dir == UP) ? 1 : -1;
1057 double const thresholdVal = threshold.
getValue(param);
1060 for (
int i = sspan->span->y -row0 + di; i < height && i >= 0; i += di) {
1061 pixAccessT imgRow = _image->origin().advance(0, i);
1069 for (
int j = x0 - 1; j >= -1; j--) {
1070 ImagePixelT pixVal = (j < 0) ? thresholdVal - 100 : (polarity ? imgRow[j] : -imgRow[j]);
1071 if (_mask(j, i, Startspan<MaskPixelT>::detectedPlane) || pixVal < threshold) {
1086 for (
int j = nx0 + 1; j <= width; j++) {
1087 ImagePixelT pixVal = (j >= width) ? threshold - 100 :
1088 (polarity ? (F32 ? imgRowF32[j] : imgRowS32[j]) :
1089 (F32 ? -imgRowF32[j] : -imgRowS32[j]));
1090 if ((maskRow[j] & DETECTED) || pixVal < threshold) {
1096 pmSpan
const *sp = pmFootprintAddSpan(fp, i + row0, nx0 + col0, nx1 + col0);
1098 if (add_startspan(startspans, sp, mask, RESTART)) {
1114 for (
int j = nx1 + 1; j <= x1 + 1; j++) {
1115 ImagePixelT pixVal = (j >= width) ? threshold - 100 :
1116 (polarity ? (F32 ? imgRowF32[j] : imgRowS32[j]) : (F32 ? -imgRowF32[j] : -imgRowS32[j]));
1117 if (!(maskRow[j] & DETECTED) && pixVal >= threshold) {
1120 for (; j <= width; j++) {
1121 ImagePixelT pixVal = (j >= width) ? threshold - 100 :
1122 (polarity ? (F32 ? imgRowF32[j] : imgRowS32[j]) :
1123 (F32 ? -imgRowF32[j] : -imgRowS32[j]));
1124 if ((maskRow[j] & DETECTED) || pixVal < threshold) {
1134 sp = pmFootprintAddSpan(fp, i + row0, sx0 + col0, sx1 + col0 - 1);
1135 if (add_startspan(startspans, sp, mask, DONE)) {
1140 sp = pmFootprintAddSpan(fp, i + row0, sx0 + col0, x1 + col0);
1141 if (add_startspan(startspans, sp, mask, DONE)) {
1145 sp = pmFootprintAddSpan(fp, i + row0, x1 + 1 + col0, sx1 + col0 - 1);
1146 if (add_startspan(startspans, sp, mask, RESTART)) {
1153 sp = pmFootprintAddSpan(fp, i + row0, sx0 + col0, sx1 + col0 - 1);
1154 if (add_startspan(startspans, sp, mask, RESTART)) {
1162 if (stop || first ==
false) {
1174 sspan->_direction = DONE;
1175 return stop ?
false :
true;
1196 pmFindFootprintAtPoint(psImage
const *img,
1197 Threshold
const &threshold,
1198 psArray
const *peaks,
1200 assert(img != NULL);
1203 if (img->type.type == PS_TYPE_F32) {
1205 }
else if (img->type.type == PS_TYPE_S32) {
1208 psError(PS_ERR_UNKNOWN,
true,
"Unsupported psImage type: %d", img->type.type);
1211 psF32 *imgRowF32 = NULL;
1212 psS32 *imgRowS32 = NULL;
1214 int const row0 = img->row0;
1215 int const col0 = img->col0;
1216 int const height = img->getHeight();
1217 int const width = img->getWidth();
1223 if (row < 0 || row >= height ||
1224 col < 0 || col >= width) {
1225 psError(PS_ERR_BAD_PARAMETER_VALUE,
true,
1226 "row/col == (%d, %d) are out of bounds [%d--%d, %d--%d]",
1227 row + row0, col + col0, row0, row0 + height - 1, col0, col0 + width - 1);
1231 ImagePixelT pixVal = F32 ? img->data.F32[
row][
col] : img->data.S32[
row][
col];
1232 if (pixVal < threshold) {
1233 return pmFootprintAlloc(0, img);
1236 pmFootprint *fp = pmFootprintAlloc(1 + img->getHeight()/10, img);
1242 psImage *mask = psImageAlloc(width, height, PS_TYPE_MASK);
1243 P_PSIMAGE_SET_ROW0(mask, row0);
1244 P_PSIMAGE_SET_COL0(mask, col0);
1245 psImageInit(mask, INITIAL);
1249 assert (peaks == NULL || peaks->n == 0 || pmIsPeak(peaks->data[0]));
1250 if (peaks != NULL) {
1251 for (
int i = 0; i < peaks->n; i++) {
1252 pmPeak *peak = peaks->data[i];
1253 mask->data.PS_TYPE_MASK_DATA[peak->y - mask->row0][peak->x - mask->col0] |= STOP;
1259 psArray *startspans = psArrayAllocEmpty(1);
1261 imgRowF32 = img->data.F32[
row];
1262 imgRowS32 = img->data.S32[
row];
1263 psMaskType *maskRow = mask->data.PS_TYPE_MASK_DATA[
row];
1266 for (i = col; i >= 0; i--) {
1267 pixVal = F32 ? imgRowF32[i] : imgRowS32[i];
1268 if ((maskRow[i] & DETECTED) || pixVal < threshold) {
1273 for (i = col; i < width; i++) {
1274 pixVal = F32 ? imgRowF32[i] : imgRowS32[i];
1275 if ((maskRow[i] & DETECTED) || pixVal < threshold) {
1280 pmSpan
const *sp = pmFootprintAddSpan(fp, row + row0, i0 + col0 + 1, i1 + col0 - 1);
1282 (void)add_startspan(startspans, sp, mask, RESTART);
1287 while (do_startspan(fp, img, mask, threshold, startspans))
continue;
1304 lsst::daf::base::Citizen(typeid(this)),
1305 _footprints(
PTR(FootprintList)(new FootprintList)), _region(region) {
1314 lsst::daf::base::Citizen(typeid(this)),
1315 _footprints(new FootprintList), _region(rhs._region)
1318 for (FootprintSet::FootprintList::const_iterator ptr = rhs.
_footprints->begin(),
1319 end = rhs.
_footprints->end(); ptr != end; ++ptr) {
1320 _footprints->push_back(
PTR(Footprint)(
new Footprint(**ptr)));
1357 for (FootprintSet::FootprintList::iterator ptr = _footprints->begin(),
1358 end = _footprints->end(); ptr != end; ++ptr
1360 (*ptr)->setRegion(region);
1376 : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1383 throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1384 (
boost::format(
"I cannot grow by negative numbers: %d") % r).str());
1397 : lsst::daf::base::Citizen(typeid(this)), _footprints(new FootprintList), _region(rhs._region)
1403 }
else if (ngrow < 0) {
1404 throw LSST_EXCEPT(lsst::pex::exceptions::InvalidParameterError,
1405 str(
boost::format(
"I cannot grow by negative numbers: %d") % ngrow));
1423 : lsst::daf::base::Citizen(typeid(this)),
1424 _footprints(new FootprintList()),
1425 _region(fs1._region)
1428 throw LSST_EXCEPT(lsst::pex::exceptions::LogicError,
"NOT IMPLEMENTED");
1439 bool const relativeIDs
1447 for (FootprintList::const_iterator fiter = _footprints->begin();
1448 fiter != _footprints->end(); fiter++
1458 foot->insertIntoImage(*im.get(),
id);
1468 template<
typename ImagePixelT,
typename MaskPixelT>
1481 for (FootprintList::iterator ptr = _footprints->begin(),
1482 end = _footprints->end(); ptr != end; ++ptr) {
1490 for (FootprintList::const_iterator i = _footprints->begin(); i != _footprints->end(); ++i) {
1492 r->setFootprint(*i);
1504 #define INSTANTIATE(PIXEL) \
1505 template detection::FootprintSet::FootprintSet( \
1506 image::Image<PIXEL> const &, Threshold const &, int const, bool const); \
1507 template detection::FootprintSet::FootprintSet( \
1508 image::MaskedImage<PIXEL,image::MaskPixel> const &, Threshold const &, \
1509 std::string const &, int const, bool const);\
1510 template void detection::FootprintSet::makeHeavy(image::MaskedImage<PIXEL,image::MaskPixel> const &, \
1511 HeavyFootprintCtrl const *)
ImagePtr getImage(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage's image.
x_iterator row_begin(int y) const
for(FootprintList::const_iterator ptr=feet->begin(), end=feet->end();ptr!=end;++ptr)
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
Internal & getInternal()
Return a reference to the internal vector-of-shared_ptr.
lsst::afw::detection::Footprint Footprint
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.
afw::table::CatalogT< PeakRecord > PeakCatalog
The base class for all image classed (Image, Mask, MaskedImage, ...)
static int addMaskPlane(const std::string &name)
int getIy() const
Convenience accessors for the keys in the minimal schema.
void setMaskPlaneValues(const int plane, const int x0, const int x1, const int y)
Set the bit specified by "planeId" for pixels (x0, y) ... (x1, y)
PixelT Pixel
A pixel in this ImageBase.
boost::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
boost::shared_ptr< Mask > Ptr
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
VariancePtr getVariance(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage's variance.
boost::uint64_t FootprintIdPixel
int getWidth() const
Return the number of columns in the image.
boost::shared_ptr< Footprint > growFootprint(Footprint const &foot, int nGrow, bool isotropic=true)
Use (pixels & (given mask))
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR'd together.
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
bool getPolarity() const
return Threshold's polarity
Represent a 2-dimensional array of bitmask pixels.
float getPeakValue() const
Convenience accessors for the keys in the minimal schema.
A class to manipulate images, masks, and variance as a single object.
if(width!=gim.getWidth()||height!=gim.getHeight()||x0!=gim.getX0()||y0!=gim.getY0())
detection::FootprintSet::FootprintList FootprintList
double getIncludeMultiplier() const
return includeMultiplier
double getValue(const double param=-1) const
#define LSST_EXCEPT(type,...)
MaskPtr getMask(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage's mask.
int resolve_alias(const std::vector< int > &aliases, int id)
Compute Image Statistics.
afw::table::Key< double > b
Record class that contains measurements made on a single exposure.
Implementation of the Class MaskedImage.
int getHeight() const
Return the number of rows in the image.
Record class that represents a peak in a Footprint.
ThresholdType getType() const
return type of threshold
A class to represent a 2-dimensional array of pixels.
Extent< int, 2 > Extent2I
void insert(iterator pos, InputIterator first, InputIterator last, bool deep=false)
Insert an iterator range into the table.
int getIx() const
Convenience accessors for the keys in the minimal schema.
Include files required for standard LSST Exception handling.
size_type size() const
Return the number of elements in the catalog.