LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Types | Public Member Functions | List of all members
lsst::afw::detection::FootprintSet Class Reference

A set of Footprints, associated with a MaskedImage. More...

#include <FootprintSet.h>

Public Types

using FootprintList = std::vector< std::shared_ptr< Footprint > >
 The FootprintSet's set of Footprints. More...
 

Public Member Functions

template<typename ImagePixelT >
 FootprintSet (image::Image< ImagePixelT > const &img, Threshold const &threshold, int const npixMin=1, bool const setPeaks=true)
 Find a FootprintSet given an Image and a threshold. More...
 
template<typename MaskPixelT >
 FootprintSet (image::Mask< MaskPixelT > const &img, Threshold const &threshold, int const npixMin=1)
 Find a FootprintSet given a Mask and a threshold. More...
 
template<typename ImagePixelT , typename MaskPixelT >
 FootprintSet (image::MaskedImage< ImagePixelT, MaskPixelT > const &img, Threshold const &threshold, std::string const &planeName="", int const npixMin=1, bool const setPeaks=true)
 Find a FootprintSet given a MaskedImage and a threshold. More...
 
 FootprintSet (lsst::geom::Box2I region)
 Construct an empty FootprintSet given a region that its footprints would have lived in. More...
 
 FootprintSet (FootprintSet const &rhs)
 Copy constructor. More...
 
 FootprintSet (FootprintSet const &set, int rGrow, FootprintControl const &ctrl)
 
 FootprintSet (FootprintSet &&rhs)
 
 ~FootprintSet ()
 
 FootprintSet (FootprintSet const &set, int rGrow, bool isotropic=true)
 Grow all the Footprints in the input FootprintSet, returning a new FootprintSet. More...
 
 FootprintSet (FootprintSet const &footprints1, FootprintSet const &footprints2, bool const includePeaks)
 Return the FootprintSet corresponding to the merge of two input FootprintSets. More...
 
FootprintSetoperator= (FootprintSet const &rhs)
 Assignment operator. More...
 
FootprintSetoperator= (FootprintSet &&rhs)
 
void swap (FootprintSet &rhs) noexcept
 
void swapFootprintList (FootprintList &rhs) noexcept
 
std::shared_ptr< FootprintListgetFootprints ()
 : Return the Footprints of detected objects More...
 
void setFootprints (std::shared_ptr< FootprintList > footprints)
 : Set the Footprints of detected objects More...
 
std::shared_ptr< FootprintList const > const getFootprints () const
 Retun the Footprints of detected objects. More...
 
void makeSources (afw::table::SourceCatalog &catalog) const
 Add a new record corresponding to each footprint to a SourceCatalog. More...
 
void setRegion (lsst::geom::Box2I const &region)
 Set the corners of the FootprintSet's MaskedImage to region. More...
 
lsst::geom::Box2I const getRegion () const
 Return the corners of the MaskedImage. More...
 
std::shared_ptr< image::Image< FootprintIdPixel > > insertIntoImage () const
 Return an Image with pixels set to the Footprints in the FootprintSet. More...
 
template<typename MaskPixelT >
void setMask (image::Mask< MaskPixelT > *mask, std::string const &planeName)
 
template<typename MaskPixelT >
void setMask (std::shared_ptr< image::Mask< MaskPixelT >> mask, std::string const &planeName)
 
void merge (FootprintSet const &rhs, int tGrow=0, int rGrow=0, bool isotropic=true)
 Merge a FootprintSet into *this. More...
 
template<typename ImagePixelT , typename MaskPixelT >
void makeHeavy (image::MaskedImage< ImagePixelT, MaskPixelT > const &mimg, HeavyFootprintCtrl const *ctrl=nullptr)
 Convert all the Footprints in the FootprintSet to be HeavyFootprints. More...
 

Detailed Description

A set of Footprints, associated with a MaskedImage.

Definition at line 53 of file FootprintSet.h.

Member Typedef Documentation

◆ FootprintList

The FootprintSet's set of Footprints.

Definition at line 56 of file FootprintSet.h.

Constructor & Destructor Documentation

◆ FootprintSet() [1/9]

template<typename ImagePixelT >
lsst::afw::detection::FootprintSet::FootprintSet ( image::Image< ImagePixelT > const &  img,
Threshold const &  threshold,
int const  npixMin = 1,
bool const  setPeaks = true 
)

Find a FootprintSet given an Image and a threshold.

