lsst.afw  13.0-109-g62eb66483
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 
27 
28 namespace lsst {
29 namespace afw {
30 namespace detection {
31 
32 Footprint::Footprint(std::shared_ptr<geom::SpanSet> inputSpans, geom::Box2I const& region)
33  : daf::base::Citizen(typeid(this)),
34  _spans(inputSpans),
35  _peaks(PeakTable::makeMinimalSchema()),
36  _region(region) {}
37 
38 Footprint::Footprint(std::shared_ptr<geom::SpanSet> inputSpans, afw::table::Schema const& peakSchema,
39  geom::Box2I const& region)
40  : daf::base::Citizen(typeid(this)), _spans(inputSpans), _peaks(peakSchema), _region(region) {}
41 
42 void Footprint::setSpans(std::shared_ptr<geom::SpanSet> otherSpanSet) { _spans = otherSpanSet; }
43 
44 std::shared_ptr<PeakRecord> Footprint::addPeak(float fx, float fy, float height) {
45  std::shared_ptr<PeakRecord> p = getPeaks().addNew();
46  p->setIx(fx);
47  p->setIy(fy);
48  p->setFx(fx);
49  p->setFy(fy);
50  p->setPeakValue(height);
51  return p;
52 }
53 
55  auto validatedKey = key.isValid() ? key : PeakTable::getPeakValueKey();
56  getPeaks().sort([&validatedKey](detection::PeakRecord const& a, detection::PeakRecord const& b) {
57  return a.get(validatedKey) > b.get(validatedKey);
58  });
59 }
60 
61 void Footprint::shift(int dx, int dy) {
62  setSpans(getSpans()->shiftedBy(dx, dy));
63  for (auto& peak : getPeaks()) {
64  peak.setIx(peak.getIx() + dx);
65  peak.setIy(peak.getIy() + dy);
66  peak.setFx(peak.getFx() + dx);
67  peak.setFy(peak.getFy() + dy);
68  }
69 }
70 
72  setSpans(getSpans()->clippedTo(box));
74 }
75 
76 bool Footprint::contains(geom::Point2I const& pix) const { return getSpans()->contains(pix); }
77 
78 std::shared_ptr<Footprint> Footprint::transform(std::shared_ptr<image::Wcs> source,
79  std::shared_ptr<image::Wcs> target, geom::Box2I const& region,
80  bool doClip) const {
81  // Build a transform from the two wcs objects
83  return transform(xyTransform, region, doClip);
84 }
85 
86 std::shared_ptr<Footprint> Footprint::transform(geom::LinearTransform const& t, geom::Box2I const& region,
87  bool doClip) const {
88  return transform(geom::AffineTransform(t), region, doClip);
89 }
90 
91 std::shared_ptr<Footprint> Footprint::transform(geom::AffineTransform const& t, geom::Box2I const& region,
92  bool doClip) const {
93  return transform(geom::AffineXYTransform(t), region, doClip);
94 }
95 
96 std::shared_ptr<Footprint> Footprint::transform(geom::XYTransform const& t, geom::Box2I const& region,
97  bool doClip) const {
98  // Transfrom the SpanSet first
99  auto transformedSpan = getSpans()->transformedBy(t);
100  // Use this new SpanSet and the peakSchema to create a new Footprint
101  auto newFootprint = std::make_shared<Footprint>(transformedSpan, getPeaks().getSchema(), region);
102  // now populate the new Footprint with transformed Peaks
103  for (auto const& peak : getPeaks()) {
104  // Transform the x y Point
105  auto newPoint = t.forwardTransform(peak.getF());
106  newFootprint->addPeak(newPoint.getX(), newPoint.getY(), peak.getPeakValue());
107  }
108  if (doClip) {
109  newFootprint->clipTo(region);
110  }
111  return newFootprint;
112 }
113 
114 void Footprint::dilate(int r, geom::Stencil s) { setSpans(getSpans()->dilated(r, s)); }
115 
116 void Footprint::dilate(geom::SpanSet const& other) { setSpans(getSpans()->dilated(other)); }
117 
119  setSpans(getSpans()->eroded(r, s));
121 }
122 
123 void Footprint::erode(geom::SpanSet const& other) {
124  setSpans(getSpans()->eroded(other));
126 }
127 
129  for (auto iter = getPeaks().begin(); iter != getPeaks().end(); ++iter) {
130  if (!getSpans()->contains(geom::Point2I(iter->getIx(), iter->getIy()))) {
131  iter = getPeaks().erase(iter);
132  --iter;
133  }
134  }
135 }
136 
137 std::vector<std::shared_ptr<Footprint>> Footprint::split() const {
138  auto splitSpanSets = getSpans()->split();
139  std::vector<std::shared_ptr<Footprint>> footprintList;
140  footprintList.reserve(splitSpanSets.size());
141  for (auto& spanPtr : splitSpanSets) {
142  auto tmpFootprintPointer = std::make_shared<Footprint>(spanPtr, getPeaks().getSchema(), getRegion());
143  tmpFootprintPointer->_peaks = getPeaks();
144  // No need to remove any peaks, as there is only one Footprint, so it will
145  // simply be a copy of the original
146  if (splitSpanSets.size() > 1) {
147  tmpFootprintPointer->removeOrphanPeaks();
148  }
149  footprintList.push_back(std::move(tmpFootprintPointer));
150  }
151  return footprintList;
152 }
153 
154 bool Footprint::operator==(Footprint const& other) const {
155  /* If the peakCatalogs are not the same length the Footprints can't be equal */
156  if (getPeaks().size() != other.getPeaks().size()) {
157  return false;
158  }
159  /* Check that for every peak in the PeakCatalog there is a corresponding peak
160  * in the other, and if not return false
161  */
162  for (auto const& selfPeak : getPeaks()) {
163  bool match = false;
164  for (auto const& otherPeak : other.getPeaks()) {
165  if (selfPeak.getI() == otherPeak.getI() && selfPeak.getF() == otherPeak.getF() &&
166  selfPeak.getPeakValue() == otherPeak.getPeakValue()) {
167  match = true;
168  break;
169  }
170  }
171  if (!match) {
172  return false;
173  }
174  }
175  /* At this point the PeakCatalogs have evaluated true, compare the SpanSets
176  */
177  return *(getSpans()) == *(other.getSpans());
178 }
179 
180 namespace {
181 std::string getFootprintPersistenceName() { return "Footprint"; }
182 
183 class LegacyFootprintPersistenceHelper {
184 public:
185  table::Schema spanSchema;
186  table::Key<int> spanY;
187  table::Key<int> spanX0;
188  table::Key<int> spanX1;
189 
190  static LegacyFootprintPersistenceHelper const& get() {
191  static LegacyFootprintPersistenceHelper instance;
192  return instance;
193  }
194 
195  // No copying
196  LegacyFootprintPersistenceHelper(const LegacyFootprintPersistenceHelper&) = delete;
197  LegacyFootprintPersistenceHelper& operator=(const LegacyFootprintPersistenceHelper&) = delete;
198 
199  // No moving
200  LegacyFootprintPersistenceHelper(LegacyFootprintPersistenceHelper&&) = delete;
201  LegacyFootprintPersistenceHelper& operator=(LegacyFootprintPersistenceHelper&&) = delete;
202 
203 private:
204  LegacyFootprintPersistenceHelper()
205  : spanSchema(),
206  spanY(spanSchema.addField<int>("y", "The row of the span", "pixel")),
207  spanX0(spanSchema.addField<int>("x0", "First column of span (inclusive)", "pixel")),
208  spanX1(spanSchema.addField<int>("x1", "Second column of span (inclusive)", "pixel")) {
209  spanSchema.getCitizen().markPersistent();
210  }
211 };
212 
213 std::pair<afw::table::Schema&, table::Key<int>&> spanSetPersistenceHelper() {
214  static afw::table::Schema spanSetIdSchema;
215  static int initialize = true;
216  static table::Key<int> idKey;
217  if (initialize) {
218  idKey = spanSetIdSchema.addField<int>("id", "id of the SpanSet catalog");
219  initialize = false;
220  spanSetIdSchema.getCitizen().markPersistent();
221  }
222  std::pair<afw::table::Schema&, table::Key<int>&> returnPair(spanSetIdSchema, idKey);
223  return returnPair;
224 }
225 } // end anonymous namespace
226 
228 public:
229  virtual std::shared_ptr<afw::table::io::Persistable> read(
230  afw::table::io::InputArchive const& archive,
231  afw::table::io::CatalogVector const& catalogs) const override {
232  // Verify there are two catalogs
233  LSST_ARCHIVE_ASSERT(catalogs.size() == 2u);
234  std::shared_ptr<Footprint> loadedFootprint =
235  detection::Footprint::readSpanSet(catalogs.front(), archive);
236  // Now read in the PeakCatalog records
237  detection::Footprint::readPeaks(catalogs.back(), *loadedFootprint);
238  return loadedFootprint;
239  }
240 
241  explicit FootprintFactory(std::string const& name) : afw::table::io::PersistableFactory(name) {}
242 };
243 
244 namespace {
245 // Insert the factory into the registry (instantiating an instance is sufficient, because the
246 // the code that does the work is in the base class ctor)
247 FootprintFactory registration(getFootprintPersistenceName());
248 } // end anonymous namespace
249 
250 std::string Footprint::getPersistenceName() const { return getFootprintPersistenceName(); }
251 
253  // get the span schema and key
254  auto const keys = spanSetPersistenceHelper();
255  // create the output catalog
256  afw::table::BaseCatalog spanSetCat = handle.makeCatalog(keys.first);
257  // create a record that will hold the ID of the recursively saved SpanSet
258  auto record = spanSetCat.addNew();
259  record->set(keys.second, handle.put(getSpans()));
260  handle.saveCatalog(spanSetCat);
261  // save the peaks into a catalog
262  afw::table::BaseCatalog peakCat = handle.makeCatalog(getPeaks().getSchema());
263  peakCat.insert(peakCat.end(), getPeaks().begin(), getPeaks().end(), true);
264  handle.saveCatalog(peakCat);
265 }
266 
267 std::unique_ptr<Footprint> Footprint::readSpanSet(afw::table::BaseCatalog const& catalog,
268  afw::table::io::InputArchive const& archive) {
269  int fieldCount = catalog.getSchema().getFieldCount();
270  LSST_ARCHIVE_ASSERT(fieldCount == 1 || fieldCount == 3);
271  std::shared_ptr<geom::SpanSet> loadedSpanSet;
272  if (fieldCount == 1) {
273  // This is a new style footprint with a SpanSet as a member, treat accordingly
274  auto const schemaAndKey = spanSetPersistenceHelper();
275  int persistedSpanSetId = catalog.front().get(schemaAndKey.second);
276  loadedSpanSet = std::dynamic_pointer_cast<geom::SpanSet>(archive.get(persistedSpanSetId));
277  } else {
278  // This block is for an old style footprint load.
279  auto const& keys = LegacyFootprintPersistenceHelper::get();
280  std::vector<geom::Span> tempVec;
281  tempVec.reserve(catalog.size());
282  for (auto const& val : catalog) {
283  tempVec.push_back(geom::Span(val.get(keys.spanY), val.get(keys.spanX0), val.get(keys.spanX1)));
284  }
285  loadedSpanSet = std::make_shared<geom::SpanSet>(std::move(tempVec));
286  }
287  auto loadedFootprint = std::unique_ptr<Footprint>(new Footprint(loadedSpanSet));
288  return loadedFootprint;
289 }
290 
291 void Footprint::readPeaks(afw::table::BaseCatalog const& peakCat, Footprint& loadedFootprint) {
292  if (!peakCat.getSchema().contains(PeakTable::makeMinimalSchema())) {
293  // need to handle an older form of Peak persistence for backwards compatibility
294  afw::table::SchemaMapper mapper(peakCat.getSchema());
296  afw::table::Key<float> oldX = peakCat.getSchema()["x"];
297  afw::table::Key<float> oldY = peakCat.getSchema()["y"];
298  afw::table::Key<float> oldPeakValue = peakCat.getSchema()["value"];
299  mapper.addMapping(oldX, "f.x");
300  mapper.addMapping(oldY, "f.y");
301  mapper.addMapping(oldPeakValue, "peakValue");
302  loadedFootprint.setPeakSchema(mapper.getOutputSchema());
303  auto peaks = loadedFootprint.getPeaks();
304  peaks.reserve(peakCat.size());
305  for (auto const& peak : peakCat) {
306  auto newPeak = peaks.addNew();
307  newPeak->assign(peak, mapper);
308  newPeak->setIx(static_cast<int>(newPeak->getFx()));
309  newPeak->setIy(static_cast<int>(newPeak->getFy()));
310  }
311  return;
312  }
313  loadedFootprint.setPeakSchema(peakCat.getSchema());
314  auto& peaks = loadedFootprint.getPeaks();
315  peaks.reserve(peakCat.size());
316  for (auto const& peak : peakCat) {
317  peaks.addNew()->assign(peak);
318  }
319 }
320 
321 std::shared_ptr<Footprint> mergeFootprints(Footprint const& footprint1, Footprint const& footprint2) {
322  // Bail out early if the schemas are not the same
323  if (footprint1.getPeaks().getSchema() != footprint2.getPeaks().getSchema()) {
324  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
325  "Cannot merge Footprints with different Schemas");
326  }
327 
328  // Merge the SpanSets
329  auto unionedSpanSet = footprint1.getSpans()->union_(*(footprint2.getSpans()));
330 
331  // Construct merged Footprint
332  auto mergedFootprint = std::make_shared<Footprint>(unionedSpanSet, footprint1.getPeaks().getSchema());
333  // Copy over the peaks from both footprints
334  mergedFootprint->setPeakCatalog(PeakCatalog(footprint1.getPeaks().getTable()));
335  PeakCatalog& peaks = mergedFootprint->getPeaks();
336  peaks.reserve(footprint1.getPeaks().size() + footprint2.getPeaks().size());
337  peaks.insert(peaks.end(), footprint1.getPeaks().begin(), footprint1.getPeaks().end(), true);
338  peaks.insert(peaks.end(), footprint2.getPeaks().begin(), footprint2.getPeaks().end(), true);
339 
340  // Sort the PeaksCatalog according to value
341  mergedFootprint->sortPeaks();
342 
343  return mergedFootprint;
344 }
345 
346 std::vector<geom::Box2I> footprintToBBoxList(Footprint const& footprint) {
347  typedef std::uint16_t PixelT;
348  geom::Box2I fpBBox = footprint.getBBox();
349  std::shared_ptr<image::Image<PixelT>> idImage(new image::Image<PixelT>(fpBBox));
350  *idImage = 0;
351  int const height = fpBBox.getHeight();
352  geom::Extent2I shift(fpBBox.getMinX(), fpBBox.getMinY());
353  footprint.getSpans()->setImage(*idImage, static_cast<PixelT>(1), fpBBox, true);
354 
355  std::vector<geom::Box2I> bboxes;
356  /*
357  * Our strategy is to find a row of pixels in the Footprint and interpret it as the first
358  * row of a rectangular set of pixels. We then extend this rectangle upwards as far as it
359  * will go, and define that as a BBox. We clear all those pixels, and repeat until there
360  * are none left. I.e. a Footprint will get cut up like this:
361  *
362  * .555...
363  * 22.3314
364  * 22.331.
365  * .000.1.
366  * (as shown in Footprint_1.py)
367  */
368 
369  int y0 = 0; // the first row with non-zero pixels in it
370  while (y0 < height) {
371  geom::Box2I bbox; // our next BBox
372  for (int y = y0; y != height; ++y) {
373  // Look for a set pixel in this row
374  image::Image<PixelT>::x_iterator begin = idImage->row_begin(y), end = idImage->row_end(y);
375  image::Image<PixelT>::x_iterator first = std::find(begin, end, 1);
376 
377  if (first != end) { // A pixel is set in this row
378  image::Image<PixelT>::x_iterator last = std::find(first, end, 0) - 1;
379  int const x0 = first - begin;
380  int const x1 = last - begin;
381 
382  std::fill(first, last + 1, 0); // clear pixels; we don't want to see them again
383 
384  bbox.include(geom::Point2I(x0, y)); // the LLC
385  bbox.include(geom::Point2I(x1, y)); // the LRC; initial guess for URC
386 
387  // we found at least one pixel so extend the BBox upwards
388  for (++y; y != height; ++y) {
389  if (std::find(idImage->at(x0, y), idImage->at(x1 + 1, y), 0) != idImage->at(x1 + 1, y)) {
390  break; // some pixels weren't set, so the BBox stops here, (actually in previous row)
391  }
392  std::fill(idImage->at(x0, y), idImage->at(x1 + 1, y), 0);
393 
394  bbox.include(geom::Point2I(x1, y)); // the new URC
395  }
396 
397  bbox.shift(shift);
398  bboxes.push_back(bbox);
399  } else {
400  y0 = y + 1;
401  }
402  break;
403  }
404  }
405 
406  return bboxes;
407 }
408 
410  setPeakCatalog(PeakCatalog(peakSchema));
411 }
412 
413 void Footprint::setPeakCatalog(PeakCatalog const& otherPeaks) {
414  if (!getPeaks().empty()) {
415  throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot change the PeakCatalog unless it is empty");
416  }
417  // this syntax doesn't work in Python, which is why this method has to exist
418  getPeaks() = otherPeaks;
419 }
420 }
421 }
422 } // End lsst::afw::detection namespace
Defines the fields and offsets for a table.
Definition: Schema.h:46
Stencil
An enumeration class which describes the shapes.
Definition: SpanSet.h:64
std::shared_ptr< Persistable > get(int id) const
Load the Persistable with the given ID and return it.
std::vector< std::shared_ptr< Footprint > > split() const
Split a multi-component Footprint into a vector of contiguous Footprints.
Definition: Footprint.cc:137
int put(Persistable const *obj, bool permissive=false)
Save a nested Persistable to the same archive.
int getMinX() const
Definition: Box.h:124
table::Key< std::string > name
Definition: ApCorrMap.cc:71
void shift(Extent2I const &offset)
Shift the position of the box by the given offset.
An object passed to Persistable::write to allow it to persist itself.
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition: Peak.h:117
table::Key< int > spanX1
Definition: Footprint.cc:188
virtual Point2D forwardTransform(Point2D const &point) const =0
virtuals for forward and reverse transforms
A custom container class for records, based on std::vector.
Definition: Catalog.h:96
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:47
A compact representation of a collection of pixels.
Definition: SpanSet.h:75
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
A range of pixels within one row of an Image.
Definition: Span.h:55
void include(Point2I const &point)
Expand this to ensure that this->contains(point).
A base class for factory classes used to reconstruct objects from records.
Definition: Persistable.h:214
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
Definition: Catalog.h:113
Table class for Peaks in Footprints.
Definition: Peak.h:86
void setPeakSchema(afw::table::Schema const &peakSchema)
Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty).
Definition: Footprint.cc:409
void sort(Key< T > const &key)
Sort the catalog in-place by the field with the given key.
Definition: Catalog.h:727
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:137
XYTransformFromWcsPair: An XYTransform obtained by putting two Wcs objects "back to back"...
Definition: Wcs.h:506
Schema getSchema() const
Return the schema associated with the catalog&#39;s table.
Definition: Catalog.h:116
static void readPeaks(afw::table::BaseCatalog const &, Footprint &)
Static method used to unpersist the PeakCatalog member of the Footprint class.
Definition: Footprint.cc:291
void insert(iterator pos, InputIterator first, InputIterator last, bool deep=false)
Insert an iterator range into the table.
Definition: Catalog.h:491
int getHeight() const
Definition: Box.h:155
static afw::table::Key< float > getPeakValueKey()
Get keys for standard fields shared by all peaks.
Definition: Peak.h:149
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition: BaseRecord.h:123
Footprint & operator=(Footprint const &other)=default
An integer coordinate rectangle.
Definition: Box.h:55
bool isValid() const
Return true if the key was initialized to valid offset.
Definition: Key.h:89
A 2D linear coordinate transformation.
void clipTo(geom::Box2I const &bbox)
Clip the Footprint such that all values lie inside the supplied Bounding Box.
Definition: Footprint.cc:71
virtual 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:229
A base class for image defects.
Definition: cameraGeom.dox:3
afw::table::CatalogT< PeakRecord > PeakCatalog
Definition: Peak.h:223
std::shared_ptr< Footprint > transform(std::shared_ptr< image::Wcs > source, std::shared_ptr< image::Wcs > target, geom::Box2I const &region, bool doClip=true) const
Transform the footprint from one WCS to another.
Definition: Footprint.cc:78
reference front() const
Return the first record.
Definition: Catalog.h:431
int end
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
An affine coordinate transformation consisting of a linear transformation and an offset.
iterator end()
Iterator access.
Definition: Catalog.h:388
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:267
void dilate(int r, geom::Stencil s=geom::Stencil::CIRCLE)
Dilate the Footprint with a defined kernel.
Definition: Footprint.cc:114
std::string getPersistenceName() const override
Return the name correspoinging ot the persistence type.
Definition: Footprint.cc:250
iterator erase(iterator pos)
Erase the record pointed to by pos, and return an iterator the next record.
Definition: Catalog.h:538
table::Key< int > spanY
Definition: Footprint.cc:186
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:42
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:321
Class to describe the properties of a detected object from an image.
Definition: Footprint.h:62
void shift(int dx, int dy)
Shift a Footprint by (dx, dy)
Definition: Footprint.cc:61
int getFieldCount() const
The total number of fields.
Definition: Schema.h:147
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
void setPeakCatalog(PeakCatalog const &otherPeaks)
Set the peakCatalog to a copy of the supplied catalog.
Definition: Footprint.cc:413
table::Schema spanSchema
Definition: Footprint.cc:185
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
Definition: Catalog.h:419
A vector of catalogs used by Persistable.
Definition: CatalogVector.h:29
void write(OutputArchiveHandle &handle) const override
Write an instance of a Footprint to an output Archive.
Definition: Footprint.cc:252
geom::Box2I getRegion() const
Return the corners of the MaskedImage the footprints live in.
Definition: Footprint.h:214
table::Key< int > spanX0
Definition: Footprint.cc:187
void addMinimalSchema(Schema const &minimal, bool doMap=true)
Add the given minimal schema to the output schema.
bool operator==(Footprint const &other) const
equality operator
Definition: Footprint.cc:154
Virtual base class for 2D transforms.
Definition: XYTransform.h:49
std::vector< lsst::afw::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:346
void sortPeaks(afw::table::Key< float > const &key=afw::table::Key< float >())
Sort Peaks from most positive value to most negative.
Definition: Footprint.cc:54
std::shared_ptr< PeakRecord > addPeak(float fx, float fy, float value)
Convenience function to add a peak.
Definition: Footprint.cc:44
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:399
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:116
void removeOrphanPeaks()
Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
Definition: Footprint.cc:128
geom::Box2I getBBox() const
Return the Footprint&#39;s bounding box.
Definition: Footprint.h:209
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
FootprintFactory(std::string const &name)
Definition: Footprint.cc:241
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
iterator begin()
Iterator access.
Definition: Catalog.h:387
void erode(int r, geom::Stencil s=geom::Stencil::CIRCLE)
Erode the Footprint with a defined kernel.
Definition: Footprint.cc:118
Record class that represents a peak in a Footprint.
Definition: Peak.h:42
Wrap an AffineTransform.
Definition: XYTransform.h:165
int getMinY() const
Definition: Box.h:125
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:130
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:68
bool contains(geom::Point2I const &pix) const
Tests if a pixel postion falls inside the Footprint.
Definition: Footprint.cc:76
Footprint()
Constructor of a empty Footprint object.
Definition: Footprint.h:96
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:463