LSSTApplications  19.0.0-10-g920eed2,19.0.0-11-g48a0200+2,19.0.0-18-gfc4e62b+10,19.0.0-2-g3b2f90d+2,19.0.0-2-gd671419+5,19.0.0-20-g5a5a17ab+8,19.0.0-21-g2644856+10,19.0.0-22-gc5dc5b1+5,19.0.0-23-gdc29a50+2,19.0.0-24-g923e380+10,19.0.0-25-g6c8df7140,19.0.0-27-g567f04d+6,19.0.0-3-g2b32d65+5,19.0.0-3-g8227491+9,19.0.0-3-g9c54d0d+9,19.0.0-3-gca68e65+5,19.0.0-3-gcfc5f51+5,19.0.0-3-ge110943+8,19.0.0-3-ge74d124,19.0.0-3-gfe04aa6+10,19.0.0-4-g06f5963+5,19.0.0-4-g3d16501+10,19.0.0-4-g4a9c019+5,19.0.0-4-g5a8b323,19.0.0-4-g66397f0+1,19.0.0-4-g8278b9b+1,19.0.0-4-g8557e14,19.0.0-4-g8964aba+10,19.0.0-4-ge404a01+9,19.0.0-5-g40f3a5a,19.0.0-5-g4db63b3,19.0.0-5-gfb03ce7+10,19.0.0-6-gbaebbfb+9,19.0.0-60-gafafd468+10,19.0.0-64-gf672fef+7,19.0.0-7-g039c0b5+8,19.0.0-7-gbea9075+4,19.0.0-7-gc567de5+10,19.0.0-8-g3a3ce09+5,19.0.0-9-g463f923+9,w.2020.21
LSSTDataManagementBasePackage
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 
30 namespace lsst {
31 namespace afw {
32 
33 template std::shared_ptr<detection::Footprint> table::io::PersistableFacade<
35 
36 namespace 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 
45 void Footprint::setSpans(std::shared_ptr<geom::SpanSet> otherSpanSet) { _spans = otherSpanSet; }
46 
47 std::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 
64 void 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 
79 bool 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 
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 
122 void Footprint::dilate(int r, geom::Stencil s) { setSpans(getSpans()->dilated(r, s)); }
123 
124 void Footprint::dilate(geom::SpanSet const& other) { setSpans(getSpans()->dilated(other)); }
125 
127  setSpans(getSpans()->eroded(r, s));
129 }
130 
131 void 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 splitSpanSets = getSpans()->split();
148  footprintList.reserve(splitSpanSets.size());
149  for (auto& spanPtr : splitSpanSets) {
150  auto tmpFootprintPointer = std::make_shared<Footprint>(spanPtr, getPeaks().getSchema(), getRegion());
151  tmpFootprintPointer->_peaks = getPeaks();
152  // No need to remove any peaks, as there is only one Footprint, so it will
153  // simply be a copy of the original
154  if (splitSpanSets.size() > 1) {
155  tmpFootprintPointer->removeOrphanPeaks();
156  }
157  footprintList.push_back(std::move(tmpFootprintPointer));
158  }
159  return footprintList;
160 }
161 
163  /* If the peakCatalogs are not the same length the Footprints can't be equal */
164  if (getPeaks().size() != other.getPeaks().size()) {
165  return false;
166  }
167  /* Check that for every peak in the PeakCatalog there is a corresponding peak
168  * in the other, and if not return false
169  */
170  for (auto const& selfPeak : getPeaks()) {
171  bool match = false;
172  for (auto const& otherPeak : other.getPeaks()) {
173  if (selfPeak.getI() == otherPeak.getI() && selfPeak.getF() == otherPeak.getF() &&
174  selfPeak.getPeakValue() == otherPeak.getPeakValue()) {
175  match = true;
176  break;
177  }
178  }
179  if (!match) {
180  return false;
181  }
182  }
183  /* At this point the PeakCatalogs have evaluated true, compare the SpanSets
184  */
185  return *(getSpans()) == *(other.getSpans());
186 }
187 
188 namespace {
189 std::string getFootprintPersistenceName() { return "Footprint"; }
190 
191 class LegacyFootprintPersistenceHelper {
192 public:
193  table::Schema spanSchema;
194  table::Key<int> spanY;
195  table::Key<int> spanX0;
196  table::Key<int> spanX1;
197 
198  static LegacyFootprintPersistenceHelper const& get() {
199  static LegacyFootprintPersistenceHelper instance;
200  return instance;
201  }
202 
203  // No copying
204  LegacyFootprintPersistenceHelper(const LegacyFootprintPersistenceHelper&) = delete;
205  LegacyFootprintPersistenceHelper& operator=(const LegacyFootprintPersistenceHelper&) = delete;
206 
207  // No moving
208  LegacyFootprintPersistenceHelper(LegacyFootprintPersistenceHelper&&) = delete;
209  LegacyFootprintPersistenceHelper& operator=(LegacyFootprintPersistenceHelper&&) = delete;
210 
211 private:
212  LegacyFootprintPersistenceHelper()
213  : spanSchema(),
214  spanY(spanSchema.addField<int>("y", "The row of the span", "pixel")),
215  spanX0(spanSchema.addField<int>("x0", "First column of span (inclusive)", "pixel")),
216  spanX1(spanSchema.addField<int>("x1", "Second column of span (inclusive)", "pixel")) {}
217 };
218 
219 std::pair<afw::table::Schema&, table::Key<int>&> spanSetPersistenceHelper() {
220  static afw::table::Schema spanSetIdSchema;
221  static int initialize = true;
222  static table::Key<int> idKey;
223  if (initialize) {
224  idKey = spanSetIdSchema.addField<int>("id", "id of the SpanSet catalog");
225  initialize = false;
226  }
227  std::pair<afw::table::Schema&, table::Key<int>&> returnPair(spanSetIdSchema, idKey);
228  return returnPair;
229 }
230 } // end anonymous namespace
231 
233 public:
235  afw::table::io::InputArchive const& archive,
236  afw::table::io::CatalogVector const& catalogs) const override {
237  // Verify there are two catalogs
238  LSST_ARCHIVE_ASSERT(catalogs.size() == 2u);
239  std::shared_ptr<Footprint> loadedFootprint =
240  detection::Footprint::readSpanSet(catalogs.front(), archive);
241  // Now read in the PeakCatalog records
242  detection::Footprint::readPeaks(catalogs.back(), *loadedFootprint);
243  return loadedFootprint;
244  }
245 
246  explicit FootprintFactory(std::string const& name) : afw::table::io::PersistableFactory(name) {}
247 };
248 
249 namespace {
250 // Insert the factory into the registry (instantiating an instance is sufficient, because the
251 // the code that does the work is in the base class ctor)
252 FootprintFactory registration(getFootprintPersistenceName());
253 } // end anonymous namespace
254 
255 std::string Footprint::getPersistenceName() const { return getFootprintPersistenceName(); }
256 
258  // get the span schema and key
259  auto const keys = spanSetPersistenceHelper();
260  // create the output catalog
261  afw::table::BaseCatalog spanSetCat = handle.makeCatalog(keys.first);
262  // create a record that will hold the ID of the recursively saved SpanSet
263  auto record = spanSetCat.addNew();
264  record->set(keys.second, handle.put(getSpans()));
265  handle.saveCatalog(spanSetCat);
266  // save the peaks into a catalog
267  afw::table::BaseCatalog peakCat = handle.makeCatalog(getPeaks().getSchema());
268  peakCat.insert(peakCat.end(), getPeaks().begin(), getPeaks().end(), true);
269  handle.saveCatalog(peakCat);
270 }
271 
273  afw::table::io::InputArchive const& archive) {
274  int fieldCount = catalog.getSchema().getFieldCount();
275  LSST_ARCHIVE_ASSERT(fieldCount == 1 || fieldCount == 3);
276  std::shared_ptr<geom::SpanSet> loadedSpanSet;
277  if (fieldCount == 1) {
278  // This is a new style footprint with a SpanSet as a member, treat accordingly
279  auto const schemaAndKey = spanSetPersistenceHelper();
280  int persistedSpanSetId = catalog.front().get(schemaAndKey.second);
281  loadedSpanSet = std::dynamic_pointer_cast<geom::SpanSet>(archive.get(persistedSpanSetId));
282  } else {
283  // This block is for an old style footprint load.
284  auto const& keys = LegacyFootprintPersistenceHelper::get();
285  std::vector<geom::Span> tempVec;
286  tempVec.reserve(catalog.size());
287  for (auto const& val : catalog) {
288  tempVec.push_back(geom::Span(val.get(keys.spanY), val.get(keys.spanX0), val.get(keys.spanX1)));
289  }
290  loadedSpanSet = std::make_shared<geom::SpanSet>(std::move(tempVec));
291  }
292  auto loadedFootprint = std::unique_ptr<Footprint>(new Footprint(loadedSpanSet));
293  return loadedFootprint;
294 }
295 
296 void Footprint::readPeaks(afw::table::BaseCatalog const& peakCat, Footprint& loadedFootprint) {
297  using namespace std::string_literals;
298  if (!peakCat.getSchema().contains(PeakTable::makeMinimalSchema())) {
299  // need to handle an older form of Peak persistence for backwards compatibility
301  mapper.addMinimalSchema(PeakTable::makeMinimalSchema());
302  afw::table::Key<float> oldX = peakCat.getSchema()["x"];
303  afw::table::Key<float> oldY = peakCat.getSchema()["y"];
304  afw::table::Key<float> oldPeakValue = peakCat.getSchema()["value"];
305  mapper.addMapping(oldX, "f.x"s);
306  mapper.addMapping(oldY, "f.y"s);
307  mapper.addMapping(oldPeakValue, "peakValue"s);
308  loadedFootprint.setPeakSchema(mapper.getOutputSchema());
309  auto peaks = loadedFootprint.getPeaks();
310  peaks.reserve(peakCat.size());
311  for (auto const& peak : peakCat) {
312  auto newPeak = peaks.addNew();
313  newPeak->assign(peak, mapper);
314  newPeak->setIx(static_cast<int>(newPeak->getFx()));
315  newPeak->setIy(static_cast<int>(newPeak->getFy()));
316  }
317  return;
318  }
319  loadedFootprint.setPeakSchema(peakCat.getSchema());
320  auto& peaks = loadedFootprint.getPeaks();
321  peaks.reserve(peakCat.size());
322  for (auto const& peak : peakCat) {
323  peaks.addNew()->assign(peak);
324  }
325 }
326 
327 std::shared_ptr<Footprint> mergeFootprints(Footprint const& footprint1, Footprint const& footprint2) {
328  // Bail out early if the schemas are not the same
329  if (footprint1.getPeaks().getSchema() != footprint2.getPeaks().getSchema()) {
331  "Cannot merge Footprints with different Schemas");
332  }
333 
334  // Merge the SpanSets
335  auto unionedSpanSet = footprint1.getSpans()->union_(*(footprint2.getSpans()));
336 
337  // Construct merged Footprint
338  auto mergedFootprint = std::make_shared<Footprint>(unionedSpanSet, footprint1.getPeaks().getSchema());
339  // Copy over the peaks from both footprints
340  mergedFootprint->setPeakCatalog(PeakCatalog(footprint1.getPeaks().getTable()));
341  PeakCatalog& peaks = mergedFootprint->getPeaks();
342  peaks.reserve(footprint1.getPeaks().size() + footprint2.getPeaks().size());
343  peaks.insert(peaks.end(), footprint1.getPeaks().begin(), footprint1.getPeaks().end(), true);
344  peaks.insert(peaks.end(), footprint2.getPeaks().begin(), footprint2.getPeaks().end(), true);
345 
346  // Sort the PeaksCatalog according to value
347  mergedFootprint->sortPeaks();
348 
349  return mergedFootprint;
350 }
351 
353  typedef std::uint16_t PixelT;
354  lsst::geom::Box2I fpBBox = footprint.getBBox();
356  *idImage = 0;
357  int const height = fpBBox.getHeight();
358  lsst::geom::Extent2I shift(fpBBox.getMinX(), fpBBox.getMinY());
359  footprint.getSpans()->setImage(*idImage, static_cast<PixelT>(1), fpBBox, true);
360 
362  /*
363  * Our strategy is to find a row of pixels in the Footprint and interpret it as the first
364  * row of a rectangular set of pixels. We then extend this rectangle upwards as far as it
365  * will go, and define that as a BBox. We clear all those pixels, and repeat until there
366  * are none left. I.e. a Footprint will get cut up like this:
367  *
368  * .555...
369  * 22.3314
370  * 22.331.
371  * .000.1.
372  * (as shown in Footprint_1.py)
373  */
374 
375  int y0 = 0; // the first row with non-zero pixels in it
376  while (y0 < height) {
377  lsst::geom::Box2I bbox; // our next BBox
378  for (int y = y0; y != height; ++y) {
379  // Look for a set pixel in this row
380  image::Image<PixelT>::x_iterator begin = idImage->row_begin(y), end = idImage->row_end(y);
382 
383  if (first != end) { // A pixel is set in this row
385  int const x0 = first - begin;
386  int const x1 = last - begin;
387 
388  std::fill(first, last + 1, 0); // clear pixels; we don't want to see them again
389 
390  bbox.include(lsst::geom::Point2I(x0, y)); // the LLC
391  bbox.include(lsst::geom::Point2I(x1, y)); // the LRC; initial guess for URC
392 
393  // we found at least one pixel so extend the BBox upwards
394  for (++y; y != height; ++y) {
395  if (std::find(idImage->at(x0, y), idImage->at(x1 + 1, y), 0) != idImage->at(x1 + 1, y)) {
396  break; // some pixels weren't set, so the BBox stops here, (actually in previous row)
397  }
398  std::fill(idImage->at(x0, y), idImage->at(x1 + 1, y), 0);
399 
400  bbox.include(lsst::geom::Point2I(x1, y)); // the new URC
401  }
402 
403  bbox.shift(shift);
404  bboxes.push_back(bbox);
405  } else {
406  y0 = y + 1;
407  }
408  break;
409  }
410  }
411 
412  return bboxes;
413 }
414 
416  setPeakCatalog(PeakCatalog(peakSchema));
417 }
418 
419 void Footprint::setPeakCatalog(PeakCatalog const& otherPeaks) {
420  if (!getPeaks().empty()) {
421  throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot change the PeakCatalog unless it is empty");
422  }
423  // this syntax doesn't work in Python, which is why this method has to exist
424  getPeaks() = otherPeaks;
425 }
426 } // namespace detection
427 } // namespace afw
428 } // namespace lsst
y
int y
Definition: SpanSet.cc:49
lsst::afw::table::CatalogT::end
iterator end()
Definition: Catalog.h:397
lsst::afw::detection::Footprint::getBBox
lsst::geom::Box2I getBBox() const
Return the Footprint's bounding box.
Definition: Footprint.h:208
lsst::afw::detection::Footprint::operator==
bool operator==(Footprint const &other) const
equality operator
Definition: Footprint.cc:162
std::string
STL class.
std::shared_ptr
STL class.
lsst::afw::detection::Footprint::getPersistenceName
std::string getPersistenceName() const override
Return the name correspoinging ot the persistence type.
Definition: Footprint.cc:255
lsst::afw::detection::PeakRecord
Record class that represents a peak in a Footprint.
Definition: Peak.h:42
std::move
T move(T... args)
lsst::afw::detection::Footprint::getPeaks
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition: Footprint.h:129
lsst::afw::table::BaseRecord::get
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition: BaseRecord.h:151
LSST_ARCHIVE_ASSERT
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
lsst::afw::detection::Footprint::dilate
void dilate(int r, geom::Stencil s=geom::Stencil::CIRCLE)
Dilate the Footprint with a defined kernel.
Definition: Footprint.cc:122
lsst::geom::Box2I::getHeight
int getHeight() const noexcept
Definition: Box.h:188
std::pair
std::vector::reserve
T reserve(T... args)
lsst::afw::table::CatalogT::erase
iterator erase(iterator pos)
Erase the record pointed to by pos, and return an iterator the next record.
Definition: Catalog.h:560
lsst::afw::table::io::OutputArchiveHandle
An object passed to Persistable::write to allow it to persist itself.
Definition: OutputArchive.h:118
std::vector
STL class.
std::find
T find(T... args)
std::vector::size
T size(T... args)
lsst::afw::table::io::OutputArchiveHandle::saveCatalog
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
Definition: OutputArchive.cc:211
lsst::geom::LinearTransform
A 2D linear coordinate transformation.
Definition: LinearTransform.h:69
lsst::afw::detection::Footprint::readSpanSet
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:272
lsst::afw::table._match.first
first
Definition: _match.py:76
lsst::ip::diffim::detail::PixelT
float PixelT
Definition: AssessSpatialKernelVisitor.cc:208
spanSchema
table::Schema spanSchema
Definition: Footprint.cc:193
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::table::io::InputArchive
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
lsst::afw::detection::Footprint::Footprint
Footprint()
Constructor of a empty Footprint object.
Definition: Footprint.h:96
lsst::afw::detection::Footprint::getSpans
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition: Footprint.h:115
lsst::afw::detection::Footprint::shift
void shift(int dx, int dy)
Shift a Footprint by (dx, dy)
Definition: Footprint.cc:64
astshim.keyMap.keyMapContinued.keys
def keys(self)
Definition: keyMapContinued.py:6
lsst::afw::table::Schema
Defines the fields and offsets for a table.
Definition: Schema.h:50
CatalogVector.h
lsst::afw::detection::Footprint::getRegion
lsst::geom::Box2I getRegion() const
Return the corners of the MaskedImage the footprints live in.
Definition: Footprint.h:213
std::vector::back
T back(T... args)
val
ImageT val
Definition: CR.cc:146
lsst::afw::geom.transform.transformContinued.name
string name
Definition: transformContinued.py:32
std::vector::front
T front(T... args)
lsst::afw::detection::PeakTable::makeMinimalSchema
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition: Peak.h:137
end
int end
Definition: BoundedField.cc:105
lsst::afw::table::io::PersistableFactory::PersistableFactory
PersistableFactory(std::string const &name)
Constructor for the factory.
Definition: Persistable.cc:74
lsst::afw::table::CatalogT::reserve
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
Definition: Catalog.h:428
std::fill
T fill(T... args)
std::vector::push_back
T push_back(T... args)
lsst::afw::table::io::OutputArchiveHandle::makeCatalog
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
Definition: OutputArchive.cc:207
lsst::afw::detection::FootprintFactory::read
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:234
lsst::geom::AffineTransform
An affine coordinate transformation consisting of a linear transformation and an offset.
Definition: AffineTransform.h:75
lsst::afw::detection::Footprint::sortPeaks
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
lsst::afw::detection::Footprint::contains
bool contains(lsst::geom::Point2I const &pix) const
Tests if a pixel postion falls inside the Footprint.
Definition: Footprint.cc:79
lsst::afw::table::CatalogT::size
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:408
lsst::afw::detection::Footprint::removeOrphanPeaks
void removeOrphanPeaks()
Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
Definition: Footprint.cc:136
ast::detail::source
const char * source()
Source function that allows astChannel to source from a Stream.
Definition: Stream.h:224
lsst::afw::detection::Footprint::setPeakCatalog
void setPeakCatalog(PeakCatalog const &otherPeaks)
Set the peakCatalog to a copy of the supplied catalog.
Definition: Footprint.cc:419
spanX0
table::Key< int > spanX0
Definition: Footprint.cc:195
lsst::afw::detection::footprintToBBoxList
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:352
transformFactory.h
lsst::afw::table::Footprint
lsst::afw::detection::Footprint Footprint
Definition: Source.h:59
lsst::afw::detection::Footprint::write
void write(OutputArchiveHandle &handle) const override
Write an instance of a Footprint to an output Archive.
Definition: Footprint.cc:257
lsst::afw::detection::Footprint::readPeaks
static void readPeaks(afw::table::BaseCatalog const &, Footprint &)
Static method used to unpersist the PeakCatalog member of the Footprint class.
Definition: Footprint.cc:296
other
ItemVariant const * other
Definition: Schema.cc:56
lsst::afw::detection::Footprint::setSpans
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition: Footprint.cc:45
lsst::afw::table::CatalogT::getTable
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
Definition: Catalog.h:114
lsst::pex::exceptions::LogicError
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
lsst::afw::table::SchemaMapper
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
lsst::afw::table::io::CatalogVector
A vector of catalogs used by Persistable.
Definition: CatalogVector.h:29
lsst::afw::table::CatalogT::getSchema
Schema getSchema() const
Return the schema associated with the catalog's table.
Definition: Catalog.h:117
lsst::afw::geom::TransformPoint2ToPoint2
Transform< Point2Endpoint, Point2Endpoint > TransformPoint2ToPoint2
Definition: Transform.h:300
lsst::afw::detection::PeakCatalog
afw::table::CatalogT< PeakRecord > PeakCatalog
Definition: Peak.h:244
Persistable.cc
lsst::afw::table::Key< float >
Footprint.h
lsst::afw::table::io::PersistableFactory
A base class for factory classes used to reconstruct objects from records.
Definition: Persistable.h:228
lsst::afw::detection::Footprint::erode
void erode(int r, geom::Stencil s=geom::Stencil::CIRCLE)
Erode the Footprint with a defined kernel.
Definition: Footprint.cc:126
lsst::afw::detection::FootprintFactory
Definition: Footprint.cc:232
std::uint16_t
lsst::afw::table::CatalogT::sort
void sort(Key< T > const &key)
Sort the catalog in-place by the field with the given key.
Definition: Catalog.h:749
lsst.pipe.tasks.mergeDetections.peak
peak
Definition: mergeDetections.py:380
lsst::afw::image::ImageBase::x_iterator
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
Definition: ImageBase.h:133
b
table::Key< int > b
Definition: TransmissionCurve.cc:467
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
target
Key< Flag > const & target
Definition: BaseColumnView.cc:20
lsst::afw::table::CatalogT::insert
void insert(iterator pos, InputIterator first, InputIterator last, bool deep=false)
Insert an iterator range into the table.
Definition: Catalog.h:513
std::vector::emplace_back
T emplace_back(T... args)
lsst::afw::detection::Footprint::addPeak
std::shared_ptr< PeakRecord > addPeak(float fx, float fy, float value)
Convenience function to add a peak.
Definition: Footprint.cc:47
lsst::afw::table::Schema::getFieldCount
int getFieldCount() const
The total number of fields.
Definition: Schema.h:151
lsst::pex::exceptions::InvalidParameterError
Reports invalid arguments.
Definition: Runtime.h:66
lsst::afw::detection::Footprint::setPeakSchema
void setPeakSchema(afw::table::Schema const &peakSchema)
Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty).
Definition: Footprint.cc:415
lsst::afw::geom::makeWcsPairTransform
std::shared_ptr< TransformPoint2ToPoint2 > makeWcsPairTransform(SkyWcs const &src, SkyWcs const &dst)
A Transform obtained by putting two SkyWcs objects "back to back".
Definition: SkyWcs.cc:151
lsst::afw::table::CatalogT::front
reference front() const
Return the first record.
Definition: Catalog.h:453
a
table::Key< int > a
Definition: TransmissionCurve.cc:466
lsst::afw::detection::mergeFootprints
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:327
lsst::afw::detection::Footprint::clipTo
void clipTo(lsst::geom::Box2I const &bbox)
Clip the Footprint such that all values lie inside the supplied Bounding Box.
Definition: Footprint.cc:74
key
Key< U > key
Definition: Schema.cc:281
lsst::geom::Point< int, 2 >
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
mapper
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
lsst::geom::Box2I::getMinX
int getMinX() const noexcept
Definition: Box.h:157
lsst::afw::detection::PeakTable
Table class for Peaks in Footprints.
Definition: Peak.h:102
lsst::afw::table::io::OutputArchiveHandle::put
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...
Definition: OutputArchive.cc:216
lsst::afw::table::CatalogT::addNew
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:485
lsst::afw::detection::FootprintFactory::FootprintFactory
FootprintFactory(std::string const &name)
Definition: Footprint.cc:246
lsst::afw::detection::Footprint
Class to describe the properties of a detected object from an image.
Definition: Footprint.h:63
lsst::afw::image::Image
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:58
lsst::afw::table::CatalogT::begin
iterator begin()
Iterator access.
Definition: Catalog.h:396
spanX1
table::Key< int > spanX1
Definition: Footprint.cc:196
std::unique_ptr
STL class.
lsst::afw::detection::PeakTable::getPeakValueKey
static afw::table::Key< float > getPeakValueKey()
Definition: Peak.h:169
lsst::afw::detection::Footprint::transform
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
lsst::afw::geom::makeTransform
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(lsst::geom::AffineTransform const &affine)
Wrap an lsst::geom::AffineTransform as a Transform.
Definition: transformFactory.cc:154
lsst::afw::table::Schema::contains
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Definition: Schema.cc:679
lsst::afw::table::CatalogT< BaseRecord >
lsst::geom::Extent< int, 2 >
lsst::afw::geom::Stencil
Stencil
An enumeration class which describes the shapes.
Definition: SpanSet.h:66
astshim.fitsChanContinued.iter
def iter(self)
Definition: fitsChanContinued.py:88
OutputArchive.h
bbox
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
lsst::afw::detection::Footprint::split
std::vector< std::shared_ptr< Footprint > > split() const
Split a multi-component Footprint into a vector of contiguous Footprints.
Definition: Footprint.cc:145
spanY
table::Key< int > spanY
Definition: Footprint.cc:194
lsst::geom::Box2I::getMinY
int getMinY() const noexcept
Definition: Box.h:158
lsst::afw::table::io::InputArchive::get
std::shared_ptr< Persistable > get(int id) const
Load the Persistable with the given ID and return it.
Definition: InputArchive.cc:182