LSST Applications g063fba187b+fee0456c91,g0f08755f38+ea96e5a5a3,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+90257ff92a,g20f6ffc8e0+ea96e5a5a3,g217e2c1bcf+937a289c59,g28da252d5a+daa7da44eb,g2bbee38e9b+253935c60e,g2bc492864f+253935c60e,g3156d2b45e+6e55a43351,g32e5bea42b+31359a2a7a,g347aa1857d+253935c60e,g35bb328faa+a8ce1bb630,g3a166c0a6a+253935c60e,g3b1af351f3+a8ce1bb630,g3e281a1b8c+c5dd892a6c,g414038480c+416496e02f,g41af890bb2+afe91b1188,g599934f4f4+0db33f7991,g7af13505b9+e36de7bce6,g80478fca09+da231ba887,g82479be7b0+a4516e59e3,g858d7b2824+ea96e5a5a3,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+bc6ab8dfbd,gb58c049af0+d64f4d3760,gc28159a63d+253935c60e,gcab2d0539d+3f2b72788c,gcf0d15dbbd+4ea9c45075,gda6a2b7d83+4ea9c45075,gdaeeff99f8+1711a396fd,ge79ae78c31+253935c60e,gef2f8181fd+3031e3cf99,gf0baf85859+c1f95f4921,gfa517265be+ea96e5a5a3,gfa999e8aa5+17cd334064,w.2024.50
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
lsst::afw::detection::FootprintMergeList Class Referencefinal

List of Merged Footprints. More...

#include <FootprintMerge.h>

Public Member Functions

 FootprintMergeList (afw::table::Schema &sourceSchema, std::vector< std::string > const &filterList, afw::table::Schema const &initialPeakSchema)
 Initialize the merge with a custom initial peak schema.
 
 FootprintMergeList (afw::table::Schema &sourceSchema, std::vector< std::string > const &filterList)
 Initialize the merge with the default peak schema.
 
 ~FootprintMergeList ()
 
 FootprintMergeList (FootprintMergeList const &)
 
 FootprintMergeList (FootprintMergeList &&)
 
FootprintMergeListoperator= (FootprintMergeList const &)
 
FootprintMergeListoperator= (FootprintMergeList &&)
 
afw::table::Schema getPeakSchema () const
 Return the schema for PeakRecords in the merged footprints.
 
void addCatalog (std::shared_ptr< afw::table::SourceTable > sourceTable, afw::table::SourceCatalog const &inputCat, std::string const &filter, float minNewPeakDist=-1., bool doMerge=true, float maxSamePeakDist=-1.)
 Add objects from a SourceCatalog in the specified filter.
 
void clearCatalog ()
 Clear entries in the current vector.
 
void getFinalSources (afw::table::SourceCatalog &outputCat)
 Get SourceCatalog with entries that contain the final Footprint and SourceRecord for each entry.
 

Friends

class FootprintMerge
 

Detailed Description

List of Merged Footprints.

Stores a vector of FootprintMerges and SourceRecords that contain the union of different footprints and which filters it was detected in. Individual Footprints from a SourceCatalog can be added to the vector (note that any SourceRecords with parent!=0 will be skipped). If a Footprint overlaps an existing FootprintMerge, the Footprint will be added to it. If not, then a new FootprintMerge will be created and added to the vector.

The search algorithm uses a brute force approach over the current list. This should be fine if we are operating on smallish number of objects, such as at the tract level.

Definition at line 56 of file FootprintMerge.h.

Constructor & Destructor Documentation

