LSST Applications g0265f82a02+d6b5cd48b5,g02d81e74bb+a41d3748ce,g1470d8bcf6+6be6c9203b,g2079a07aa2+14824f138e,g212a7c68fe+a4f2ea4efa,g2305ad1205+72971fe858,g295015adf3+ab2c85acae,g2bbee38e9b+d6b5cd48b5,g337abbeb29+d6b5cd48b5,g3ddfee87b4+31b3a28dff,g487adcacf7+082e807817,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+b2918d57ae,g5a732f18d5+66d966b544,g64a986408d+a41d3748ce,g858d7b2824+a41d3748ce,g8a8a8dda67+a6fc98d2e7,g99cad8db69+7fe4acdf18,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga8c6da7877+84af8b3ff8,gb0e22166c9+3863383f4c,gb6a65358fc+d6b5cd48b5,gba4ed39666+9664299f35,gbb8dafda3b+d8d527deb2,gc07e1c2157+b2dbe6b631,gc120e1dc64+61440b2abb,gc28159a63d+d6b5cd48b5,gcf0d15dbbd+31b3a28dff,gdaeeff99f8+a38ce5ea23,ge6526c86ff+39927bb362,ge79ae78c31+d6b5cd48b5,gee10cc3b42+a6fc98d2e7,gf1cff7945b+a41d3748ce,v24.1.5.rc1
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: