33 #ifndef LSST_AFW_MATH_SPATIALCELL_H
34 #define LSST_AFW_MATH_SPATIALCELL_H
51 template<
typename ImagePixelT>
class Image;
52 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
class MaskedImage;
59 class SpatialCellCandidate;
76 typedef std::shared_ptr<SpatialCellCandidate>
Ptr;
77 typedef std::shared_ptr<const SpatialCellCandidate>
ConstPtr;
134 typedef std::shared_ptr<SpatialCellImageCandidate>
Ptr;
135 typedef std::shared_ptr<const SpatialCellImageCandidate>
ConstPtr;
141 _chi2(std::numeric_limits<double>::max()) {
218 typedef std::shared_ptr<SpatialCell>
Ptr;
219 typedef std::shared_ptr<const SpatialCell>
ConstPtr;
286 bool const ignoreExceptions=
false,
bool const reset=
true);
288 bool const ignoreExceptions=
false,
bool const reset=
true)
const;
290 bool const ignoreExceptions=
false,
bool const reset=
true);
292 bool const ignoreExceptions=
false,
bool const reset=
true)
const;
306 typedef std::shared_ptr<SpatialCellSet>
Ptr;
307 typedef std::shared_ptr<const SpatialCellSet>
ConstPtr;
333 bool const ignoreExceptions=
false);
335 bool const ignoreExceptions=
false)
const;
CandidateList::iterator _iterator
std::shared_ptr< SpatialCellImageCandidate > Ptr
SpatialCellCandidateIterator begin(bool ignoreBad)
void setStatus(Status status)
Set the candidate's status.
An include file to include the header files for lsst::afw::geom.
static int getWidth()
Return the width of the image that getImage should return.
void visitAllCandidates(CandidateVisitor *visitor, bool const ignoreExceptions=false, bool const reset=true)
Call the visitor's processCandidate method for every Candidate in the SpatialCell.
void insertCandidate(boost::shared_ptr< SpatialCellCandidate > candidate)
Insert a candidate into the correct cell.
virtual ~SpatialCellCandidate()
(virtual) destructor – this is a base class you know
static void setHeight(int height)
Set the height of the image that getImage should return.
bool empty() const
Determine if cell has no usable candidates.
SpatialCellCandidateIterator end()
Return an iterator to (one after) the end of the Candidates.
SpatialCellSet(lsst::afw::geom::Box2I const ®ion, int xSize, int ySize=0)
Constructor.
std::shared_ptr< const SpatialCellCandidate > ConstPtr
Include files required for standard LSST Exception handling.
std::vector< boost::shared_ptr< SpatialCell > > CellList
size_t operator-(SpatialCellCandidateIterator const &rhs) const
Return the number of candidate between this and rhs.
static int _CandidateId
Unique identifier for candidates; useful for preserving current candidate following insertion...
float getYCenter() const
Return the object's row-centre.
std::string const & getLabel() const
Get SpatialCell's label.
std::shared_ptr< SpatialCellCandidate > Ptr
std::shared_ptr< const SpatialCellImageCandidate > ConstPtr
void sortCandidates()
Rearrange the candidates to reflect their current ratings.
void setIgnoreBad(bool ignoreBad)
Set whether we should omit BAD candidates from candidate list when traversing.
virtual ~CandidateVisitor()
SpatialCellCandidateIterator(CandidateList::iterator iterator, CandidateList::iterator end, bool ignoreBad)
ctor; designed to be used to pass begin to SpatialCellCandidateIterator
virtual void processCandidate(SpatialCellCandidate *)
virtual double getCandidateRating() const =0
Return candidate's rating.
std::shared_ptr< const SpatialCellSet > ConstPtr
double getChi2() const
Return the candidate's chi^2.
virtual ~SpatialCell()
Destructor.
lsst::afw::geom::Box2I _region
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
boost::shared_ptr< SpatialCellCandidate > getCandidateById(int id, bool noThrow=false)
Return the SpatialCellCandidate with the specified id.
void operator++()
Advance the iterator, maybe skipping over candidates labelled BAD.
Status getStatus() const
Return the candidate's status.
boost::shared_ptr< SpatialCellCandidate > getCandidateById(int id, bool noThrow=false)
Return the SpatialCellCandidate with the specified id.
A collection of SpatialCells covering an entire image.
std::vector< boost::shared_ptr< SpatialCellCandidate > > CandidateList
std::vector< boost::shared_ptr< SpatialCellCandidate > > CandidateList
std::shared_ptr< SpatialCellSet > Ptr
void ImageT ImageT int float saturatedPixelValue int const width
void removeCandidate(boost::shared_ptr< SpatialCellCandidate > candidate)
Remove a candidate from the list.
SpatialCellImageCandidate(float const xCenter, float const yCenter)
ctor
int getId() const
Return the candidate's unique ID.
SpatialCell(std::string const &label, lsst::afw::geom::Box2I const &bbox=lsst::afw::geom::Box2I(), CandidateList const &candidateList=CandidateList())
Constructor.
virtual ~SpatialCellSet()
Destructor.
virtual bool isBad() const
Is this candidate unacceptable?
std::shared_ptr< const SpatialCell > ConstPtr
void visitCandidates(CandidateVisitor *visitor, int const nMaxPerCell=-1, bool const ignoreExceptions=false, bool const reset=true)
Call the visitor's processCandidate method for each Candidate in the SpatialCell. ...
bool getIgnoreBad() const
Get whether we are omitting BAD candidates from candidate list when traversing.
SpatialCellCandidateIterator iterator
float getXCenter() const
Return the object's column-centre.
lsst::afw::geom::Box2I getBBox() const
Return the bounding box of the image.
CandidateList _candidateList
size_t size() const
Return number of usable candidates in Cell.
void ImageT ImageT int float saturatedPixelValue int const height
virtual bool instantiate()
Do anything needed to make this candidate usable.
void sortCandidates()
Rearrange the Candidates in all SpatialCells to reflect their current ratings.
virtual void setCandidateRating(double)
Set the candidate's rating.
std::shared_ptr< SpatialCell > Ptr
static void setWidth(int width)
Set the width of the image that getImage should return.
Base class for candidate objects in a SpatialCell that are able to return an Image of some sort (e...
CandidateList::iterator _end
Class to ensure constraints for spatial modeling.
void visitAllCandidates(CandidateVisitor *visitor, bool const ignoreExceptions=false)
Call the visitor's processCandidate method for every Candidate in the SpatialCellSet.
Base class for candidate objects in a SpatialCell.
void setIgnoreBad(bool ignoreBad)
Set whether we should omit BAD candidates from candidate list when traversing.
lsst::afw::geom::Box2I _bbox
#define CONST_PTR(...)
A shared pointer to a const object.
bool operator!=(SpatialCellCandidateIterator const &rhs) const
Are two SpatialCellCandidateIterators unequal?
Definition of default types for Masks and Variance Images.
void visitCandidates(CandidateVisitor *visitor, int const nMaxPerCell=-1, bool const ignoreExceptions=false)
Call the visitor's processCandidate method for each Candidate in the SpatialCellSet.
void insertCandidate(boost::shared_ptr< SpatialCellCandidate > candidate)
Add a candidate to the list, preserving ranking.
SpatialCellCandidateIterator begin()
Return an iterator to the beginning of the Candidates.
An iterator that only returns usable members of the SpatialCell.
SpatialCellCandidateIterator end(bool ignoreBad)
virtual ~SpatialCellImageCandidate()
void setChi2(double chi2)
Set the candidate's chi^2.
SpatialCellCandidate(float const xCenter, float const yCenter)
lsst::afw::geom::Box2I const & getBBox() const
Get SpatialCell's BBox.
static int getHeight()
Return the height of the image that getImage should return.
CellList & getCellList()
Return our SpatialCells.