8 #include <boost/math/special_functions/round.hpp>
10 using boost::math::iround;
13 namespace det = lsst::afw::detection;
14 namespace deblend = lsst::meas::deblender;
15 namespace geom = lsst::afw::geom;
16 namespace malg = lsst::meas::algorithms;
17 namespace pexLog = lsst::pex::logging;
20 static bool span_ptr_compare(
PTR(det::Span) sp1,
PTR(det::Span) sp2) {
37 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
43 int S = halfsize*2 + 1;
46 xy_loc pix = img.
xy_at(halfsize,halfsize);
47 std::vector<typename xy_loc::cached_location_t> locs;
48 for (
int i=0; i<S; ++i) {
49 for (
int j=0; j<S; ++j) {
50 locs.push_back(pix.cache_location(j-halfsize, i-halfsize));
55 ImagePixelT vals[S*S];
56 for (
int y=halfsize;
y<H-halfsize; ++
y) {
57 xy_loc inpix = img.
xy_at(halfsize,
y), end = img.
xy_at(W-halfsize,
y);
59 inpix != end; ++inpix.x(), ++optr) {
60 for (
int i=0; i<SS; ++i)
61 vals[i] = inpix[locs[i]].
image();
62 std::nth_element(vals, vals+SS/2, vals+SS);
63 optr.image() = vals[SS/2];
64 optr.mask() = inpix.mask();
65 optr.variance() = inpix.variance();
70 for (
int y=0;
y<2*halfsize; ++
y) {
73 iy = H - 1 - (
y-halfsize);
76 for (; iptr != end; ++iptr,++optr)
79 for (
int y=halfsize;
y<H-halfsize; ++
y) {
82 for (; iptr != end; ++iptr,++optr)
87 for (; iptr != end; ++iptr,++optr)
117 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
124 int cx = peak.
getIx();
125 int cy = peak.
getIy();
126 int ix0 = mimg.
getX0();
127 int iy0 = mimg.
getY0();
141 for (s = 0; s <
std::max(DW,DH); s += S) {
143 for (p=0; p<S; p++) {
183 for (
int i=0; i<(8*L); i++, x +=
dx, y +=
dy) {
187 if (i % (2*L) == 0) {
190 dx = ( leg % 2) * (-1 + 2*(leg/2));
192 dy = ((leg+1) % 2) * ( 1 - 2*(leg/2));
195 int px = cx + x - ix0;
196 int py = cy + y - iy0;
198 if (px < 0 || px >= iW || py < 0 || py >= iH)
201 ImagePixelT pix = (*shadowingImg)(px,py);
208 const double A = 0.3;
214 ds0 = (double(y) / double(x)) - A;
217 for (shx=1; shx<=S; shx++) {
218 int xsign = (x>0?1:-1);
220 psx = cx + x + (xsign*shx) - ix0;
221 if (psx < 0 || psx >= iW)
224 for (shy = iround(shx * ds0);
225 shy <= iround(shx * ds1); shy++) {
226 psy = cy + y + xsign*shy - iy0;
227 if (psy < 0 || psy >= iH)
229 (*img)(psx, psy) =
std::min((*img)(psx, psy), pix);
235 ds0 = (double(x) / double(y)) - A;
238 for (shy=1; shy<=S; shy++) {
239 int ysign = (y>0?1:-1);
240 psy = cy + y + (ysign*shy) - iy0;
241 if (psy < 0 || psy >= iH)
244 for (shx = iround(shy * ds0);
245 shx <= iround(shy * ds1); shx++) {
246 psx = cx + x + ysign*shx - ix0;
247 if (psx < 0 || psx >= iW)
249 (*img)(psx, psy) =
std::min((*img)(psx, psy), pix);
256 shadowingImg->operator<<=(*img);
260 static double _get_contrib_r_to_footprint(
int x,
int y,
264 SpanList
const& tspans = tfoot->
getSpans();
265 for (SpanList::const_iterator ts = tspans.begin(); ts < tspans.end(); ++ts) {
274 dx = x - sp->
getX1();
283 minr2 =
std::min(minr2, (
double)(mindx*mindx + dy*dy));
286 return 1. / (1. + minr2);
290 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
296 int strayFluxOptions,
298 std::vector<bool>
const& ispsf,
299 std::vector<int>
const& pkx,
300 std::vector<int>
const& pky,
301 double clipStrayFluxFraction,
311 std::vector<PTR(det::Footprint) > strayfoot;
312 std::vector<std::vector<ImagePixelT> > straypix;
313 std::vector<std::vector<MaskPixelT> > straymask;
314 std::vector<std::vector<VariancePixelT> > strayvar;
316 int ix0 = img.
getX0();
317 int iy0 = img.
getY0();
322 for (
size_t i=0; i<tfoots.size(); ++i) {
324 straypix.push_back(std::vector<ImagePixelT>());
325 straymask.push_back(std::vector<MaskPixelT>());
326 strayvar.push_back(std::vector<VariancePixelT>());
329 bool always = (strayFluxOptions & STRAYFLUX_TO_POINT_SOURCES_ALWAYS);
331 typedef boost::uint16_t itype;
334 if (strayFluxOptions & STRAYFLUX_NEAREST_FOOTPRINT) {
337 typedef boost::uint16_t dtype;
341 std::vector<PTR(det::Footprint)> templist;
342 std::vector<PTR(det::Footprint)>* footlist = &tfoots;
344 if (!always && ispsf.size()) {
348 for (
size_t i=0; i<tfoots.size(); ++i) {
350 templist.push_back(empty);
352 templist.push_back(tfoots[i]);
355 footlist = &templist;
362 const SpanList& spans = foot.
getSpans();
363 for (SpanList::const_iterator s = spans.begin(); s < spans.end(); s++) {
364 int y = (*s)->getY();
365 int x0 = (*s)->getX0();
366 int x1 = (*s)->getX1();
368 tsum->row_begin(y - sumy0) + (x0 - sumx0);
371 double contrib[tfoots.size()];
373 for (
int x = x0; x <= x1; ++
x, ++tsum_it, ++in_it) {
377 if ((*tsum_it > 0) || (*in_it).image() <= 0) {
381 if (strayFluxOptions & STRAYFLUX_R_TO_FOOTPRINT) {
383 for (
size_t i=0; i<tfoots.size(); ++i) {
386 }
else if (strayFluxOptions & STRAYFLUX_NEAREST_FOOTPRINT) {
387 for (
size_t i=0; i<tfoots.size(); ++i) {
390 int i = nearest->get0(x, y);
394 for (
size_t i=0; i<tfoots.size(); ++i) {
399 contrib[i] = 1. / (1. + dx*dx + dy*
dy);
405 bool ptsrcs = always;
407 for (
size_t i=0; i<tfoots.size(); ++i) {
409 if ((!ptsrcs) && ispsf.size() && ispsf[i]) {
412 if (contrib[i] == -1.0) {
413 contrib[i] = _get_contrib_r_to_footprint(x, y, tfoots[i]);
419 STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY)) {
423 for (
size_t i=0; i<tfoots.size(); ++i) {
424 if (contrib[i] == -1.0) {
425 contrib[i] = _get_contrib_r_to_footprint(x, y, tfoots[i]);
432 double strayclip = (clipStrayFluxFraction * csum);
434 for (
size_t i=0; i<tfoots.size(); ++i) {
436 if ((!ptsrcs) && ispsf.size() && ispsf[i]) {
441 if (contrib[i] < strayclip) {
448 for (
size_t i=0; i<tfoots.size(); ++i) {
449 if (contrib[i] == 0.) {
453 double p = (contrib[i] / csum) * (*in_it).image();
457 strayfoot[i]->addSpanInSeries(y, x, x);
458 straypix[i].push_back(p);
459 straymask[i].push_back((*in_it).mask());
460 strayvar[i].push_back((*in_it).variance());
466 for (
size_t i=0; i<tfoots.size(); ++i) {
468 strays.push_back(HeavyFootprintPtrT());
473 HeavyFootprintPtrT heavy(
new HeavyFootprint(*strayfoot[i]));
475 typename std::vector<ImagePixelT>::const_iterator spix;
476 typename std::vector<MaskPixelT>::const_iterator smask;
477 typename std::vector<VariancePixelT>::const_iterator svar;
482 assert((
size_t)strayfoot[i]->getNpix() == straypix[i].size());
484 for (spix = straypix[i].begin(),
485 smask = straymask[i].begin(),
486 svar = strayvar [i].begin(),
488 mpix = heavy->getMaskArray().
begin(),
489 vpix = heavy->getVarianceArray().
begin();
490 spix != straypix[i].end();
491 ++spix, ++smask, ++svar, ++hpix, ++mpix, ++vpix) {
496 strays.push_back(heavy);
501 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
511 for (
size_t i=0; i<timgs.size(); ++i) {
528 tsum->row_begin(y - sumy0) + (copyx0 - sumx0);
529 for (; in_it != inend; ++in_it, ++tsum_it) {
530 *tsum_it +=
std::max((ImagePixelT)0., (*in_it).image());
585 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
586 std::vector<typename PTR(image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>)>
590 std::vector<MaskedImagePtrT> timgs,
593 std::vector<bool>
const& ispsf,
594 std::vector<int>
const& pkx,
595 std::vector<int>
const& pky,
596 std::vector<boost::shared_ptr<typename det::HeavyFootprint<ImagePixelT,MaskPixelT,VariancePixelT> > > & strays,
597 int strayFluxOptions,
598 double clipStrayFluxFraction
602 if (timgs.size() != tfoots.size()) {
603 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
604 (
boost::format(
"Template images must be the same length as template footprints (%d vs %d)")
605 % timgs.size() % tfoots.size()).str());
608 for (
size_t i=0; i<timgs.size(); ++i) {
609 if (!timgs[i]->getBBox().contains(tfoots[i]->getBBox())) {
610 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
611 "Template image MUST contain template footprint");
614 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
615 "Image bbox MUST contain parent footprint");
623 std::vector<MaskedImagePtrT> portions;
626 "lsst.meas.deblender.apportionFlux");
627 bool findStrayFlux = (strayFluxOptions & ASSIGN_STRAYFLUX);
629 int ix0 = img.
getX0();
630 int iy0 = img.
getY0();
638 if (!tsum->getBBox().contains(foot.
getBBox())) {
639 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
640 "Template sum image MUST contain parent footprint");
647 _sum_templates(timgs, tsum);
650 for (
size_t i=0; i<timgs.size(); ++i) {
654 port->setXY0(timg->getXY0());
655 portions.push_back(port);
668 timg->row_begin(y - ty0) + (copyx0 - tx0);
671 tsum->row_begin(y - sumy0) + (copyx0 - sumx0);
673 port->row_begin(y - ty0) + (copyx0 - tx0);
674 for (; tptr != tend; ++tptr, ++in_it, ++out_it, ++tsum_it) {
678 double frac =
std::max((ImagePixelT)0., (*tptr).image()) / (*tsum_it);
682 out_it.mask() = (*in_it).mask();
683 out_it.variance() = (*in_it).variance();
684 out_it.image() = (*in_it).image() * frac;
690 if ((ispsf.size() > 0) && (ispsf.size() != timgs.size())) {
691 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
692 (
boost::format(
"'ispsf' must be the same length as templates (%d vs %d)")
693 % ispsf.size() % timgs.size()).str());
695 if ((pkx.size() != timgs.size()) || (pky.size() != timgs.size())) {
696 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
697 (
boost::format(
"'pkx' and 'pky' must be the same length as templates (%d,%d vs %d)")
698 % pkx.size() % pky.size() % timgs.size()).str());
700 _find_stray_flux(foot, tsum, img, strayFluxOptions, tfoots,
701 ispsf, pkx, pky, clipStrayFluxFraction, strays);
723 int cx,
int cy,
bool forward=
true)
734 return _real == other;
737 return _real != other;
740 return _real <= other;
742 bool operator<(
const SpanList::const_iterator & other) {
743 return _real < other;
746 return _real >= other;
748 bool operator>(
const SpanList::const_iterator & other) {
749 return _real > other;
758 return !(*
this == other);
785 return (*_real)->getX0() -
_cx;
787 return _cx - (*_real)->getX1();
792 return (*_real)->getX1() -
_cx;
794 return _cx - (*_real)->getX0();
798 return std::abs((*_real)->getY() -
_cy);
801 return (*_real)->getX0();
804 return (*_real)->getX1();
807 return (*_real)->getY();
869 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
871 deblend::BaselineUtils<ImagePixelT,MaskPixelT,VariancePixelT>::
879 const SpanList spans = foot.getSpans();
880 assert(foot.isNormalized());
883 "lsst.meas.deblender.symmetrizeFootprint");
886 PTR(det::Span) target(
new det::Span(cy, cx, cx));
887 SpanList::const_iterator peakspan =
888 std::lower_bound(spans.begin(), spans.end(), target, span_ptr_compare);
893 if (peakspan == spans.begin()) {
895 if (!sp->contains(cx, cy)) {
897 "Failed to find span containing (%i,%i): before the beginning of this footprint", cx, cy);
904 if (!(sp->contains(cx,cy))) {
906 log.warnf(
"Failed to find span containing (%i,%i): nearest is %i, [%i,%i]. "
907 "Footprint bbox is [%i,%i],[%i,%i]",
908 cx, cy, sp->getY(), sp->getX0(), sp->getX1(),
913 log.debugf(
"Span containing (%i,%i): (x=[%i,%i], y=%i)",
914 cx, cy, sp->getX0(), sp->getX1(), sp->getY());
953 int fdxlo = fwd.
dxlo();
954 int bdxlo = back.
dxlo();
961 for (fend = fwd; fend.
notDone(); ++fend) {
965 for (bend = back; bend.
notDone(); ++bend) {
970 log.debugf(
"dy=%i, fy=%i, fx=[%i, %i], by=%i, fx=[%i, %i], fdx=%i, bdx=%i",
971 dy, fy, fwd.
x0(), fwd.
x1(), by, back.
x0(), back.
x1(),
976 log.debugf(
"Advancing forward.");
980 while ((fwd != fend) && (fwd.
dxhi() < bdxlo)) {
983 log.debugf(
"Reached fend");
985 log.debugf(
"Advanced to forward span %i, [%i, %i]",
986 fy, fwd.
x0(), fwd.
x1());
989 }
else if (fdxlo > bdxlo) {
990 log.debugf(
"Advancing backward.");
994 while ((back != bend) && (back.
dxhi() < fdxlo)) {
997 log.debugf(
"Reached bend");
999 log.debugf(
"Advanced to backward span %i, [%i, %i]",
1000 by, back.
x0(), back.
x1());
1005 if ((back == bend) || (fwd == fend)) {
1009 log.debugf(
"Reached bend");
1012 log.debugf(
"Reached fend");
1024 log.debugf(
"Adding span fwd %i, [%i, %i], back %i, [%i, %i]",
1025 fy, cx+dxlo, cx+dxhi, by, cx-dxhi, cx-dxlo);
1026 sfoot->addSpan(fy, cx + dxlo, cx + dxhi);
1027 sfoot->addSpan(by, cx - dxhi, cx - dxlo);
1034 log.debugf(
"Stepped to fend");
1036 log.debugf(
"Stepped forward to span %i, [%i, %i]",
1037 fwd.
y(), fwd.
x0(), fwd.
x1());
1042 log.debugf(
"Stepped to bend");
1044 log.debugf(
"Stepped backward to span %i, [%i, %i]",
1045 back.
y(), back.
x0(), back.
x1());
1049 if ((back == bend) || (fwd == fend)) {
1052 log.debugf(
"Reached bend");
1055 log.debugf(
"Reached fend");
1083 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1084 std::pair<typename PTR(lsst::afw::image::MaskedImage<ImagePixelT,MaskPixelT,VariancePixelT>),
1094 bool* patchedEdges) {
1099 *patchedEdges =
false;
1101 int cx = peak.
getIx();
1102 int cy = peak.
getIy();
1105 "lsst.meas.deblender.symmetricFootprint");
1109 return std::pair<MaskedImagePtrT, FootprintPtrT>(
MaskedImagePtrT(), sfoot);
1111 const SpanList spans = sfoot->getSpans();
1114 bool touchesEdge =
false;
1116 log.
debugf(
"Checking footprint for EDGE bits");
1119 MaskPixelT edgebit = mask->getPlaneBitMask(
"EDGE");
1120 for (SpanList::const_iterator fwd=spans.begin();
1121 fwd != spans.end(); ++fwd) {
1122 int x0 = (*fwd)->getX0();
1123 int x1 = (*fwd)->getX1();
1125 mask->x_at(x0 - mask->getX0(), (*fwd)->getY() - mask->getY0());
1126 for (
int x=x0; x<=x1; ++
x, ++xiter) {
1127 if ((*xiter) & edgebit) {
1136 log.
debugf(
"Footprint includes an EDGE pixel.");
1144 MaskPixelT symm1sig = img.
getMask()->getPlaneBitMask(
"SYMM_1SIG");
1145 MaskPixelT symm3sig = img.
getMask()->getPlaneBitMask(
"SYMM_3SIG");
1147 SpanList::const_iterator fwd = spans.begin();
1148 SpanList::const_iterator back = spans.end()-1;
1152 MaskPtrT targetmask = timg->getMask();
1154 for (; fwd <= back; fwd++, back--) {
1155 int fy = (*fwd)->getY();
1156 int by = (*back)->getY();
1158 for (
int fx=(*fwd)->getX0(), bx=(*back)->getX1();
1159 fx <= (*fwd)->getX1();
1169 ImagePixelT pixf = theimg->get0(fx, fy);
1170 ImagePixelT pixb = theimg->get0(bx, by);
1171 ImagePixelT pix =
std::min(pixf, pixb);
1173 pix =
std::max(pix, static_cast<ImagePixelT>(0));
1175 targetimg->set0(fx, fy, pix);
1176 targetimg->set0(bx, by, pix);
1182 if (pixf >= pix + 1.*sigma1) {
1183 targetmask->set0(fx, fy, targetmask->get0(fx, fy) | symm1sig);
1184 if (pixf >= pix + 3.*sigma1) {
1185 targetmask->set0(fx, fy, targetmask->get0(fx, fy) | symm3sig);
1188 if (pixb >= pix + 1.*sigma1) {
1189 targetmask->set0(bx, by, targetmask->get0(bx, by) | symm1sig);
1190 if (pixb >= pix + 3.*sigma1) {
1191 targetmask->set0(bx, by, targetmask->get0(bx, by) | symm3sig);
1209 log.
debugf(
"Footprint touches EDGE: start bbox [%i,%i],[%i,%i]",
1212 const SpanList ospans = foot.
getSpans();
1213 for (fwd = ospans.begin(); fwd != ospans.end(); ++fwd) {
1214 int y = (*fwd)->getY();
1215 int x = (*fwd)->getX0();
1217 int ym = cy + (cy -
y);
1218 int xm = cx + (cx -
x);
1222 x = (*fwd)->getX1();
1228 log.
debugf(
"Footprint touches EDGE: grown bbox [%i,%i],[%i,%i]",
1235 log.
debugf(
"Symmetric footprint spans:");
1236 const SpanList sspans = sfoot->getSpans();
1237 for (fwd = sspans.begin(); fwd != sspans.end(); ++fwd) {
1238 log.
debugf(
" %s", (*fwd)->toString().c_str());
1243 for (fwd = ospans.begin(); fwd != ospans.end(); ++fwd) {
1244 int y = (*fwd)->getY();
1245 int x0 = (*fwd)->getX0();
1246 int x1 = (*fwd)->getX1();
1248 int ym = cy + (cy -
y);
1249 int xm0 = cx + (cx - x0);
1250 int xm1 = cx + (cx - x1);
1261 x0 = cx + (cx - (imbb.
getMinX() - 1));
1264 x1 = cx + (cx - (imbb.
getMaxX() + 1));
1266 log.
debugf(
"Span y=%i, x=[%i,%i] has mirror (%i,[%i,%i]) out-of-bounds; clipped to %i,[%i,%i]",
1267 y, (*fwd)->getX0(), (*fwd)->getX1(), ym, xm1, xm0,
y, x0, x1);
1271 timg2->x_at(x0 - timg2->getX0(), y - timg2->getY0());
1272 for (
int x=x0; x<=x1; ++
x, ++outiter, ++initer) {
1275 sfoot->addSpan(y, x0, x1);
1281 *patchedEdges = touchesEdge;
1282 return std::pair<MaskedImagePtrT, FootprintPtrT>(timg, sfoot);
1289 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1294 ImagePixelT thresh) {
1298 "lsst.meas.deblender.hasSignificantFluxAtEdge");
1304 const SpanList spans = sfoot->
getSpans();
1305 for (SpanList::const_iterator sp = spans.
begin();
1306 sp != spans.
end(); ++sp) {
1314 int y = (*sp)->getY();
1315 int x0 = (*sp)->getX0();
1316 int x1 = (*sp)->getX1();
1319 for (xiter = img->x_at(x0 - img->getX0(), y - img->getY0()), x=x0;
1320 x<=x1; ++
x, ++xiter) {
1324 if (*xiter < thresh)
1329 if ((x != x0) && (x != x1) &&
1335 log.
debugf(
"Found significant template-edge pixel: %i,%i = %f > %f",
1336 x, y, (
float)*xiter, (
float)thresh);
1347 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1348 boost::shared_ptr<det::Footprint>
1352 ImagePixelT thresh) {
1355 "lsst.meas.deblender.getSignificantEdgePixels");
1357 const SpanList spans = sfoot->
getSpans();
1358 SpanList::const_iterator sp;
1361 for (sp = spans.begin(); sp != spans.end(); sp++) {
1362 int y = (*sp)->getY();
1363 int x0 = (*sp)->getX0();
1364 int x1 = (*sp)->getX1();
1367 for (xiter = img->x_at(x0 - img->getX0(), y - img->getY0()), x=x0;
1368 x<=x1; ++
x, ++xiter) {
1369 if (*xiter < thresh)
1374 if ((x != x0) && (x != x1) &&
1380 log.
debugf(
"Found significant edge pixel: %i,%i = %f > thresh %g",
1381 x, y, (
float)*xiter, (
float)thresh);
1382 edgepix->addSpanInSeries(y, x, x);
x_iterator row_begin(int y) const
Return an x_iterator to the start of the image.
void nearestFootprint(std::vector< boost::shared_ptr< Footprint >> const &foots, lsst::afw::image::Image< boost::uint16_t >::Ptr argmin, lsst::afw::image::Image< boost::uint16_t >::Ptr dist)
int getIx() const
Return the column pixel position.
Extent2I const getDimensions() const
bool operator>=(const SpanList::const_iterator &other)
bool contains(Point2I const &point) const
Return true if the box contains the point.
int getX0() const
Return the starting x-value.
RelativeSpanIterator(SpanList::const_iterator const &real, SpanList const &arr, int cx, int cy, bool forward=true)
A range of pixels within one row of an Image.
void include(Point2I const &point)
Expand this to ensure that this->contains(point).
int getHeight() const
Return the number of rows in the image.
bool operator<(const SpanList::const_iterator &other)
_const_view_t::x_iterator const_x_iterator
A const iterator for traversing the pixels in a row.
bool operator==(RelativeSpanIterator &other)
static std::pair< MaskedImagePtrT, FootprintPtrT > buildSymmetricTemplate(MaskedImageT const &img, lsst::afw::detection::Footprint const &foot, lsst::afw::detection::Peak const &pk, double sigma1, bool minZero, bool patchEdges, bool *patchedEdges)
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
x_iterator row_end(int y) const
Return an x_iterator to the end of the image.
bool operator==(const SpanList::const_iterator &other)
geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
boost::shared_ptr< lsst::afw::detection::Footprint > FootprintPtrT
ImagePtr getImage(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage's image.
a place to record messages and descriptions of the state of processing.
static Log & getDefaultLog()
An integer coordinate rectangle.
xy_locator xy_at(int x, int y) const
Return an xy_locator at the point (x, y)
table::Key< table::Array< Kernel::Pixel > > image
An iterator to the MaskedImage.
A locator for the MaskedImage.
Iterator begin() const
Return an iterator to the first pixel in the Span.
x_iterator x_at(int x, int y) const
Return an x_iterator at the point (x, y)
int getY() const
Return the y-value.
boost::shared_ptr< lsst::afw::image::Mask< MaskPixelT > > MaskPtrT
void debugf(const char *fmt,...)
MaskPtr getMask(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage's mask.
A class to manipulate images, masks, and variance as a single object.
SpanList::const_iterator _real
det::Footprint::SpanList SpanList
static bool hasSignificantFluxAtEdge(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
bool operator<=(const SpanList::const_iterator &other)
static void _sum_templates(std::vector< MaskedImagePtrT > timgs, ImagePtrT tsum)
#define LSST_EXCEPT(type,...)
static void _find_stray_flux(lsst::afw::detection::Footprint const &foot, ImagePtrT tsum, MaskedImageT const &img, int strayFluxOptions, std::vector< boost::shared_ptr< lsst::afw::detection::Footprint > > tfoots, std::vector< bool > const &ispsf, std::vector< int > const &pkx, std::vector< int > const &pky, double clipStrayFluxFraction, std::vector< boost::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays)
static boost::shared_ptr< lsst::afw::detection::Footprint > getSignificantEdgePixels(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
SpanList::const_iterator _end
afw::table::Key< double > sigma1
static void medianFilter(MaskedImageT const &img, MaskedImageT &outimg, int halfsize)
lsst::afw::detection::Footprint Footprint
bool operator>(const SpanList::const_iterator &other)
int getWidth() const
Return the number of columns in the image.
bool operator!=(RelativeSpanIterator &other)
ExpressionTraits< Derived >::Iterator Iterator
Nested expression or element iterator.
void clip(Box2I const &other)
Shrink this to ensure that other.contains(*this).
int getX1() const
Return the ending x-value.
bool operator!=(const SpanList::const_iterator &other)
RelativeSpanIterator operator++()
RelativeSpanIterator operator++(int dummy)
static void makeMonotonic(MaskedImageT &img, lsst::afw::detection::Peak const &pk)
boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT > MaskedImagePtrT
Iterator end() const
Return an iterator to one past the last pixel in the Span.
boost::shared_ptr< lsst::afw::detection::HeavyFootprint< ImagePixelT > MaskPixelT, VariancePixelT > HeavyFootprintPtrT
void copyWithinFootprint(Footprint const &foot, boost::shared_ptr< ImageOrMaskedImageT > const input, boost::shared_ptr< ImageOrMaskedImageT > output)
boost::shared_ptr< lsst::afw::image::Image< ImagePixelT > > ImagePtrT
A const locator for the MaskedImage.
Iterator begin() const
Return an Iterator to the beginning of the array.