Parameters
imgImage to search for objects
thresholdthreshold to find objects
npixMinminimum number of pixels in an object
setPeaksshould I set the Peaks list?

◆ FootprintSet() [2/9]

template<typename MaskPixelT >
lsst::afw::detection::FootprintSet::FootprintSet ( image::Mask< MaskPixelT > const &  img,
Threshold const &  threshold,
int const  npixMin = 1 
)

Find a FootprintSet given a Mask and a threshold.

Parameters
imgImage to search for objects
thresholdthreshold to find objects
npixMinminimum number of pixels in an object

◆ FootprintSet() [3/9]

template<typename ImagePixelT , typename MaskPixelT >
lsst::afw::detection::FootprintSet::FootprintSet ( image::MaskedImage< ImagePixelT, MaskPixelT > const &  img,
Threshold const &  threshold,
std::string const &  planeName = "",
int const  npixMin = 1,
bool const  setPeaks = true 
)

Find a FootprintSet given a MaskedImage and a threshold.

Go through an image, finding sets of connected pixels above threshold and assembling them into Footprints; the resulting set of objects is returned

If threshold.getPolarity() is true, pixels above the Threshold are assembled into Footprints; if it's false, then pixels below Threshold are processed (Threshold will probably have to be below the background level for this to make sense, e.g. for difference imaging)

Parameters
imgMaskedImage to search for objects
thresholdthreshold for footprints (controls size)
planeNamemask plane to set (if != "")
npixMinminimum number of pixels in an object
setPeaksshould I set the Peaks list?

◆ FootprintSet() [4/9]

lsst::afw::detection::FootprintSet::FootprintSet ( lsst::geom::Box2I  region)

Construct an empty FootprintSet given a region that its footprints would have lived in.

Parameters
regionthe desired region

◆ FootprintSet() [5/9]

lsst::afw::detection::FootprintSet::FootprintSet ( FootprintSet const &  rhs)

Copy constructor.

Parameters
rhsthe input FootprintSet

◆ FootprintSet() [6/9]

lsst::afw::detection::FootprintSet::FootprintSet ( FootprintSet const &  set,
int  rGrow,
FootprintControl const &  ctrl 
)

◆ FootprintSet() [7/9]

lsst::afw::detection::FootprintSet::FootprintSet ( FootprintSet &&  rhs)

◆ ~FootprintSet()

lsst::afw::detection::FootprintSet::~FootprintSet ( )

◆ FootprintSet() [8/9]

lsst::afw::detection::FootprintSet::FootprintSet ( FootprintSet const &  set,
int  rGrow,
bool  isotropic = true 
)

Grow all the Footprints in the input FootprintSet, returning a new FootprintSet.

The output FootprintSet may contain fewer Footprints, as some may well have been merged

Parameters
setthe input FootprintSet
rGrowGrow Footprints by r pixels
isotropicGrow isotropically (as opposed to a Manhattan metric)
Note
Isotropic grows are significantly slower

◆ FootprintSet() [9/9]

lsst::afw::detection::FootprintSet::FootprintSet ( FootprintSet const &  footprints1,
FootprintSet const &  footprints2,
bool const  includePeaks 
)

Return the FootprintSet corresponding to the merge of two input FootprintSets.

Todo:
Implement this. There's RHL Pan-STARRS code to do it, but it isn't yet converted to LSST C++

Member Function Documentation

◆ getFootprints() [1/2]

std::shared_ptr<FootprintList> lsst::afw::detection::FootprintSet::getFootprints ( )
inline

: Return the Footprints of detected objects

Definition at line 156 of file FootprintSet.h.

156 { return _footprints; }

◆ getFootprints() [2/2]

std::shared_ptr<FootprintList const> const lsst::afw::detection::FootprintSet::getFootprints ( ) const
inline

Retun the Footprints of detected objects.

Definition at line 166 of file FootprintSet.h.

166 { return _footprints; }

◆ getRegion()

lsst::geom::Box2I const lsst::afw::detection::FootprintSet::getRegion ( ) const
inline

Return the corners of the MaskedImage.

Definition at line 190 of file FootprintSet.h.

190 { return _region; }

◆ insertIntoImage()

std::shared_ptr<image::Image<FootprintIdPixel> > lsst::afw::detection::FootprintSet::insertIntoImage ( ) const

Return an Image with pixels set to the Footprints in the FootprintSet.

Returns
an std::shared_ptr<image::Image>

