LSST Applications g00274db5b6+edbf708997,g00d0e8bbd7+edbf708997,g199a45376c+5137f08352,g1fd858c14a+1d4b6db739,g262e1987ae+f4d9505c4f,g29ae962dfc+7156fb1a53,g2cef7863aa+73c82f25e4,g35bb328faa+edbf708997,g3e17d7035e+5b3adc59f5,g3fd5ace14f+852fa6fbcb,g47891489e3+6dc8069a4c,g53246c7159+edbf708997,g64539dfbff+9f17e571f4,g67b6fd64d1+6dc8069a4c,g74acd417e5+ae494d68d9,g786e29fd12+af89c03590,g7ae74a0b1c+a25e60b391,g7aefaa3e3d+536efcc10a,g7cc15d900a+d121454f8d,g87389fa792+a4172ec7da,g89139ef638+6dc8069a4c,g8d7436a09f+28c28d8d6d,g8ea07a8fe4+db21c37724,g92c671f44c+9f17e571f4,g98df359435+b2e6376b13,g99af87f6a8+b0f4ad7b8d,gac66b60396+966efe6077,gb88ae4c679+7dec8f19df,gbaa8f7a6c5+38b34f4976,gbf99507273+edbf708997,gc24b5d6ed1+9f17e571f4,gca7fc764a6+6dc8069a4c,gcc769fe2a4+97d0256649,gd7ef33dd92+6dc8069a4c,gdab6d2f7ff+ae494d68d9,gdbb4c4dda9+9f17e571f4,ge410e46f29+6dc8069a4c,geaed405ab2+e194be0d2b,w.2025.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
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 241 of file FootprintMerge.cc.

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

◆ 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(); }

◆ 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 301 of file FootprintMerge.cc.

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

◆ 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: