Class Footprint

Inheritance Relationships

Base Types

Derived Type

Class Documentation

class Footprint : public lsst::afw::table::io::PersistableFacade<lsst::afw::detection::Footprint>, public lsst::afw::table::io::Persistable

Class to describe the properties of a detected object from an image

A Footprint is designed to be constructed with information about a detected object in an image. Internally a Footprint holds a SpanSet which is used to describe the location of the object in the image (the x, y pixel locations which are considered part of the object). In addition a Footprint contains a PeakCatalog which is used to store the location and intensity of peaks in the detection.

Subclassed by lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >

Public Functions

Footprint(std::shared_ptr<geom::SpanSet> inputSpans, lsst::geom::Box2I const &region = lsst::geom::Box2I())

Constructor for Footprint object.

Parameters
  • inputSpans: Shared pointer to a SpanSet defining the pixels included in the Footprint.

  • region: Bounding box of the image in which the Footprint was created, defaults to empty box.

Footprint(std::shared_ptr<geom::SpanSet> inputSpans, afw::table::Schema const &peakSchema, lsst::geom::Box2I const &region = lsst::geom::Box2I())

Constructor for the Footprint object.

Parameters
  • inputSpans: Shared pointer to a SpanSet defining the pixels included in the Footprint.

  • peakSchema: schema to be used in the PeakCatalog

  • region: Bounding box of the image in which the Footprint was created, defaults to empty box.

Footprint()

Constructor of a empty Footprint object.

Footprint(Footprint const &other)
Footprint(Footprint&&)
Footprint &operator=(Footprint const &other)
Footprint &operator=(Footprint&&)
~Footprint()
virtual bool isHeavy() const

Indicates if this object is a HeavyFootprint

std::shared_ptr<geom::SpanSet> getSpans() const

Return a shared pointer to the SpanSet

void setSpans(std::shared_ptr<geom::SpanSet> otherSpanSet)

Sets the shared pointer to the SpanSet in the Footprint

Parameters
  • otherSpanSet: Shared pointer to a SpanSet

PeakCatalog &getPeaks()

Return the Peaks contained in this Footprint

The peaks should be ordered by decreasing pixel intensity at the peak position (so the most negative peak appears last). Users that add new Peaks manually are responsible for maintaining this sorting.

const PeakCatalog &getPeaks() const
std::shared_ptr<PeakRecord> addPeak(float fx, float fy, float value)

Convenience function to add a peak

Parameters
  • fx: Float containing the x position of a peak

  • fy: Float containing the y position of a peak

  • value: The intensity value of the peak

void sortPeaks(afw::table::Key<float> const &key = afw::table::Key<float>())

Sort Peaks from most positive value to most negative.

If the key passed is invalid (the default) PeakTable::getPeakValueKey() will be used.

Parameters
  • key: A key corresponding to the field in the Schema the PeakCatalog is to be sorted by.

void setPeakSchema(afw::table::Schema const &peakSchema)

Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty).

Parameters
  • peakSchema: The schema to use in the PeakCatalog

Exceptions
  • pex::exceptions::LogicError: Thrown if if the PeakCatalog is not empty

void setPeakCatalog(PeakCatalog const &otherPeaks)

Set the peakCatalog to a copy of the supplied catalog

PeakCatalog will be copied into the Footprint, but a PeakCatalog is a shallow copy, so records will not be duplicated. This function will throw an error if the PeakCatalog of *this is not empty.

Parameters
  • otherPeaks: The PeakCatalog to copy

std::size_t getArea() const

Return the number of pixels in this Footprint

This function returns the real number of pixels, not the area of the bbox.

lsst::geom::Point2D getCentroid() const

Return the Footprint’s centroid

The centroid is calculated as the mean of the pixel centers

geom::ellipses::Quadrupole getShape() const

Return the Footprint’s shape (interpreted as an ellipse)

The shape is determined by measuring the moments of the pixel centers about its centroid (cf. getCentroid)

void shift(int dx, int dy)

Shift a Footprint by (dx, dy)

Parameters
  • dx: How much to move Footprint in column direction

  • dy: How much to move in row direction

void shift(lsst::geom::ExtentI const &d)

Shift a Footprint by a given extent

Parameters
  • d: ExtentI object which gives the dimensions the Footprint should be shifted

lsst::geom::Box2I getBBox() const

Return the Footprint’s bounding box

lsst::geom::Box2I getRegion() const

Return the corners of the MaskedImage the footprints live in

void setRegion(lsst::geom::Box2I const &region)

Set the corners of the MaskedImage wherein the footprints dwell

