LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
39 : _spans(inputSpans), _peaks(
PeakTable::makeMinimalSchema()), _region(region) {}
43 : _spans(inputSpans), _peaks(peakSchema), _region(region) {}
53 p->setPeakValue(height);
60 return a.get(validatedKey) >
b.get(validatedKey);
85 return transform(*srcToTarget, region, doClip);
101 auto transformedSpan =
getSpans()->transformedBy(t);
103 auto newFootprint = std::make_shared<Footprint>(transformedSpan,
getPeaks().getSchema(), region);
110 auto newPeakPosList = t.applyForward(peakPosList);
111 auto newPeakPos = newPeakPosList.cbegin();
113 ++
peak, ++newPeakPos) {
114 newFootprint->addPeak(newPeakPos->getX(), newPeakPos->getY(),
peak->getPeakValue());
117 newFootprint->clipTo(region);
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();
154 if (splitSpanSets.size() > 1) {
155 tmpFootprintPointer->removeOrphanPeaks();
159 return footprintList;
170 for (
auto const& selfPeak :
getPeaks()) {
172 for (
auto const& otherPeak :
other.getPeaks()) {
173 if (selfPeak.getI() == otherPeak.getI() && selfPeak.getF() == otherPeak.getF() &&
174 selfPeak.getPeakValue() == otherPeak.getPeakValue()) {
189 std::string getFootprintPersistenceName() {
return "Footprint"; }
191 class LegacyFootprintPersistenceHelper {
198 static LegacyFootprintPersistenceHelper
const& get() {
199 static LegacyFootprintPersistenceHelper instance;
204 LegacyFootprintPersistenceHelper(
const LegacyFootprintPersistenceHelper&) =
delete;
205 LegacyFootprintPersistenceHelper& operator=(
const LegacyFootprintPersistenceHelper&) =
delete;
208 LegacyFootprintPersistenceHelper(LegacyFootprintPersistenceHelper&&) =
delete;
209 LegacyFootprintPersistenceHelper& operator=(LegacyFootprintPersistenceHelper&&) =
delete;
212 LegacyFootprintPersistenceHelper()
215 spanX0(
spanSchema.addField<int>(
"x0",
"First column of span (inclusive)",
"pixel")),
216 spanX1(
spanSchema.addField<int>(
"x1",
"Second column of span (inclusive)",
"pixel")) {}
220 static afw::table::Schema spanSetIdSchema;
221 static int initialize =
true;
222 static table::Key<int> idKey;
224 idKey = spanSetIdSchema.addField<
int>(
"id",
"id of the SpanSet catalog");
243 return loadedFootprint;
252 FootprintFactory registration(getFootprintPersistenceName());
259 auto const keys = spanSetPersistenceHelper();
263 auto record = spanSetCat.
addNew();
277 if (fieldCount == 1) {
279 auto const schemaAndKey = spanSetPersistenceHelper();
280 int persistedSpanSetId = catalog.
front().
get(schemaAndKey.second);
281 loadedSpanSet = std::dynamic_pointer_cast<geom::SpanSet>(archive.
get(persistedSpanSetId));
284 auto const&
keys = LegacyFootprintPersistenceHelper::get();
287 for (
auto const&
val : catalog) {
290 loadedSpanSet = std::make_shared<geom::SpanSet>(
std::move(tempVec));
293 return loadedFootprint;
297 using namespace std::string_literals;
305 mapper.addMapping(oldX,
"f.x"s);
306 mapper.addMapping(oldY,
"f.y"s);
307 mapper.addMapping(oldPeakValue,
"peakValue"s);
309 auto peaks = loadedFootprint.
getPeaks();
311 for (
auto const&
peak : peakCat) {
312 auto newPeak = peaks.addNew();
314 newPeak->setIx(
static_cast<int>(newPeak->getFx()));
315 newPeak->setIy(
static_cast<int>(newPeak->getFy()));
320 auto& peaks = loadedFootprint.
getPeaks();
322 for (
auto const&
peak : peakCat) {
323 peaks.addNew()->assign(
peak);
331 "Cannot merge Footprints with different Schemas");
335 auto unionedSpanSet = footprint1.
getSpans()->union_(*(footprint2.
getSpans()));
338 auto mergedFootprint = std::make_shared<Footprint>(unionedSpanSet, footprint1.
getPeaks().
getSchema());
347 mergedFootprint->sortPeaks();
349 return mergedFootprint;
359 footprint.
getSpans()->setImage(*idImage,
static_cast<PixelT>(1), fpBBox,
true);
376 while (y0 < height) {
378 for (
int y = y0;
y != height; ++
y) {
385 int const x0 =
first - begin;
386 int const x1 = last - begin;
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)) {
398 std::fill(idImage->at(x0,
y), idImage->at(x1 + 1,
y), 0);
Record class that represents a peak in a Footprint.
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
int getHeight() const noexcept
iterator erase(iterator pos)
Erase the record pointed to by pos, and return an iterator the next record.
An object passed to Persistable::write to allow it to persist itself.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
Defines the fields and offsets for a table.
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
PersistableFactory(std::string const &name)
Constructor for the factory.
void reserve(size_type n)
Increase the capacity of the catalog to the given size.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
size_type size() const
Return the number of elements in the catalog.
const char * source()
Source function that allows astChannel to source from a Stream.
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...
lsst::afw::detection::Footprint Footprint
ItemVariant const * other
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
Reports errors in the logical structure of the program.
A mapping between the keys of two Schemas, used to copy data between them.
A vector of catalogs used by Persistable.
Schema getSchema() const
Return the schema associated with the catalog's table.
Transform< Point2Endpoint, Point2Endpoint > TransformPoint2ToPoint2
afw::table::CatalogT< PeakRecord > PeakCatalog
A base class for factory classes used to reconstruct objects from records.
void sort(Key< T > const &key)
Sort the catalog in-place by the field with the given key.
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Key< Flag > const & target
void insert(iterator pos, InputIterator first, InputIterator last, bool deep=false)
Insert an iterator range into the table.
T emplace_back(T... args)
int getFieldCount() const
The total number of fields.
Reports invalid arguments.
std::shared_ptr< TransformPoint2ToPoint2 > makeWcsPairTransform(SkyWcs const &src, SkyWcs const &dst)
A Transform obtained by putting two SkyWcs objects "back to back".
reference front() const
Return the first record.
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.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
An integer coordinate rectangle.
int getMinX() const noexcept
Table class for Peaks in Footprints.
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...
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
A class to represent a 2-dimensional array of pixels.
iterator begin()
Iterator access.
static afw::table::Key< float > getPeakValueKey()
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(lsst::geom::AffineTransform const &affine)
Wrap an lsst::geom::AffineTransform as a Transform.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Stencil
An enumeration class which describes the shapes.
int getMinY() const noexcept