LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
Footprint.cc
Go to the documentation of this file.
1
2/*
3 * LSST Data Management System
4 * Copyright 2008-2016 AURA/LSST.
5 *
6 * This product includes software developed by the
7 * LSST Project (http://www.lsst.org/).
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the LSST License Statement and
20 * the GNU General Public License along with this program. If not,
21 * see <https://www.lsstcorp.org/LegalNotices/>.
22 */
23
29
30namespace lsst {
31namespace afw {
32
33template std::shared_ptr<detection::Footprint> table::io::PersistableFacade<
34 detection::Footprint>::dynamicCast(std::shared_ptr<table::io::Persistable> const&);
35
36namespace detection {
37
39 : _spans(inputSpans), _peaks(PeakTable::makeMinimalSchema()), _region(region) {}
40
42 lsst::geom::Box2I const& region)
43 : _spans(inputSpans), _peaks(peakSchema), _region(region) {}
44
45void Footprint::setSpans(std::shared_ptr<geom::SpanSet> otherSpanSet) { _spans = otherSpanSet; }
46
47std::shared_ptr<PeakRecord> Footprint::addPeak(float fx, float fy, float height) {
49 p->setIx(fx);
50 p->setIy(fy);
51 p->setFx(fx);
52 p->setFy(fy);
53 p->setPeakValue(height);
54 return p;
55}
56
58 auto validatedKey = key.isValid() ? key : PeakTable::getPeakValueKey();
59 getPeaks().sort([&validatedKey](detection::PeakRecord const& a, detection::PeakRecord const& b) {
60 return a.get(validatedKey) > b.get(validatedKey);
61 });
62}
63
64void Footprint::shift(int dx, int dy) {
65 setSpans(getSpans()->shiftedBy(dx, dy));
66 for (auto& peak : getPeaks()) {
67 peak.setIx(peak.getIx() + dx);
68 peak.setIy(peak.getIy() + dy);
69 peak.setFx(peak.getFx() + dx);
70 peak.setFy(peak.getFy() + dy);
71 }
72}
73
75 setSpans(getSpans()->clippedTo(box));
77}
78
79bool Footprint::contains(lsst::geom::Point2I const& pix) const { return getSpans()->contains(pix); }
80
83 lsst::geom::Box2I const& region, bool doClip) const {
84 auto srcToTarget = geom::makeWcsPairTransform(*source, *target);
85 return transform(*srcToTarget, region, doClip);
86}
87
89 lsst::geom::Box2I const& region, bool doClip) const {
90 return transform(lsst::geom::AffineTransform(t), region, doClip);
91}
92
94 lsst::geom::Box2I const& region, bool doClip) const {
95 return transform(*geom::makeTransform(t), region, doClip);
96}
97
98std::shared_ptr<Footprint> Footprint::transform(geom::TransformPoint2ToPoint2 const& t,
99 lsst::geom::Box2I const& region, bool doClip) const {
100 // Transfrom the SpanSet first
101 auto transformedSpan = getSpans()->transformedBy(t);
102 // Use this new SpanSet and the peakSchema to create a new Footprint
103 auto newFootprint = std::make_shared<Footprint>(transformedSpan, getPeaks().getSchema(), region);
104 // now populate the new Footprint with transformed Peaks
106 peakPosList.reserve(_peaks.size());
107 for (auto const& peak : getPeaks()) {
108 peakPosList.emplace_back(peak.getF());
109 }
110 auto newPeakPosList = t.applyForward(peakPosList);
111 auto newPeakPos = newPeakPosList.cbegin();
112 for (auto peak = getPeaks().cbegin(), endPeak = getPeaks().cend(); peak != endPeak;
113 ++peak, ++newPeakPos) {
114 newFootprint->addPeak(newPeakPos->getX(), newPeakPos->getY(), peak->getPeakValue());
115 }
116 if (doClip) {
117 newFootprint->clipTo(region);
118 }
119 return newFootprint;
120}
121
122void Footprint::dilate(int r, geom::Stencil s) { setSpans(getSpans()->dilated(r, s)); }
123
124void Footprint::dilate(geom::SpanSet const& other) { setSpans(getSpans()->dilated(other)); }
125
126void Footprint::erode(int r, geom::Stencil s) {
127 setSpans(getSpans()->eroded(r, s));
129}
130
131void Footprint::erode(geom::SpanSet const& other) {
132 setSpans(getSpans()->eroded(other));
134}
135
137 for (auto iter = getPeaks().begin(); iter != getPeaks().end(); ++iter) {
138 if (!getSpans()->contains(lsst::geom::Point2I(iter->getIx(), iter->getIy()))) {
139 iter = getPeaks().erase(iter);
140 --iter;
141 }
142 }
143}
144
146 auto key = _peaks.getSchema().find<double>("significance").key;
147 for (auto& peak : _peaks) {
148 peak.set(key, peak.getPeakValue() / sigma);
149 }
150}
151
153 auto key = _peaks.getSchema().find<double>("significance").key;
154 for (auto& peak : _peaks) {
155 peak.set(key, polarity * peak.getPeakValue() / std::sqrt(variance[peak.getI()]));
156 }
157}
158
160 auto splitSpanSets = getSpans()->split();
162 footprintList.reserve(splitSpanSets.size());
163 for (auto& spanPtr : splitSpanSets) {
164 auto tmpFootprintPointer = std::make_shared<Footprint>(spanPtr, getPeaks().getSchema(), getRegion());
165 tmpFootprintPointer->_peaks = getPeaks();
166 // No need to remove any peaks, as there is only one Footprint, so it will
167 // simply be a copy of the original
168 if (splitSpanSets.size() > 1) {
169 tmpFootprintPointer->removeOrphanPeaks();
170 }
171 footprintList.push_back(std::move(tmpFootprintPointer));
172 }
173 return footprintList;
174}
175
176bool Footprint::operator==(Footprint const& other) const {
177 /* If the peakCatalogs are not the same length the Footprints can't be equal */
178 if (getPeaks().size() != other.getPeaks().size()) {
179 return false;
180 }
181 /* Check that for every peak in the PeakCatalog there is a corresponding peak
182 * in the other, and if not return false
183 */
184 for (auto const& selfPeak : getPeaks()) {
185 bool match = false;
186 for (auto const& otherPeak : other.getPeaks()) {
187 if (selfPeak.getI() == otherPeak.getI() && selfPeak.getF() == otherPeak.getF() &&
188 selfPeak.getPeakValue() == otherPeak.getPeakValue()) {
189 match = true;
190 break;
191 }
192 }
193 if (!match) {
194 return false;
195 }
196 }
197 /* At this point the PeakCatalogs have evaluated true, compare the SpanSets
198 */
199 return *(getSpans()) == *(other.getSpans());
200}
201
202namespace {
203std::string getFootprintPersistenceName() { return "Footprint"; }
204
205class LegacyFootprintPersistenceHelper {
206public:
207 table::Schema spanSchema;
208 table::Key<int> spanY;
209 table::Key<int> spanX0;
210 table::Key<int> spanX1;
211
212 static LegacyFootprintPersistenceHelper const& get() {
213 static LegacyFootprintPersistenceHelper instance;
214 return instance;
215 }
216
217 // No copying
218 LegacyFootprintPersistenceHelper(const LegacyFootprintPersistenceHelper&) = delete;
219 LegacyFootprintPersistenceHelper& operator=(const LegacyFootprintPersistenceHelper&) = delete;
220
221 // No moving
222 LegacyFootprintPersistenceHelper(LegacyFootprintPersistenceHelper&&) = delete;
223 LegacyFootprintPersistenceHelper& operator=(LegacyFootprintPersistenceHelper&&) = delete;
224
225private:
226 LegacyFootprintPersistenceHelper()
227 : spanSchema(),
228 spanY(spanSchema.addField<int>("y", "The row of the span", "pixel")),
229 spanX0(spanSchema.addField<int>("x0", "First column of span (inclusive)", "pixel")),
230 spanX1(spanSchema.addField<int>("x1", "Second column of span (inclusive)", "pixel")) {}
231};
232
233std::pair<afw::table::Schema&, table::Key<int>&> spanSetPersistenceHelper() {
234 static afw::table::Schema spanSetIdSchema;
235 static int initialize = true;
236 static table::Key<int> idKey;
237 if (initialize) {
238 idKey = spanSetIdSchema.addField<int>("id", "id of the SpanSet catalog");
239 initialize = false;
240 }
241 std::pair<afw::table::Schema&, table::Key<int>&> returnPair(spanSetIdSchema, idKey);
242 return returnPair;
243}
244} // end anonymous namespace
245
247public:
249 afw::table::io::InputArchive const& archive,
250 afw::table::io::CatalogVector const& catalogs) const override {
251 // Verify there are two catalogs
252 LSST_ARCHIVE_ASSERT(catalogs.size() == 2u);
253 std::shared_ptr<Footprint> loadedFootprint =
254 detection::Footprint::readSpanSet(catalogs.front(), archive);
255 // Now read in the PeakCatalog records
256 detection::Footprint::readPeaks(catalogs.back(), *loadedFootprint);
257 return loadedFootprint;
258 }
259
260 explicit FootprintFactory(std::string const& name) : afw::table::io::PersistableFactory(name) {}
261};
262
263namespace {
264// Insert the factory into the registry (instantiating an instance is sufficient, because the
265// the code that does the work is in the base class ctor)
266FootprintFactory registration(getFootprintPersistenceName());
267} // end anonymous namespace
268
269std::string Footprint::getPersistenceName() const { return getFootprintPersistenceName(); }
270
272 // get the span schema and key
273 auto const keys = spanSetPersistenceHelper();
274 // create the output catalog
275 afw::table::BaseCatalog spanSetCat = handle.makeCatalog(keys.first);
276 // create a record that will hold the ID of the recursively saved SpanSet
277 auto record = spanSetCat.addNew();
278 record->set(keys.second, handle.put(getSpans()));
279 handle.saveCatalog(spanSetCat);
280 // save the peaks into a catalog
281 afw::table::BaseCatalog peakCat = handle.makeCatalog(getPeaks().getSchema());
282 peakCat.insert(peakCat.end(), getPeaks().begin(), getPeaks().end(), true);
283 handle.saveCatalog(peakCat);
284}
285
287 afw::table::io::InputArchive const& archive) {
288 int fieldCount = catalog.getSchema().getFieldCount();
289 LSST_ARCHIVE_ASSERT(fieldCount == 1 || fieldCount == 3);
290 std::shared_ptr<geom::SpanSet> loadedSpanSet;
291 if (fieldCount == 1) {
292 // This is a new style footprint with a SpanSet as a member, treat accordingly
293 auto const schemaAndKey = spanSetPersistenceHelper();
294 int persistedSpanSetId = catalog.front().get(schemaAndKey.second);
295 loadedSpanSet = std::dynamic_pointer_cast<geom::SpanSet>(archive.get(persistedSpanSetId));
296 } else {
297 // This block is for an old style footprint load.
298 auto const& keys = LegacyFootprintPersistenceHelper::get();
300 tempVec.reserve(catalog.size());
301 for (auto const& val : catalog) {
302 tempVec.emplace_back(val.get(keys.spanY), val.get(keys.spanX0), val.get(keys.spanX1));
303 }
304 loadedSpanSet = std::make_shared<geom::SpanSet>(std::move(tempVec));
305 }
306 auto loadedFootprint = std::unique_ptr<Footprint>(new Footprint(loadedSpanSet));
307 return loadedFootprint;
308}
309
310void Footprint::readPeaks(afw::table::BaseCatalog const& peakCat, Footprint& loadedFootprint) {
311 using namespace std::string_literals;
313 // need to handle an older form of Peak persistence for backwards compatibility
315 mapper.addMinimalSchema(PeakTable::makeMinimalSchema());
316 afw::table::Key<float> oldX = peakCat.getSchema()["x"];
317 afw::table::Key<float> oldY = peakCat.getSchema()["y"];
318 afw::table::Key<float> oldPeakValue = peakCat.getSchema()["value"];
319 mapper.addMapping(oldX, "f.x"s);
320 mapper.addMapping(oldY, "f.y"s);
321 mapper.addMapping(oldPeakValue, "peakValue"s);
322 loadedFootprint.setPeakSchema(mapper.getOutputSchema());
323 auto peaks = loadedFootprint.getPeaks();
324 peaks.reserve(peakCat.size());
325 for (auto const& peak : peakCat) {
326 auto newPeak = peaks.addNew();
327 newPeak->assign(peak, mapper);
328 newPeak->setIx(static_cast<int>(newPeak->getFx()));
329 newPeak->setIy(static_cast<int>(newPeak->getFy()));
330 }
331 return;
332 }
333 loadedFootprint.setPeakSchema(peakCat.getSchema());
334 auto& peaks = loadedFootprint.getPeaks();
335 peaks.reserve(peakCat.size());
336 for (auto const& peak : peakCat) {
337 peaks.addNew()->assign(peak);
338 }
339}
340
341std::shared_ptr<Footprint> mergeFootprints(Footprint const& footprint1, Footprint const& footprint2) {
342 // Bail out early if the schemas are not the same
343 if (footprint1.getPeaks().getSchema() != footprint2.getPeaks().getSchema()) {
345 "Cannot merge Footprints with different Schemas");
346 }
347
348 // Merge the SpanSets
349 auto unionedSpanSet = footprint1.getSpans()->union_(*(footprint2.getSpans()));
350
351 // Construct merged Footprint
352 auto mergedFootprint = std::make_shared<Footprint>(unionedSpanSet, footprint1.getPeaks().getSchema());
353 // Copy over the peaks from both footprints
354 mergedFootprint->setPeakCatalog(PeakCatalog(footprint1.getPeaks().getTable()));
355 PeakCatalog& peaks = mergedFootprint->getPeaks();
356 peaks.reserve(footprint1.getPeaks().size() + footprint2.getPeaks().size());
357 peaks.insert(peaks.end(), footprint1.getPeaks().begin(), footprint1.getPeaks().end(), true);
358 peaks.insert(peaks.end(), footprint2.getPeaks().begin(), footprint2.getPeaks().end(), true);
359
360 // Sort the PeaksCatalog according to value
361 mergedFootprint->sortPeaks();
362
363 return mergedFootprint;
364}
365
367 using PixelT = std::uint16_t;
368 lsst::geom::Box2I fpBBox = footprint.getBBox();
370 *idImage = 0;
371 int const height = fpBBox.getHeight();
372 lsst::geom::Extent2I shift(fpBBox.getMinX(), fpBBox.getMinY());
373 footprint.getSpans()->setImage(*idImage, static_cast<PixelT>(1), fpBBox, true);
374
376 /*
377 * Our strategy is to find a row of pixels in the Footprint and interpret it as the first
378 * row of a rectangular set of pixels. We then extend this rectangle upwards as far as it
379 * will go, and define that as a BBox. We clear all those pixels, and repeat until there
380 * are none left. I.e. a Footprint will get cut up like this:
381 *
382 * .555...
383 * 22.3314
384 * 22.331.
385 * .000.1.
386 * (as shown in Footprint_1.py)
387 */
388
389 int y0 = 0; // the first row with non-zero pixels in it
390 while (y0 < height) {
391 lsst::geom::Box2I bbox; // our next BBox
392 for (int y = y0; y < height; ++y) {
393 // Look for a set pixel in this row
394 image::Image<PixelT>::x_iterator begin = idImage->row_begin(y), end = idImage->row_end(y);
396
397 if (first != end) { // A pixel is set in this row
398 image::Image<PixelT>::x_iterator last = std::find(first, end, 0) - 1;
399 int const x0 = first - begin;
400 int const x1 = last - begin;
401 int const x_size = 1 + x1 - x0;
402
403 std::fill(first, last + 1, 0); // clear pixels; we don't want to see them again
404
405 bbox.include(lsst::geom::Point2I(x0, y)); // the LLC
406 bbox.include(lsst::geom::Point2I(x1, y)); // the LRC; initial guess for URC
407
408 // we found at least one pixel so extend the BBox upwards
409 for (++y; y < height; ++y) {
410 if (std::find(idImage->at(x0, y), idImage->at(x0, y) + x_size, 0) !=
411 idImage->at(x0, y) + x_size) {
412 break; // some pixels weren't set, so the BBox stops here, (actually in previous row)
413 }
414 std::fill(idImage->at(x0, y), idImage->at(x0, y) + x_size, 0);
415
416 bbox.include(lsst::geom::Point2I(x1, y)); // the new URC
417 }
418
419 bbox.shift(shift);
420 bboxes.push_back(bbox);
421 } else {
422 y0 = y + 1;
423 }
424 break;
425 }
426 }
427
428 return bboxes;
429}
430
432 setPeakCatalog(PeakCatalog(peakSchema));
433}
434
435void Footprint::setPeakCatalog(PeakCatalog const& otherPeaks) {
436 if (!getPeaks().empty()) {
437 throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot change the PeakCatalog unless it is empty");
438 }
439 // this syntax doesn't work in Python, which is why this method has to exist
440 getPeaks() = otherPeaks;
441}
442
444 os << rhs.getPeaks().size() << " peaks, area=" << rhs.getArea() << ", centroid=" << rhs.getCentroid();
445 return os;
446}
447
448} // namespace detection
449} // namespace afw
450} // namespace lsst
table::Key< std::string > name
Definition: Amplifier.cc:116
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
Key< Flag > const & target
int end
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
table::Schema spanSchema
Definition: Footprint.cc:207
table::Key< int > spanX1
Definition: Footprint.cc:210
table::Key< int > spanY
Definition: Footprint.cc:208
table::Key< int > spanX0
Definition: Footprint.cc:209
afw::table::Key< double > sigma
Definition: GaussianPsf.cc:49
afw::table::Key< afw::table::Array< VariancePixelT > > variance
std::ostream * os
Definition: Schema.cc:557
SchemaMapper * mapper
Definition: SchemaMapper.cc:71
int y
Definition: SpanSet.cc:48
table::Key< int > b
table::Key< int > a
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
T back(T... args)
FootprintFactory(std::string const &name)
Definition: Footprint.cc:260
std::shared_ptr< afw::table::io::Persistable > read(afw::table::io::InputArchive const &archive, afw::table::io::CatalogVector const &catalogs) const override
Construct a new object from the given InputArchive and vector of catalogs.
Definition: Footprint.cc:248
Class to describe the properties of a detected object from an image.
Definition: Footprint.h:63
Footprint()
Constructor of a empty Footprint object.
Definition: Footprint.h:96
lsst::geom::Box2I getRegion() const
Return the corners of the MaskedImage the footprints live in.
Definition: Footprint.h:213
std::shared_ptr< PeakRecord > addPeak(float fx, float fy, float value)
Convenience function to add a peak.
Definition: Footprint.cc:47
static std::unique_ptr< Footprint > readSpanSet(afw::table::BaseCatalog const &, afw::table::io::InputArchive const &)
Static method used to unpersist the SpanSet member of the Footprint class.
Definition: Footprint.cc:286
void write(OutputArchiveHandle &handle) const override
Write an instance of a Footprint to an output Archive.
Definition: Footprint.cc:271
std::shared_ptr< Footprint > transform(std::shared_ptr< geom::SkyWcs > source, std::shared_ptr< geom::SkyWcs > target, lsst::geom::Box2I const &region, bool doClip=true) const
Transform the footprint from one WCS to another.
Definition: Footprint.cc:81
bool contains(lsst::geom::Point2I const &pix) const
Tests if a pixel postion falls inside the Footprint.
Definition: Footprint.cc:79
std::vector< std::shared_ptr< Footprint > > split() const
Split a multi-component Footprint into a vector of contiguous Footprints.
Definition: Footprint.cc:159
void dilate(int r, geom::Stencil s=geom::Stencil::CIRCLE)
Dilate the Footprint with a defined kernel.
Definition: Footprint.cc:122
lsst::geom::Box2I getBBox() const
Return the Footprint's bounding box.
Definition: Footprint.h:208
void sortPeaks(afw::table::Key< float > const &key=afw::table::Key< float >())
Sort Peaks from most positive value to most negative.
Definition: Footprint.cc:57
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:115
void removeOrphanPeaks()
Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
Definition: Footprint.cc:136
void setPeakSchema(afw::table::Schema const &peakSchema)
Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty).
Definition: Footprint.cc:431
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:129
std::size_t getArea() const
Return the number of pixels in this Footprint.
Definition: Footprint.h:173
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:45
std::string getPersistenceName() const override
Return the name correspoinging ot the persistence type.
Definition: Footprint.cc:269
void clipTo(lsst::geom::Box2I const &bbox)
Clip the Footprint such that all values lie inside the supplied Bounding Box.
Definition: Footprint.cc:74
void erode(int r, geom::Stencil s=geom::Stencil::CIRCLE)
Erode the Footprint with a defined kernel.
Definition: Footprint.cc:126
void updatePeakSignificance(double sigma)
Compute and update the significance of each peak, given a single value for sigma.
Definition: Footprint.cc:145
lsst::geom::Point2D getCentroid() const
Return the Footprint's centroid.
Definition: Footprint.h:180
void shift(int dx, int dy)
Shift a Footprint by (dx, dy)
Definition: Footprint.cc:64
bool operator==(Footprint const &other) const
equality operator
Definition: Footprint.cc:176
static void readPeaks(afw::table::BaseCatalog const &, Footprint &)
Static method used to unpersist the PeakCatalog member of the Footprint class.
Definition: Footprint.cc:310
void setPeakCatalog(PeakCatalog const &otherPeaks)
Set the peakCatalog to a copy of the supplied catalog.
Definition: Footprint.cc:435
Record class that represents a peak in a Footprint.
Definition: Peak.h:42
Table class for Peaks in Footprints.
Definition: Peak.h:102
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition: Peak.h:137
static afw::table::Key< float > getPeakValueKey()
Definition: Peak.h:169
typename _view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:133
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:51
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:413
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition: Catalog.h:490
iterator begin()
Iterator access.
Definition: Catalog.h:401
iterator erase(iterator pos)
Erase the record pointed to by pos, and return an iterator the next record.
Definition: Catalog.h:565
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
Definition: Catalog.h:433
void sort(Key< T > const &key)
Sort the catalog in-place by the field with the given key.
Definition: Catalog.h:756
void insert(iterator pos, InputIterator first, InputIterator last, bool deep=false)
Insert an iterator range into the table.
Definition: Catalog.h:518
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
Definition: Catalog.h:115
Schema getSchema() const
Return the schema associated with the catalog's table.
Definition: Catalog.h:118
A class used as a handle to a particular field in a table.
Definition: Key.h:53
bool isValid() const noexcept
Return true if the key was initialized to valid offset.
Definition: Key.h:97
Defines the fields and offsets for a table.
Definition: Schema.h:51
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Definition: Schema.cc:490
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
Definition: Schema.cc:467
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
A vector of catalogs used by Persistable.
Definition: CatalogVector.h:29
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
std::shared_ptr< Persistable > get(int id) const
Load the Persistable with the given ID and return it.
An object passed to Persistable::write to allow it to persist itself.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
int put(Persistable const *obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
A base class for factory classes used to reconstruct objects from records.
Definition: Persistable.h:228
PersistableFactory(std::string const &name)
Constructor for the factory.
Definition: Persistable.cc:74
An affine coordinate transformation consisting of a linear transformation and an offset.
An integer coordinate rectangle.
Definition: Box.h:55
int getMinY() const noexcept
Definition: Box.h:158
int getHeight() const noexcept
Definition: Box.h:188
int getMinX() const noexcept
Definition: Box.h:157
A 2D linear coordinate transformation.
Reports invalid arguments.
Definition: Runtime.h:66
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
T emplace_back(T... args)
T fill(T... args)
T find(T... args)
T front(T... args)
T move(T... args)
std::ostream & operator<<(std::ostream &os, Footprint const &rhs)
Print a Footprint to the stream.
Definition: Footprint.cc:443
afw::table::CatalogT< PeakRecord > PeakCatalog
Definition: Peak.h:244
std::vector< lsst::geom::Box2I > footprintToBBoxList(Footprint const &footprint)
Return a list of BBoxs, whose union contains exactly the pixels in the footprint, neither more nor le...
Definition: Footprint.cc:366
std::shared_ptr< Footprint > mergeFootprints(Footprint const &footprint1, Footprint const &footprint2)
Merges two Footprints – appends their peaks, and unions their spans, returning a new Footprint.
Definition: Footprint.cc:341
T push_back(T... args)
T reserve(T... args)
T size(T... args)
T sqrt(T... args)
ImageT val
Definition: CR.cc:146