13 namespace det = lsst::afw::detection;
14 namespace deblend = lsst::meas::deblender;
15 namespace geom = lsst::afw::geom;
18 static bool span_ptr_compare(
PTR(det::Span) sp1,
PTR(det::Span) sp2) {
35 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
41 int S = halfsize*2 + 1;
44 xy_loc pix = img.
xy_at(halfsize,halfsize);
45 std::vector<typename xy_loc::cached_location_t> locs;
46 for (
int i=0; i<S; ++i) {
47 for (
int j=0; j<S; ++j) {
48 locs.push_back(pix.cache_location(j-halfsize, i-halfsize));
53 ImagePixelT vals[S*S];
54 for (
int y=halfsize;
y<H-halfsize; ++
y) {
55 xy_loc inpix = img.
xy_at(halfsize,
y), end = img.
xy_at(W-halfsize,
y);
57 inpix != end; ++inpix.x(), ++optr) {
58 for (
int i=0; i<SS; ++i)
59 vals[i] = inpix[locs[i]];
60 std::nth_element(vals, vals+SS/2, vals+SS);
66 for (
int y=0;
y<2*halfsize; ++
y) {
69 iy = H - 1 - (
y-halfsize);
72 for (; iptr != end; ++iptr,++optr)
75 for (
int y=halfsize;
y<H-halfsize; ++
y) {
78 for (; iptr != end; ++iptr,++optr)
83 for (; iptr != end; ++iptr,++optr)
113 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
120 int cx = peak.
getIx();
121 int cy = peak.
getIy();
122 int ix0 = img.
getX0();
123 int iy0 = img.
getY0();
136 for (s = 0; s < std::max(DW,DH); s += S) {
138 for (p=0; p<S; p++) {
178 for (
int i=0; i<(8*L); i++, x += dx, y += dy) {
182 if (i % (2*L) == 0) {
185 dx = ( leg % 2) * (-1 + 2*(leg/2));
187 dy = ((leg+1) % 2) * ( 1 - 2*(leg/2));
190 int px = cx + x - ix0;
191 int py = cy + y - iy0;
193 if (px < 0 || px >= iW || py < 0 || py >= iH)
196 ImagePixelT pix = (*shadowingImg)(px,py);
203 const double A = 0.3;
209 ds0 = (double(y) / double(x)) - A;
212 for (shx=1; shx<=S; shx++) {
213 int xsign = (x>0?1:-1);
215 psx = cx + x + (xsign*shx) - ix0;
216 if (psx < 0 || psx >= iW)
219 for (shy = lround(shx * ds0);
220 shy <= lround(shx * ds1); shy++) {
221 psy = cy + y + xsign*shy - iy0;
222 if (psy < 0 || psy >= iH)
224 img(psx, psy) = std::min(img(psx, psy), pix);
230 ds0 = (double(x) / double(y)) - A;
233 for (shy=1; shy<=S; shy++) {
234 int ysign = (y>0?1:-1);
235 psy = cy + y + (ysign*shy) - iy0;
236 if (psy < 0 || psy >= iH)
239 for (shx = lround(shy * ds0);
240 shx <= lround(shy * ds1); shx++) {
241 psx = cx + x + ysign*shx - ix0;
242 if (psx < 0 || psx >= iW)
244 img(psx, psy) = std::min(img(psx, psy), pix);
250 shadowingImg->assign(img);
254 static double _get_contrib_r_to_footprint(
int x,
int y,
258 SpanList
const& tspans = tfoot->
getSpans();
259 for (SpanList::const_iterator ts = tspans.begin(); ts < tspans.end(); ++ts) {
268 dx = x - sp->
getX1();
276 int dy = sp->
getY() -
y;
277 minr2 = std::min(minr2, (
double)(mindx*mindx + dy*dy));
280 return 1. / (1. + minr2);
284 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
290 int strayFluxOptions,
292 std::vector<bool>
const& ispsf,
293 std::vector<int>
const& pkx,
294 std::vector<int>
const& pky,
295 double clipStrayFluxFraction,
305 std::vector<PTR(det::Footprint) > strayfoot;
306 std::vector<std::vector<ImagePixelT> > straypix;
307 std::vector<std::vector<MaskPixelT> > straymask;
308 std::vector<std::vector<VariancePixelT> > strayvar;
310 int ix0 = img.
getX0();
311 int iy0 = img.
getY0();
316 for (
size_t i=0; i<tfoots.size(); ++i) {
318 straypix.push_back(std::vector<ImagePixelT>());
319 straymask.push_back(std::vector<MaskPixelT>());
320 strayvar.push_back(std::vector<VariancePixelT>());
323 bool always = (strayFluxOptions & STRAYFLUX_TO_POINT_SOURCES_ALWAYS);
325 typedef std::uint16_t itype;
328 if (strayFluxOptions & STRAYFLUX_NEAREST_FOOTPRINT) {
331 typedef std::uint16_t dtype;
335 std::vector<PTR(det::Footprint)> templist;
336 std::vector<PTR(det::Footprint)>* footlist = &tfoots;
338 if (!always && ispsf.size()) {
342 for (
size_t i=0; i<tfoots.size(); ++i) {
344 templist.push_back(empty);
346 templist.push_back(tfoots[i]);
349 footlist = &templist;
356 const SpanList& spans = foot.
getSpans();
357 for (SpanList::const_iterator s = spans.begin(); s < spans.end(); s++) {
358 int y = (*s)->getY();
359 int x0 = (*s)->getX0();
360 int x1 = (*s)->getX1();
362 tsum->row_begin(y - sumy0) + (x0 - sumx0);
365 double contrib[tfoots.size()];
367 for (
int x = x0; x <= x1; ++
x, ++tsum_it, ++in_it) {
371 if ((*tsum_it > 0) || (*in_it).image() <= 0) {
375 if (strayFluxOptions & STRAYFLUX_R_TO_FOOTPRINT) {
377 for (
size_t i=0; i<tfoots.size(); ++i) {
380 }
else if (strayFluxOptions & STRAYFLUX_NEAREST_FOOTPRINT) {
381 for (
size_t i=0; i<tfoots.size(); ++i) {
384 int i = nearest->get0(x, y);
388 for (
size_t i=0; i<tfoots.size(); ++i) {
393 contrib[i] = 1. / (1. + dx*dx + dy*dy);
399 bool ptsrcs = always;
401 for (
size_t i=0; i<tfoots.size(); ++i) {
403 if ((!ptsrcs) && ispsf.size() && ispsf[i]) {
406 if (contrib[i] == -1.0) {
407 contrib[i] = _get_contrib_r_to_footprint(x, y, tfoots[i]);
413 STRAYFLUX_TO_POINT_SOURCES_WHEN_NECESSARY)) {
417 for (
size_t i=0; i<tfoots.size(); ++i) {
418 if (contrib[i] == -1.0) {
419 contrib[i] = _get_contrib_r_to_footprint(x, y, tfoots[i]);
426 double strayclip = (clipStrayFluxFraction * csum);
428 for (
size_t i=0; i<tfoots.size(); ++i) {
430 if ((!ptsrcs) && ispsf.size() && ispsf[i]) {
435 if (contrib[i] < strayclip) {
442 for (
size_t i=0; i<tfoots.size(); ++i) {
443 if (contrib[i] == 0.) {
447 double p = (contrib[i] / csum) * (*in_it).image();
451 strayfoot[i]->addSpanInSeries(y, x, x);
452 straypix[i].push_back(p);
453 straymask[i].push_back((*in_it).mask());
454 strayvar[i].push_back((*in_it).variance());
460 for (
size_t i=0; i<tfoots.size(); ++i) {
462 strays.push_back(HeavyFootprintPtrT());
467 HeavyFootprintPtrT heavy(
new HeavyFootprint(*strayfoot[i]));
468 ndarray::Array<ImagePixelT,1,1> himg = heavy->getImageArray();
469 typename std::vector<ImagePixelT>::const_iterator spix;
470 typename std::vector<MaskPixelT>::const_iterator smask;
471 typename std::vector<VariancePixelT>::const_iterator svar;
472 typename ndarray::Array<ImagePixelT,1,1>::Iterator hpix;
473 typename ndarray::Array<MaskPixelT,1,1>::Iterator mpix;
474 typename ndarray::Array<VariancePixelT,1,1>::Iterator vpix;
476 assert((
size_t)strayfoot[i]->getNpix() == straypix[i].size());
478 for (spix = straypix[i].begin(),
479 smask = straymask[i].begin(),
480 svar = strayvar [i].begin(),
482 mpix = heavy->getMaskArray().begin(),
483 vpix = heavy->getVarianceArray().begin();
484 spix != straypix[i].end();
485 ++spix, ++smask, ++svar, ++hpix, ++mpix, ++vpix) {
490 strays.push_back(heavy);
495 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
505 for (
size_t i=0; i<timgs.size(); ++i) {
521 tsum->row_begin(y - sumy0) + (copyx0 - sumx0);
522 for (; in_it != inend; ++in_it, ++tsum_it) {
523 *tsum_it += std::max((ImagePixelT)0., static_cast<ImagePixelT>(*in_it));
578 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
579 std::vector<typename PTR(image::MaskedImage<ImagePixelT, MaskPixelT, VariancePixelT>)>
583 std::vector<ImagePtrT> timgs,
586 std::vector<bool>
const& ispsf,
587 std::vector<int>
const& pkx,
588 std::vector<int>
const& pky,
589 std::vector<std::shared_ptr<typename det::HeavyFootprint<ImagePixelT,MaskPixelT,VariancePixelT> > > & strays,
590 int strayFluxOptions,
591 double clipStrayFluxFraction
595 if (timgs.size() != tfoots.size()) {
596 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
597 (
boost::format(
"Template images must be the same length as template footprints (%d vs %d)")
598 % timgs.size() % tfoots.size()).str());
601 for (
size_t i=0; i<timgs.size(); ++i) {
602 if (!timgs[i]->getBBox().contains(tfoots[i]->getBBox())) {
603 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
604 "Template image MUST contain template footprint");
607 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
608 "Image bbox MUST contain parent footprint");
616 std::vector<MaskedImagePtrT> portions;
619 bool findStrayFlux = (strayFluxOptions & ASSIGN_STRAYFLUX);
621 int ix0 = img.
getX0();
622 int iy0 = img.
getY0();
630 if (!tsum->getBBox().contains(foot.
getBBox())) {
631 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
632 "Template sum image MUST contain parent footprint");
639 _sum_templates(timgs, tsum);
642 for (
size_t i=0; i<timgs.size(); ++i) {
646 port->setXY0(timg->getXY0());
647 portions.push_back(port);
660 timg->row_begin(y - ty0) + (copyx0 - tx0);
663 tsum->row_begin(y - sumy0) + (copyx0 - sumx0);
665 port->row_begin(y - ty0) + (copyx0 - tx0);
666 for (; tptr != tend; ++tptr, ++in_it, ++out_it, ++tsum_it) {
670 double frac = std::max((ImagePixelT)0., static_cast<ImagePixelT>(*tptr)) / (*tsum_it);
675 out_it.variance() = (*in_it).variance();
676 out_it.image() = (*in_it).image() * frac;
682 if ((ispsf.size() > 0) && (ispsf.size() != timgs.size())) {
683 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
684 (
boost::format(
"'ispsf' must be the same length as templates (%d vs %d)")
685 % ispsf.size() % timgs.size()).str());
687 if ((pkx.size() != timgs.size()) || (pky.size() != timgs.size())) {
688 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
689 (
boost::format(
"'pkx' and 'pky' must be the same length as templates (%d,%d vs %d)")
690 % pkx.size() % pky.size() % timgs.size()).str());
692 _find_stray_flux(foot, tsum, img, strayFluxOptions, tfoots,
693 ispsf, pkx, pky, clipStrayFluxFraction, strays);
715 int cx,
int cy,
bool forward=
true)
726 return _real == other;
729 return _real != other;
732 return _real <= other;
734 bool operator<(
const SpanList::const_iterator & other) {
735 return _real < other;
738 return _real >= other;
740 bool operator>(
const SpanList::const_iterator & other) {
741 return _real > other;
750 return !(*
this == other);
777 return (*_real)->getX0() -
_cx;
779 return _cx - (*_real)->getX1();
784 return (*_real)->getX1() -
_cx;
786 return _cx - (*_real)->getX0();
790 return std::abs((*_real)->getY() -
_cy);
793 return (*_real)->getX0();
796 return (*_real)->getX1();
799 return (*_real)->getY();
861 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
863 deblend::BaselineUtils<ImagePixelT,MaskPixelT,VariancePixelT>::
871 const SpanList spans = foot.getSpans();
872 assert(foot.isNormalized());
877 PTR(det::Span) target(
new det::Span(cy, cx, cx));
878 SpanList::const_iterator peakspan =
879 std::upper_bound(spans.begin(), spans.end(), target, span_ptr_compare);
885 if (peakspan == spans.begin()) {
887 if (!sp->contains(cx, cy)) {
889 "Failed to find span containing (%i,%i): before the beginning of this footprint", cx, cy);
896 if (!sp->contains(cx, cy)) {
899 if (!sp->contains(cx, cy)) {
901 LOGL_WARN(_log,
"Failed to find span containing (%i,%i): nearest is %i, [%i,%i]. "
902 "Footprint bbox is [%i,%i],[%i,%i]",
903 cx, cy, sp->getY(), sp->getX0(), sp->getX1(),
909 LOGL_DEBUG(_log,
"Span containing (%i,%i): (x=[%i,%i], y=%i)",
910 cx, cy, sp->getX0(), sp->getX1(), sp->getY());
944 while (fwd.notDone() && back.
notDone()) {
949 int fdxlo = fwd.dxlo();
950 int bdxlo = back.
dxlo();
957 for (fend = fwd; fend.
notDone(); ++fend) {
961 for (bend = back; bend.
notDone(); ++bend) {
966 LOGL_DEBUG(_log,
"dy=%i, fy=%i, fx=[%i, %i], by=%i, fx=[%i, %i], fdx=%i, bdx=%i",
967 dy, fy, fwd.x0(), fwd.x1(), by, back.
x0(), back.
x1(),
976 while ((fwd != fend) && (fwd.dxhi() < bdxlo)) {
981 LOGL_DEBUG(_log,
"Advanced to forward span %i, [%i, %i]",
982 fy, fwd.x0(), fwd.x1());
985 }
else if (fdxlo > bdxlo) {
990 while ((back != bend) && (back.
dxhi() < fdxlo)) {
995 LOGL_DEBUG(_log,
"Advanced to backward span %i, [%i, %i]",
996 by, back.
x0(), back.
x1());
1001 if ((back == bend) || (fwd == fend)) {
1017 int dxlo = std::max(fwd.dxlo(), back.
dxlo());
1018 int dxhi = std::min(fwd.dxhi(), back.
dxhi());
1020 LOGL_DEBUG(_log,
"Adding span fwd %i, [%i, %i], back %i, [%i, %i]",
1021 fy, cx+dxlo, cx+dxhi, by, cx-dxhi, cx-dxlo);
1022 sfoot->addSpan(fy, cx + dxlo, cx + dxhi);
1023 sfoot->addSpan(by, cx - dxhi, cx - dxlo);
1027 if (fwd.dxhi() < back.
dxhi()) {
1032 LOGL_DEBUG(_log,
"Stepped forward to span %i, [%i, %i]",
1033 fwd.y(), fwd.x0(), fwd.x1());
1040 LOGL_DEBUG(_log,
"Stepped backward to span %i, [%i, %i]",
1041 back.
y(), back.
x0(), back.
x1());
1045 if ((back == bend) || (fwd == fend)) {
1076 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1077 std::pair<typename PTR(lsst::afw::image::Image<ImagePixelT>),
1087 bool* patchedEdges) {
1092 *patchedEdges =
false;
1094 int cx = peak.
getIx();
1095 int cy = peak.
getIy();
1100 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
"Image too small for footprint");
1105 return std::pair<ImagePtrT, FootprintPtrT>(
ImagePtrT(), sfoot);
1109 throw LSST_EXCEPT(lsst::pex::exceptions::LengthError,
1110 "Image too small for symmetrized footprint");
1112 const SpanList spans = sfoot->getSpans();
1115 bool touchesEdge =
false;
1117 LOGL_DEBUG(_log,
"Checking footprint for EDGE bits");
1120 MaskPixelT edgebit = mask->getPlaneBitMask(
"EDGE");
1121 for (SpanList::const_iterator fwd=spans.begin();
1122 fwd != spans.end(); ++fwd) {
1123 int x0 = (*fwd)->getX0();
1124 int x1 = (*fwd)->getX1();
1126 mask->x_at(x0 - mask->getX0(), (*fwd)->getY() - mask->getY0());
1127 for (
int x=x0; x<=x1; ++
x, ++xiter) {
1128 if ((*xiter) & edgebit) {
1137 LOGL_DEBUG(_log,
"Footprint includes an EDGE pixel.");
1145 SpanList::const_iterator fwd = spans.begin();
1146 SpanList::const_iterator back = spans.end()-1;
1150 for (; fwd <= back; fwd++, back--) {
1151 int fy = (*fwd)->getY();
1152 int by = (*back)->getY();
1154 for (
int fx=(*fwd)->getX0(), bx=(*back)->getX1();
1155 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);
1193 LOGL_DEBUG(_log,
"Footprint touches EDGE: start bbox [%i,%i],[%i,%i]",
1196 const SpanList ospans = foot.
getSpans();
1197 for (fwd = ospans.begin(); fwd != ospans.end(); ++fwd) {
1198 int y = (*fwd)->getY();
1199 int x = (*fwd)->getX0();
1201 int ym = cy + (cy -
y);
1202 int xm = cx + (cx -
x);
1206 x = (*fwd)->getX1();
1212 LOGL_DEBUG(_log,
"Footprint touches EDGE: grown bbox [%i,%i],[%i,%i]",
1219 LOGL_DEBUG(_log,
"Symmetric footprint spans:");
1220 const SpanList sspans = sfoot->getSpans();
1221 for (fwd = sspans.begin(); fwd != sspans.end(); ++fwd) {
1222 LOGL_DEBUG(_log,
" %s", (*fwd)->toString().c_str());
1227 for (fwd = ospans.begin(); fwd != ospans.end(); ++fwd) {
1228 int y = (*fwd)->getY();
1229 int x0 = (*fwd)->getX0();
1230 int x1 = (*fwd)->getX1();
1232 int ym = cy + (cy -
y);
1233 int xm0 = cx + (cx -
x0);
1234 int xm1 = cx + (cx - x1);
1245 x0 = cx + (cx - (imbb.
getMinX() - 1));
1248 x1 = cx + (cx - (imbb.
getMaxX() + 1));
1250 LOGL_DEBUG(_log,
"Span y=%i, x=[%i,%i] has mirror (%i,[%i,%i]) out-of-bounds; clipped to %i,[%i,%i]",
1251 y, (*fwd)->getX0(), (*fwd)->getX1(), ym, xm1, xm0,
y,
x0, x1);
1255 targetimg2->x_at(x0 - targetimg2->getX0(), y - targetimg2->getY0());
1256 for (
int x=x0; x<=x1; ++
x, ++outiter, ++initer) {
1257 *outiter = initer.
image();
1259 sfoot->addSpan(y, x0, x1);
1262 targetimg = targetimg2;
1265 *patchedEdges = touchesEdge;
1266 return std::pair<ImagePtrT, FootprintPtrT>(targetimg, sfoot);
1273 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1278 ImagePixelT thresh) {
1288 const SpanList spans = edge->getSpans();
1289 for (SpanList::const_iterator sp = spans.
begin(); sp != spans.
end(); ++sp) {
1290 int const y = (*sp)->getY();
1291 int const x0 = (*sp)->getX0();
1292 int const x1 = (*sp)->getX1();
1295 for (xiter = img->x_at(x0 - img->getX0(), y - img->getY0()), x=x0; x<=x1; ++
x, ++xiter) {
1296 if (*xiter >= thresh) {
1308 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
1309 std::shared_ptr<det::Footprint>
1313 ImagePixelT thresh) {
1320 int const x0 = img->getX0(),
y0 = img->getY0();
1322 for (det::Footprint::SpanList::const_iterator ss = edges->getSpans().begin();
1323 ss != edges->getSpans().end(); ++ss) {
1325 int const y = span.
getY();
1326 int x = span.
getX0();
1328 bool onSpan =
false;
1331 if (*iter >= thresh) {
1334 }
else if (onSpan) {
1336 significant->addSpanInSeries(y, xSpan, x - 1);
1340 significant->addSpanInSeries(y, xSpan, span.
getX1());
static std::shared_ptr< lsst::afw::detection::Footprint > getSignificantEdgePixels(ImagePtrT, std::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Returns a list of pixels that are on the edge of the given Footprint sfoot* in image img...
x_iterator row_begin(int y) const
Return an x_iterator to the start of the image.
Ref< MaskPixelT >::type mask()
Return (a reference to) the mask part of the Pixel pointed at by the iterator.
bool operator>=(const SpanList::const_iterator &other)
static void medianFilter(ImageT const &img, ImageT &outimg, int halfsize)
Run a spatial median filter over the given input img, writing the results to out. ...
void include(Point2I const &point)
Expand this to ensure that this->contains(point).
RelativeSpanIterator(SpanList::const_iterator const &real, SpanList const &arr, int cx, int cy, bool forward=true)
Include files required for standard LSST Exception handling.
A range of pixels within one row of an Image.
bool operator<(const SpanList::const_iterator &other)
int getX0() const
Return the image's column-origin.
Iterator end() const
Return an iterator to one past the last pixel in the Span.
_const_view_t::x_iterator const_x_iterator
A const iterator for traversing the pixels in a row.
Extent2I const getDimensions() const
bool operator==(RelativeSpanIterator &other)
lsst::afw::detection::Footprint Footprint
_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
int getY() const
Return the y-value.
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.
boost::shared_ptr< lsst::afw::detection::Footprint > FootprintPtrT
int getX0() const
Return the image's column-origin.
boost::shared_ptr< lsst::afw::image::Mask< MaskPixelT > > MaskPtrT
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
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)
Given an img, footprint foot, and peak, creates a symmetric template around the peak; produce a Maske...
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
LSST DM logging module built on log4cxx.
An iterator to the MaskedImage.
boost::shared_ptr< lsst::afw::image::Image< ImagePixelT > > ImagePtrT
x_iterator x_at(int x, int y) const
Return an x_iterator at the point (x, y)
int getIy() const
Convenience accessors for the keys in the minimal schema.
int getX1() const
Return the ending x-value.
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
bool contains(Point2I const &point) const
Return true if the box contains the point.
static void _sum_templates(std::vector< ImagePtrT > timgs, ImagePtrT tsum)
MaskPtr getMask(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage's mask.
int getX0() const
Return the starting x-value.
A class to manipulate images, masks, and variance as a single object.
SpanList::const_iterator _real
det::Footprint::SpanList SpanList
boost::shared_ptr< lsst::afw::detection::HeavyFootprint< ImagePixelT > MaskPixelT, VariancePixelT > HeavyFootprintPtrT
int getIx() const
Convenience accessors for the keys in the minimal schema.
int getHeight() const
Return the number of rows in the image.
Schema getSchema() const
Return the schema associated with the catalog's table.
bool operator<=(const SpanList::const_iterator &other)
#define LOGL_WARN(logger, message...)
Log a warn-level message using a varargs/printf style interface.
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)
Given an image mimg and Peak location peak, overwrite mimg so that pixels further from the peak have ...
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
SpanList::const_iterator _end
afw::table::Key< double > sigma1
This is a convenience class used in symmetrizeFootprint, wrapping the idea of iterating through a Spa...
boost::shared_ptr< lsst::afw::image::MaskedImage< ImagePixelT > MaskPixelT, VariancePixelT > MaskedImagePtrT
bool operator>(const SpanList::const_iterator &other)
void clip(Box2I const &other)
Shrink this to ensure that other.contains(*this).
int getY0() const
Return the image's row-origin.
bool operator!=(RelativeSpanIterator &other)
xy_locator xy_at(int x, int y) const
Return an xy_locator at the point (x, y) in the image.
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
#define CONST_PTR(...)
A shared pointer to a const object.
bool operator!=(const SpanList::const_iterator &other)
#define LOG_GET(logger)
Returns a Log object associated with logger.
RelativeSpanIterator operator++()
RelativeSpanIterator operator++(int dummy)
Record class that represents a peak in a Footprint.
void nearestFootprint(std::vector< boost::shared_ptr< Footprint >> const &foots, lsst::afw::image::Image< std::uint16_t >::Ptr argmin, lsst::afw::image::Image< std::uint16_t >::Ptr dist)
Given a vector of Footprints, fills the output "argmin" and "dist" images to contain the Manhattan di...
_view_t::xy_locator xy_locator
An xy_locator.
static bool hasSignificantFluxAtEdge(ImagePtrT, std::shared_ptr< lsst::afw::detection::Footprint >, ImagePixelT threshold)
Returns true if the given Footprint sfoot in image img has flux above value thresh at its edge...
int getWidth() const
Return the number of columns in the image.
static void _find_stray_flux(lsst::afw::detection::Footprint const &foot, ImagePtrT tsum, MaskedImageT const &img, int strayFluxOptions, std::vector< std::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< std::shared_ptr< typename lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > > > &strays)
Iterator begin() const
Return an iterator to the first pixel in the Span.
void copyWithinFootprint(Footprint const &foot, boost::shared_ptr< ImageOrMaskedImageT > const input, boost::shared_ptr< ImageOrMaskedImageT > output)
Copies pixels from input image to output image within the Footprint's area.
A const locator for the MaskedImage.
int getY0() const
Return the image's row-origin.