◆ makeHeavy()

template<typename ImagePixelT , typename MaskPixelT >
void lsst::afw::detection::FootprintSet::makeHeavy ( image::MaskedImage< ImagePixelT, MaskPixelT > const &  mimg,
HeavyFootprintCtrl const *  ctrl = nullptr 
)

Convert all the Footprints in the FootprintSet to be HeavyFootprints.

Parameters
mimgthe image providing pixel values
ctrlControl how we manipulate HeavyFootprints

◆ makeSources()

void lsst::afw::detection::FootprintSet::makeSources ( afw::table::SourceCatalog catalog) const

Add a new record corresponding to each footprint to a SourceCatalog.

Parameters
[in,out]catalogCatalog to append new sources to.

The new sources will have their footprints set to point to the footprints in the footprint set; they will not be deep-copied.

◆ merge()

void lsst::afw::detection::FootprintSet::merge ( FootprintSet const &  rhs,
int  tGrow = 0,
int  rGrow = 0,
bool  isotropic = true 
)

Merge a FootprintSet into *this.

Parameters
rhsthe Footprints to merge
tGrowNo. of pixels to grow this Footprints
rGrowNo. of pixels to grow rhs Footprints
isotropicUse (expensive) isotropic grow

◆ operator=() [1/2]

FootprintSet& lsst::afw::detection::FootprintSet::operator= ( FootprintSet &&  rhs)

◆ operator=() [2/2]

FootprintSet& lsst::afw::detection::FootprintSet::operator= ( FootprintSet const &  rhs)

Assignment operator.

◆ setFootprints()

void lsst::afw::detection::FootprintSet::setFootprints ( std::shared_ptr< FootprintList footprints)
inline

: Set the Footprints of detected objects

Definition at line 161 of file FootprintSet.h.

161 { _footprints = footprints; }

◆ setMask() [1/2]

template<typename MaskPixelT >
void lsst::afw::detection::FootprintSet::setMask ( image::Mask< MaskPixelT > *  mask,
std::string const &  planeName 
)
inline
Parameters
maskSet bits in the mask
planeNameHere's the name of the mask plane to fit

Definition at line 200 of file FootprintSet.h.

202  {
203  for (auto const& foot : *_footprints) {
204  foot->getSpans()->setMask(*mask, image::Mask<MaskPixelT>::getPlaneBitMask(planeName));
205  }
206  }
afw::table::Key< afw::table::Array< MaskPixelT > > mask
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77

◆ setMask() [2/2]

template<typename MaskPixelT >
void lsst::afw::detection::FootprintSet::setMask ( std::shared_ptr< image::Mask< MaskPixelT >>  mask,
std::string const &  planeName 
)
inline
Parameters
maskSet bits in the mask
planeNameHere's the name of the mask plane to fit

Definition at line 209 of file FootprintSet.h.

211  {
212  setMask(mask.get(), planeName);
213  }
void setMask(image::Mask< MaskPixelT > *mask, std::string const &planeName)
Definition: FootprintSet.h:200

◆ setRegion()

void lsst::afw::detection::FootprintSet::setRegion ( lsst::geom::Box2I const &  region)

Set the corners of the FootprintSet's MaskedImage to region.

Parameters
regiondesired region
Note
updates all the Footprints' regions too

◆ swap()

void lsst::afw::detection::FootprintSet::swap ( FootprintSet rhs)
inlinenoexcept

Definition at line 140 of file FootprintSet.h.

140  {
141  using std::swap; // See Meyers, Effective C++, Item 25
142  swap(*_footprints, *rhs.getFootprints());
143  lsst::geom::Box2I rhsRegion = rhs.getRegion();
144  rhs.setRegion(getRegion());
145  setRegion(rhsRegion);
146  }
void swap(FootprintSet &rhs) noexcept
Definition: FootprintSet.h:140
lsst::geom::Box2I const getRegion() const
Return the corners of the MaskedImage.
Definition: FootprintSet.h:190
void setRegion(lsst::geom::Box2I const &region)
Set the corners of the FootprintSet's MaskedImage to region.
An integer coordinate rectangle.
Definition: Box.h:55
T swap(T... args)

◆ swapFootprintList()

void lsst::afw::detection::FootprintSet::swapFootprintList ( FootprintList rhs)
inlinenoexcept

Definition at line 148 of file FootprintSet.h.

148  {
149  using std::swap;
150  swap(*_footprints, rhs);
151  }

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