Parameters
  • region: A box describing the corners of the Image the Footprint derives from

void clipTo(lsst::geom::Box2I const &bbox)

Clip the Footprint such that all values lie inside the supplied Bounding Box

Parameters
  • bbox: Integer box object that defines the boundaries the footprint should be clipped to.

bool contains(lsst::geom::Point2I const &pix) const

Tests if a pixel postion falls inside the Footprint

Parameters
  • pix: Integer point object defining the position of a pixel to test

std::shared_ptr<Footprint> transform(std::shared_ptr<geom::SkyWcs> source, std::shared_ptr<geom::SkyWcs> target, lsst::geom::Box2I const &region, bool doClip = true) const

Transform the footprint from one WCS to another

Parameters
  • source: Wcs that defines the coordinate system of the input footprint.

  • target: Wcs that defines that desired coordinate system of the returned footprint.

  • region: Used to set the “region” box of the returned footprint; note that this is NOT the same as the footprint’s bounding box.

  • doClip: If true, clip the new footprint to the region bbox before returning it.

std::shared_ptr<Footprint> transform(lsst::geom::LinearTransform const &t, lsst::geom::Box2I const &region, bool doClip = true) const

Return a new Footprint whose pixels are the product of applying the specified transformation

Parameters
  • t: A linear transform object which will be used to map the pixels

  • region: Used to set the “region” box of the returned footprint; note that this is NOT the same as the footprint’s bounding box.

  • doClip: If true, clip the new footprint to the region bbox before returning it.

std::shared_ptr<Footprint> transform(lsst::geom::AffineTransform const &t, lsst::geom::Box2I const &region, bool doClip = true) const

Return a new Footprint whose pixels are the product of applying the specified transformation

Parameters
  • t: An affine transform object which will be used to map the pixels

  • region: Used to set the “region” box of the returned footprint; note that this is NOT the same as the footprint’s bounding box.

  • doClip: If true, clip the new footprint to the region bbox before returning it.

std::shared_ptr<Footprint> transform(geom::TransformPoint2ToPoint2 const &t, lsst::geom::Box2I const &region, bool doClip = true) const

Return a new Footprint whose pixels are the product of applying the specified transformation

Parameters
  • t: A 2-D transform which will be used to map the pixels

  • region: Used to set the “region” box of the returned footprint; note that this is NOT the same as the footprint’s bounding box.

  • doClip: If true, clip the new footprint to the region bbox before returning it.

bool isPersistable() const

Report if this object is persistable

void dilate(int r, geom::Stencil s = geom::Stencil::CIRCLE)

Dilate the Footprint with a defined kernel

This function enlarges the SpanSet which defines the area of the Footprint by an amount governed by in input kernel

Parameters
  • r: The radius of the stencil object used to create a dilation kernel

  • s: The stencil object used to create the dilation kernel

void dilate(geom::SpanSet const &other)

Dilate the Footprint with a defined kernel

This function enlarges the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
  • other: SpanSet to use as the kernel in dilation

void erode(int r, geom::Stencil s = geom::Stencil::CIRCLE)

Erode the Footprint with a defined kernel

This function reduces the size of the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
  • r: The radius of the stencil object used to create a erosion kernel

  • s: The stencil object used to create the erosion kernel

void erode(geom::SpanSet const &other)

Erode the Footprint with a defined kernel

This function reduces the size of the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
  • other: SpanSet to use as the kernel in erosion

void removeOrphanPeaks()

Remove peaks from the PeakCatalog that fall outside the area of the Footprint

bool isContiguous() const

Reports if the Footprint is simply connected or has multiple components

std::vector<std::shared_ptr<Footprint>> split() const

Split a multi-component Footprint into a vector of contiguous Footprints

Split a multi-component Footprint such that each Footprint in the output vector is contiguous and contains only peaks that can be found within the bounds of the Footprint

bool operator==(Footprint const &other) const

equality operator

Parameters
  • other: The Footprint for which equality will be computed

Protected Functions

std::string getPersistenceName() const

Return the name correspoinging ot the persistence type

std::string getPythonModule() const

Return the python module the object will live in

void write(OutputArchiveHandle &handle) const

Write an instance of a Footprint to an output Archive

Protected Static Functions

static std::unique_ptr<Footprint> readSpanSet(afw::table::BaseCatalog const&, afw::table::io::InputArchive const&)

Static method used to unpersist the SpanSet member of the Footprint class

static void readPeaks(afw::table::BaseCatalog const&, Footprint&)

Static method used to unpersist the PeakCatalog member of the Footprint class

Friends

friend lsst::afw::detection::Footprint::FootprintFactory