Class SpatialCellSet

Class Documentation

class SpatialCellSet

A collection of SpatialCells covering an entire image

Public Types

typedef std::vector<std::shared_ptr<SpatialCell>> CellList

Public Functions

SpatialCellSet(lsst::geom::Box2I const &region, int xSize, int ySize = 0)

Constructor

Parameters
  • region: Bounding box for image

  • xSize: size of cells in the column direction

  • ySize: size of cells in the row direction (0: == xSize)

Exceptions
  • lsst::pex::exceptions::LengthError: if nx or ny is non-positive

SpatialCellSet(SpatialCellSet const&)
SpatialCellSet(SpatialCellSet&&)
SpatialCellSet &operator=(SpatialCellSet const&)
SpatialCellSet &operator=(SpatialCellSet&&)
virtual ~SpatialCellSet()

Destructor

CellList &getCellList()

Return our SpatialCells

lsst::geom::Box2I getBBox() const

Return the bounding box of the image

void insertCandidate(std::shared_ptr<SpatialCellCandidate> candidate)

Insert a candidate into the correct cell

void sortCandidates()

Rearrange the Candidates in all SpatialCells to reflect their current ratings.

void visitCandidates(CandidateVisitor *visitor, int const nMaxPerCell = -1, bool const ignoreExceptions = false)

Call the visitor’s processCandidate method for each Candidate in the SpatialCellSet

Note

This is obviously similar to the Design Patterns (Go4) Visitor pattern, but we’ve simplified the double dispatch (i.e. we don’t call a virtual method on SpatialCellCandidate that in turn calls processCandidate(*this), but can be re-defined)

Parameters
  • visitor: Pass this object to every Candidate

  • nMaxPerCell: Visit no more than this many Candidates (<= 0: all)

  • ignoreExceptions: Ignore any exceptions thrown by the processing

void visitCandidates(CandidateVisitor *visitor, int const nMaxPerCell = -1, bool const ignoreExceptions = false) const

Call the visitor’s processCandidate method for each Candidate in the SpatialCellSet (const version)

This is the const version of SpatialCellSet::visitCandidates

Parameters
  • visitor: Pass this object to every Candidate

  • nMaxPerCell: Visit no more than this many Candidates (-ve: all)

  • ignoreExceptions: Ignore any exceptions thrown by the processing

void visitAllCandidates(CandidateVisitor *visitor, bool const ignoreExceptions = false)

Call the visitor’s processCandidate method for every Candidate in the SpatialCellSet

See

visitCandidates

Parameters
  • visitor: Pass this object to every Candidate

  • ignoreExceptions: Ignore any exceptions thrown by the processing

void visitAllCandidates(CandidateVisitor *visitor, bool const ignoreExceptions = false) const

Call the visitor’s processCandidate method for every Candidate in the SpatialCellSet (const version)

This is the const version of SpatialCellSet::visitAllCandidates

Parameters
  • visitor: Pass this object to every Candidate

  • ignoreExceptions: Ignore any exceptions thrown by the processing

std::shared_ptr<SpatialCellCandidate> getCandidateById(int id, bool noThrow = false)

Return the SpatialCellCandidate with the specified id

Parameters
  • id: The desired ID

  • noThrow: Return NULL in case of error

Exceptions
  • lsst::pex::exceptions::NotFoundError: if no candidate matches the id (unless noThrow is true, in which case a null pointer is returned

void setIgnoreBad(bool ignoreBad)

Set whether we should omit BAD candidates from candidate list when traversing.