◆ FootprintMergeList() [1/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( afw::table::Schema & sourceSchema,
std::vector< std::string > const & filterList,
afw::table::Schema const & initialPeakSchema )

Initialize the merge with a custom initial peak schema.

Parameters
[in,out]sourceSchemaInput schema for SourceRecords to be merged, modified on return to include 'merge_footprint_<filter>' Flag fields that will indicate the origin of the source.
[in]filterListSequence of filter names to be used in Flag fields.
[in]initialPeakSchemaInput schema of PeakRecords in Footprints to be merged.

The output schema for PeakRecords will include additional 'merge_peak_<filter>' Flag fields that indicate the origin of peaks. This can be accessed by getPeakSchema().

Definition at line 205 of file FootprintMerge.cc.

208 : _peakSchemaMapper(initialPeakSchema) {
209 _initialize(sourceSchema, filterList);
210}

◆ FootprintMergeList() [2/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( afw::table::Schema & sourceSchema,
std::vector< std::string > const & filterList )

Initialize the merge with the default peak schema.

Parameters
[in,out]sourceSchemaInput schema for SourceRecords to be merged, modified on return to include 'merge_footprint_<filter>' Flag fields that will indicate the origin of the source.
[in]filterListSequence of filter names to be used in Flag fields.

The output schema for PeakRecords will include additional 'merge_peak_<filter>' Flag fields that indicate the origin of peaks. This can be accessed by getPeakSchema().

Definition at line 212 of file FootprintMerge.cc.

214 : _peakSchemaMapper(PeakTable::makeMinimalSchema()) {
215 _initialize(sourceSchema, filterList);
216}
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition Peak.h:137

◆ ~FootprintMergeList()

lsst::afw::detection::FootprintMergeList::~FootprintMergeList ( )
default

◆ FootprintMergeList() [3/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( FootprintMergeList const & )
default

◆ FootprintMergeList() [4/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( FootprintMergeList && )
default

Member Function Documentation

◆ addCatalog()

void lsst::afw::detection::FootprintMergeList::addCatalog ( std::shared_ptr< afw::table::SourceTable > sourceTable,
afw::table::SourceCatalog const & inputCat,
std::string const & filter,
float minNewPeakDist = -1.,
bool doMerge = true,
float maxSamePeakDist = -1. )

Add objects from a SourceCatalog in the specified filter.

Iterate over all objects that have not been deblendend and search for an overlapping FootprintMerge in _mergeList. If it overlaps, then it will be added to it, otherwise it will create a new one. If minNewPeakDist < 0, then new peaks will not be added to existing footprints. If minNewPeakDist >= 0, then new peaks will be added that are farther away than minNewPeakDist to the nearest existing peak.

The SourceTable is used to create new SourceRecords that store the filter information.

Definition at line 239 of file FootprintMerge.cc.

241 {
242 FilterMap::const_iterator keyIter = _filterMap.find(filter);
243 if (keyIter == _filterMap.end()) {
244 throw LSST_EXCEPT(pex::exceptions::LogicError,
245 (boost::format("Filter %s not in original list") % filter).str());
246 }
247
248 // If list is empty or merging not requested, don't check for any matches, just add all the objects
249 bool checkForMatches = !_mergeList.empty() && doMerge;
250
251 for (afw::table::SourceCatalog::const_iterator srcIter = inputCat.begin(); srcIter != inputCat.end();
252 ++srcIter) {
253 // Only consider unblended objects
254 if (srcIter->getParent() != 0) continue;
255
256 std::shared_ptr<Footprint> foot = srcIter->getFootprint();
257
258 // Empty pointer to account for the first match in the catalog. If there is more than one
259 // match, subsequent matches will be merged with this one
261
262 if (checkForMatches) {
263 FootprintMergeVec::iterator iter = _mergeList.begin();
264 while (iter != _mergeList.end()) {
265 // Grow by one pixel to allow for touching
266 lsst::geom::Box2I box((**iter).getBBox());
267 box.grow(lsst::geom::Extent2I(1, 1));
268 if (box.overlaps(foot->getBBox()) && (**iter).overlaps(*foot)) {
269 if (!first) {
270 first = *iter;
271 // Spatially extend existing FootprintMerge in order to connect subsequent,
272 // now-overlapping FootprintMerges. If a subsequent FootprintMerge overlaps with
273 // the new footprint, it's now guaranteed to overlap with this first FootprintMerge.
274 // Hold off adding foot's lower-priority footprints and peaks until the
275 // higher-priority existing peaks are merged into this first FootprintMerge.
276 first->addSpans(foot);
277 } else {
278 // Add existing merged Footprint to first
279 first->add(**iter, _filterMap, minNewPeakDist, maxSamePeakDist);
280 iter = _mergeList.erase(iter);
281 continue;
282 }
283 }
284 ++iter;
285 } // while mergeList
286 } // if checkForMatches
287
288 if (first) {
289 // Now merge footprint including peaks into the newly-connected, higher-priority FootprintMerge
290 first->add(foot, _peakSchemaMapper, keyIter->second, minNewPeakDist, maxSamePeakDist);
291 } else {
292 // Footprint did not overlap with any existing FootprintMerges. Add to MergeList
293 _mergeList.push_back(std::make_shared<FootprintMerge>(foot, sourceTable, _peakTable,
294 _peakSchemaMapper, keyIter->second));
295 }
296 }
297}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
T begin(T... args)
typename Base::const_iterator const_iterator
An integer coordinate rectangle.
Definition Box.h:55
T empty(T... args)
T end(T... args)
T erase(T... args)
T find(T... args)
T push_back(T... args)

◆ clearCatalog()

void lsst::afw::detection::FootprintMergeList::clearCatalog ( )
inline

Clear entries in the current vector.

Definition at line 113 of file FootprintMerge.h.

113{ _mergeList.clear(); }
T clear(T... args)

◆ getFinalSources()

void lsst::afw::detection::FootprintMergeList::getFinalSources ( afw::table::SourceCatalog & outputCat)

Get SourceCatalog with entries that contain the final Footprint and SourceRecord for each entry.

The resulting Footprints will be normalized, meaning that there peaks are sorted, and areas are calculated.

Definition at line 299 of file FootprintMerge.cc.

299 {
300 // Now set the merged footprint as the footprint of the SourceRecord
301 for (auto const &iter : _mergeList) {
302 outputCat.push_back((*iter).getSource());
303 }
304}

◆ getPeakSchema()

afw::table::Schema lsst::afw::detection::FootprintMergeList::getPeakSchema ( ) const
inline

Return the schema for PeakRecords in the merged footprints.

Definition at line 93 of file FootprintMerge.h.

93{ return _peakTable->getSchema(); }

◆ operator=() [1/2]

FootprintMergeList & lsst::afw::detection::FootprintMergeList::operator= ( FootprintMergeList && )
default

◆ operator=() [2/2]

FootprintMergeList & lsst::afw::detection::FootprintMergeList::operator= ( FootprintMergeList const & )
default

Friends And Related Symbol Documentation

◆ FootprintMerge

friend class FootprintMerge
friend

Definition at line 134 of file FootprintMerge.h.


The documentation for this class was generated from the following files: