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 pexLog = lsst::pex::logging;
19 static bool span_ptr_compare(
PTR(det::Span) sp1,
PTR(det::Span) sp2) {
36 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
42 int S = halfsize*2 + 1;
45 xy_loc pix = img.
xy_at(halfsize,halfsize);
46 std::vector<typename xy_loc::cached_location_t> locs;
47 for (
int i=0; i<S; ++i) {
48 for (
int j=0; j<S; ++j) {
49 locs.push_back(pix.cache_location(j-halfsize, i-halfsize));
54 ImagePixelT vals[S*S];
55 for (
int y=halfsize;
y<H-halfsize; ++
y) {
56 xy_loc inpix = img.
xy_at(halfsize,
y), end = img.
xy_at(W-halfsize,
y);
58 inpix != end; ++inpix.x(), ++optr) {
59 for (
int i=0; i<SS; ++i)
60 vals[i] = inpix[locs[i]];
61 std::nth_element(vals, vals+SS/2, vals+SS);
67 for (
int y=0;
y<2*halfsize; ++
y) {
70 iy = H - 1 - (
y-halfsize);
73 for (; iptr != end; ++iptr,++optr)
76 for (
int y=halfsize;
y<H-halfsize; ++
y) {
79 for (; iptr != end; ++iptr,++optr)
84 for (; iptr != end; ++iptr,++optr)
114 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
121 int cx = peak.
getIx();
122 int cy = peak.
getIy();
123 int ix0 = img.
getX0();
124 int iy0 = img.
getY0();
137 for (s = 0; s < std::max(DW,DH); s += S) {
139 for (p=0; p<S; p++) {
179 for (
int i=0; i<(8*L); i++, x += dx, y += dy) {
183 if (i % (2*L) == 0) {
186 dx = ( leg % 2) * (-1 + 2*(leg/2));
188 dy = ((leg+1) % 2) * ( 1 - 2*(leg/2));
191 int px = cx + x - ix0;
192 int py = cy + y - iy0;
194 if (px < 0 || px >= iW || py < 0 || py >= iH)
197 ImagePixelT pix = (*shadowingImg)(px,py);
204 const double A = 0.3;
210 ds0 = (double(y) / double(x)) - A;
213 for (shx=1; shx<=S; shx++) {
214 int xsign = (x>0?1:-1);
216 psx = cx + x + (xsign*shx) - ix0;
217 if (psx < 0 || psx >= iW)
220 for (shy = iround(shx * ds0);
221 shy <= iround(shx * ds1); shy++) {
222 psy = cy + y + xsign*shy - iy0;
223 if (psy < 0 || psy >= iH)
225 img(psx, psy) = std::min(img(psx, psy), pix);
231 ds0 = (double(x) / double(y)) - A;
234 for (shy=1; shy<=S; shy++) {
235 int ysign = (y>0?1:-1);
236 psy = cy + y + (ysign*shy) - iy0;
237 if (psy < 0 || psy >= iH)
240 for (shx = iround(shy * ds0);
241 shx <= iround(shy * ds1); shx++) {
242 psx = cx + x + ysign*shx - ix0;
243 if (psx < 0 || psx >= iW)
245 img(psx, psy) = std::min(img(psx, psy), pix);
252 shadowingImg->operator<<=(img);
256 static double _get_contrib_r_to_footprint(
int x,
int y,
260 SpanList
const& tspans = tfoot->
getSpans();
261 for (SpanList::const_iterator ts = tspans.begin(); ts < tspans.end(); ++ts) {
270 dx = x - sp->
getX1();
278 int dy = sp->
getY() -
y;
279 minr2 = std::min(minr2, (
double)(mindx*mindx + dy*dy));
282 return 1. / (1. + minr2);
286 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
292 int strayFluxOptions,
294 std::vector<bool>
const& ispsf,
295 std::vector<int>
const& pkx,
296 std::vector<int>
const& pky,
297 double clipStrayFluxFraction,
307 std::vector<PTR(det::Footprint) > strayfoot;
308 std::vector<std::vector<ImagePixelT> > straypix;
309 std::vector<std::vector<MaskPixelT> > straymask;
310 std::vector<std::vector<VariancePixelT> > strayvar;
312 int ix0 = img.
getX0();
313 int iy0 = img.
getY0();
318 for (
size_t i=0; i<tfoots.size(); ++i) {
320 straypix.push_back(std::vector<ImagePixelT>());
321 straymask.push_back(std::vector<MaskPixelT>());
322 strayvar.push_back(std::vector<VariancePixelT>());
325 bool always = (strayFluxOptions & STRAYFLUX_TO_POINT_SOURCES_ALWAYS);
327 typedef boost::uint16_t itype;
330 if (strayFluxOptions & STRAYFLUX_NEAREST_FOOTPRINT) {
333 typedef boost::uint16_t dtype;
337 std::vector<PTR(det::Footprint)> templist;
338 std::vector<PTR(det::Footprint)>* footlist = &tfoots;
340 if (!always && ispsf.size()) {
344 for (
size_t i=0; i<tfoots.size(); ++i) {
346 templist.push_back(empty);
348 templist.push_back(tfoots[i]);
351 footlist = &templist;
358 const SpanList& spans = foot.
getSpans();
359 for (SpanList::const_iterator s = spans.begin(); s < spans.end(); s++) {
360 int y = (*s)->getY();
361 int x0 = (*s)->getX0();
362 int x1 = (*s)->getX1();
364 tsum->row_begin(y - sumy0) + (x0 - sumx0);
367 double contrib[tfoots.size()];
369 for (
int x = x0; x <= x1; ++
x, ++tsum_it, ++in_it) {
373 if ((*tsum_it > 0) || (*in_it).image() <= 0) {
377 if (strayFluxOptions & STRAYFLUX_R_TO_FOOTPRINT) {
379 for (
size_t i=0; i<tfoots.size(); ++i) {
382 }
else if (strayFluxOptions & STRAYFLUX_NEAREST_FOOTPRINT) {
383 for (
size_t i=0; i<tfoots.size(); ++i) {
386 int i = nearest->get0(x, y);
390 for (
size_t i=0; i<tfoots.size(); ++i) {
395 contrib[i] = 1. / (1. + dx*dx + dy*dy);
401 bool ptsrcs = always;
403 for (
size_t i=0; i<tfoots.size(); ++i) {
405 if ((!ptsrcs) && ispsf.size() && ispsf[i]) {
408 if (contrib[i] == -1.0) {
409 contrib[i] = _get_contrib_r_to_footprint(x, y, tfoots[i]);
415 STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY)) {
419 for (
size_t i=0; i<tfoots.size(); ++i) {
420 if (contrib[i] == -1.0) {
421 contrib[i] = _get_contrib_r_to_footprint(x, y, tfoots[i]);
428 double strayclip = (clipStrayFluxFraction * csum);
430 for (
size_t i=0; i<tfoots.size(); ++i) {
432 if ((!ptsrcs) && ispsf.size() && ispsf[i]) {
437 if (contrib[i] < strayclip) {
444 for (
size_t i=0; i<tfoots.size(); ++i) {
445 if (contrib[i] == 0.) {
449 double p = (contrib[i] / csum) * (*in_it).image();
453 strayfoot[i]->addSpanInSeries(y, x, x);
454 straypix[i].push_back(p);
455 straymask[i].push_back((*in_it).mask());
456 strayvar[i].push_back((*in_it).variance());
462 for (
size_t i=0; i<tfoots.size(); ++i) {
464 strays.push_back(HeavyFootprintPtrT());
469 HeavyFootprintPtrT heavy(
new HeavyFootprint(*strayfoot[i]));
471 typename std::vector<ImagePixelT>::const_iterator spix;
472 typename std::vector<MaskPixelT>::const_iterator smask;
473 typename std::vector<VariancePixelT>::const_iterator svar;
478 assert((
size_t)strayfoot[i]->getNpix() == straypix[i].size());
480 for (spix = straypix[i].begin(),
481 smask = straymask[i].begin(),
482 svar = strayvar [i].begin(),
484 mpix = heavy->getMaskArray().
begin(),
485 vpix = heavy->getVarianceArray().
begin();
486 spix != straypix[i].end();
487 ++spix, ++smask, ++svar, ++hpix, ++mpix, ++vpix) {
492 strays.push_back(heavy);
497 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
507 for (
size_t i=0; i<timgs.size(); ++i) {
523 tsum->row_begin(y - sumy0) + (copyx0 - sumx0);
524 for (; in_it != inend; ++in_it, ++tsum_it) {
525 *tsum_it += std::max((ImagePixelT)0., static_cast<ImagePixelT>(*in_it));
580 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
581 std::vector<typename PTR(image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>)>
585 std::vector<ImagePtrT> timgs,
588 std::vector<bool>
const& ispsf,
589 std::vector<int>
const& pkx,
590 std::vector<int>
const& pky,
591 std::vector<boost::shared_ptr<typename det::HeavyFootprint<ImagePixelT,MaskPixelT,VariancePixelT> > > & strays,
592 int strayFluxOptions,
593 double clipStrayFluxFraction
597 if (timgs.size() != tfoots.size()) {
598 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
599 (
boost::format(
"Template images must be the same length as template footprints (%d vs %d)")
600 % timgs.size() % tfoots.size()).str());
603 for (
size_t i=0; i<timgs.size(); ++i) {
604 if (!timgs[i]->getBBox().contains(tfoots[i]->getBBox())) {
605 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
606 "Template image MUST contain template footprint");
609 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
610 "Image bbox MUST contain parent footprint");
618 std::vector<MaskedImagePtrT> portions;
621 "lsst.meas.deblender.apportionFlux");
622 bool findStrayFlux = (strayFluxOptions & ASSIGN_STRAYFLUX);
624 int ix0 = img.
getX0();
625 int iy0 = img.
getY0();
633 if (!tsum->getBBox().contains(foot.
getBBox())) {
634 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
635 "Template sum image MUST contain parent footprint");
642 _sum_templates(timgs, tsum);
645 for (
size_t i=0; i<timgs.size(); ++i) {
649 port->setXY0(timg->getXY0());
650 portions.push_back(port);
663 timg->row_begin(y - ty0) + (copyx0 - tx0);
666 tsum->row_begin(y - sumy0) + (copyx0 - sumx0);
668 port->row_begin(y - ty0) + (copyx0 - tx0);
669 for (; tptr != tend; ++tptr, ++in_it, ++out_it, ++tsum_it) {
673 double frac = std::max((ImagePixelT)0., static_cast<ImagePixelT>(*tptr)) / (*tsum_it);
678 out_it.variance() = (*in_it).variance()*frac;
679 out_it.image() = (*in_it).image() * frac;
685 if ((ispsf.size() > 0) && (ispsf.size() != timgs.size())) {
686 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
687 (
boost::format(
"'ispsf' must be the same length as templates (%d vs %d)")
688 % ispsf.size() % timgs.size()).str());
690 if ((pkx.size() != timgs.size()) || (pky.size() != timgs.size())) {
691 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
692 (
boost::format(
"'pkx' and 'pky' must be the same length as templates (%d,%d vs %d)")
693 % pkx.size() % pky.size() % timgs.size()).str());
695 _find_stray_flux(foot, tsum, img, strayFluxOptions, tfoots,
696 ispsf, pkx, pky, clipStrayFluxFraction, strays);
718 int cx,
int cy,
bool forward=
true)
729 return _real == other;
732 return _real != other;
735 return _real <= other;
737 bool operator<(
const SpanList::const_iterator & other) {
738 return _real < other;
741 return _real >= other;
743 bool operator>(
const SpanList::const_iterator & other) {
744 return _real > other;
753 return !(*
this == other);
780 return (*_real)->getX0() -
_cx;
782 return _cx - (*_real)->getX1();
787 return (*_real)->getX1() -
_cx;
789 return _cx - (*_real)->getX0();
793 return std::abs((*_real)->getY() -
_cy);
796 return (*_real)->getX0();
799 return (*_real)->getX1();
802 return (*_real)->getY();
864 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
866 deblend::BaselineUtils<ImagePixelT,MaskPixelT,VariancePixelT>::
874 const SpanList spans = foot.getSpans();
875 assert(foot.isNormalized());
878 "lsst.meas.deblender.symmetrizeFootprint");
881 PTR(det::Span) target(
new det::Span(cy, cx, cx));
882 SpanList::const_iterator peakspan =
883 std::upper_bound(spans.begin(), spans.end(), target, span_ptr_compare);
889 if (peakspan == spans.begin()) {
891 if (!sp->contains(cx, cy)) {
893 "Failed to find span containing (%i,%i): before the beginning of this footprint", cx, cy);
900 if (!sp->contains(cx, cy)) {
903 if (!sp->contains(cx, cy)) {
905 log.warnf(
"Failed to find span containing (%i,%i): nearest is %i, [%i,%i]. "
906 "Footprint bbox is [%i,%i],[%i,%i]",
907 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");
1021 int dxlo = std::max(fwd.
dxlo(), back.
dxlo());
1022 int dxhi = std::min(fwd.
dxhi(), back.
dxhi());
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");
1080 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1081 std::pair<typename PTR(lsst::afw::image::Image<ImagePixelT>),
1091 bool* patchedEdges) {
1096 *patchedEdges =
false;
1098 int cx = peak.
getIx();
1099 int cy = peak.
getIy();
1102 "lsst.meas.deblender.symmetricFootprint");
1105 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
"Image too small for footprint");
1110 return std::pair<ImagePtrT, FootprintPtrT>(
ImagePtrT(), sfoot);
1114 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
1115 "Image too small for symmetrized footprint");
1117 const SpanList spans = sfoot->getSpans();
1120 bool touchesEdge =
false;
1122 log.
debugf(
"Checking footprint for EDGE bits");
1125 MaskPixelT edgebit = mask->getPlaneBitMask(
"EDGE");
1126 for (SpanList::const_iterator fwd=spans.begin();
1127 fwd != spans.end(); ++fwd) {
1128 int x0 = (*fwd)->getX0();
1129 int x1 = (*fwd)->getX1();
1131 mask->x_at(x0 - mask->getX0(), (*fwd)->getY() - mask->getY0());
1132 for (
int x=x0; x<=x1; ++
x, ++xiter) {
1133 if ((*xiter) & edgebit) {
1142 log.
debugf(
"Footprint includes an EDGE pixel.");
1150 SpanList::const_iterator fwd = spans.begin();
1151 SpanList::const_iterator back = spans.end()-1;
1155 for (; fwd <= back; fwd++, back--) {
1156 int fy = (*fwd)->getY();
1157 int by = (*back)->getY();
1159 for (
int fx=(*fwd)->getX0(), bx=(*back)->getX1();
1160 fx <= (*fwd)->getX1();
1174 ImagePixelT pixf = theimg->get0(fx, fy);
1175 ImagePixelT pixb = theimg->get0(bx, by);
1176 ImagePixelT pix = std::min(pixf, pixb);
1178 pix = std::max(pix, static_cast<ImagePixelT>(0));
1180 targetimg->set0(fx, fy, pix);
1181 targetimg->set0(bx, by, pix);
1198 log.
debugf(
"Footprint touches EDGE: start bbox [%i,%i],[%i,%i]",
1201 const SpanList ospans = foot.
getSpans();
1202 for (fwd = ospans.begin(); fwd != ospans.end(); ++fwd) {
1203 int y = (*fwd)->getY();
1204 int x = (*fwd)->getX0();
1206 int ym = cy + (cy -
y);
1207 int xm = cx + (cx -
x);
1211 x = (*fwd)->getX1();
1217 log.
debugf(
"Footprint touches EDGE: grown bbox [%i,%i],[%i,%i]",
1224 log.
debugf(
"Symmetric footprint spans:");
1225 const SpanList sspans = sfoot->getSpans();
1226 for (fwd = sspans.begin(); fwd != sspans.end(); ++fwd) {
1227 log.
debugf(
" %s", (*fwd)->toString().c_str());
1232 for (fwd = ospans.begin(); fwd != ospans.end(); ++fwd) {
1233 int y = (*fwd)->getY();
1234 int x0 = (*fwd)->getX0();
1235 int x1 = (*fwd)->getX1();
1237 int ym = cy + (cy -
y);
1238 int xm0 = cx + (cx -
x0);
1239 int xm1 = cx + (cx - x1);
1250 x0 = cx + (cx - (imbb.
getMinX() - 1));
1253 x1 = cx + (cx - (imbb.
getMaxX() + 1));
1255 log.
debugf(
"Span y=%i, x=[%i,%i] has mirror (%i,[%i,%i]) out-of-bounds; clipped to %i,[%i,%i]",
1256 y, (*fwd)->getX0(), (*fwd)->getX1(), ym, xm1, xm0,
y,
x0, x1);
1260 targetimg2->x_at(x0 - targetimg2->getX0(), y - targetimg2->getY0());
1261 for (
int x=x0; x<=x1; ++
x, ++outiter, ++initer) {
1262 *outiter = initer.
image();
1264 sfoot->addSpan(y, x0, x1);
1267 targetimg = targetimg2;
1270 *patchedEdges = touchesEdge;
1271 return std::pair<ImagePtrT, FootprintPtrT>(targetimg, sfoot);
1278 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1283 ImagePixelT thresh) {
1287 "lsst.meas.deblender.hasSignificantFluxAtEdge");
1294 const SpanList spans = edge->getSpans();
1295 for (SpanList::const_iterator sp = spans.
begin(); sp != spans.
end(); ++sp) {
1296 int const y = (*sp)->getY();
1297 int const x0 = (*sp)->getX0();
1298 int const x1 = (*sp)->getX1();
1301 for (xiter = img->x_at(x0 - img->getX0(), y - img->getY0()), x=x0; x<=x1; ++
x, ++xiter) {
1302 if (*xiter >= thresh) {
1314 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1315 boost::shared_ptr<det::Footprint>
1319 ImagePixelT thresh) {
1321 "lsst.meas.deblender.getSignificantEdgePixels");
1327 int const x0 = img->getX0(),
y0 = img->getY0();
1329 for (det::Footprint::SpanList::const_iterator ss = edges->getSpans().begin();
1330 ss != edges->getSpans().end(); ++ss) {
1332 int const y = span.
getY();
1333 int x = span.
getX0();
1335 bool onSpan =
false;
1338 if (*iter >= thresh) {
1341 }
else if (onSpan) {
1343 significant->addSpanInSeries(y, xSpan, x - 1);
1347 significant->addSpanInSeries(y, xSpan, span.
getX1());
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)
Ref< MaskPixelT >::type mask()
Return (a reference to) the mask part of the Pixel pointed at by the iterator.
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.
Include files required for standard LSST Exception handling.
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).
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)
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
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.
MaskPixelT mask() const
Return the mask part of a Pixel.
a place to record messages and descriptions of the state of processing.
static Log & getDefaultLog()
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
An iterator to 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)
static void medianFilter(ImageT const &img, ImageT &outimg, int halfsize)
int getIy() const
Convenience accessors for the keys in the minimal schema.
int getY() const
Return the y-value.
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
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
int getIx() const
Convenience accessors for the keys in the minimal schema.
static bool hasSignificantFluxAtEdge(ImagePtrT, boost::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
int getHeight() const
Return the number of rows in the image.
def deblend
Deblend a single footprint in a maskedImage.
bool operator<=(const SpanList::const_iterator &other)
Ref< ImagePixelT >::type image()
Return (a reference to) the image part of the Pixel pointed at by the iterator.
static void makeMonotonic(ImageT &img, lsst::afw::detection::PeakRecord const &pk)
#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 _sum_templates(std::vector< ImagePtrT > timgs, ImagePtrT tsum)
lsst::afw::detection::Footprint Footprint
bool operator>(const SpanList::const_iterator &other)
bool operator!=(RelativeSpanIterator &other)
xy_locator xy_at(int x, int y) const
ExpressionTraits< Derived >::Iterator Iterator
Nested expression or element iterator.
void clip(Box2I const &other)
Shrink this to ensure that other.contains(*this).
x_iterator row_begin(int y) const
static std::pair< ImagePtrT, FootprintPtrT > buildSymmetricTemplate(MaskedImageT const &img, lsst::afw::detection::Footprint const &foot, lsst::afw::detection::PeakRecord const &pk, double sigma1, bool minZero, bool patchEdges, bool *patchedEdges)
int getX1() const
Return the ending x-value.
bool operator!=(const SpanList::const_iterator &other)
RelativeSpanIterator operator++()
RelativeSpanIterator operator++(int dummy)
Record class that represents a peak in a Footprint.
_view_t::xy_locator xy_locator
An xy_locator.
int getWidth() const
Return the number of columns in the image.
boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT > MaskedImagePtrT
Schema getSchema() const
Return the schema associated with the catalog's table.
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.