33 #ifndef LSST_AFW_MATH_SPATIALCELL_H
34 #define LSST_AFW_MATH_SPATIALCELL_H
40 #include "boost/shared_ptr.hpp"
51 template<
typename ImagePixelT>
class Image;
52 template<
typename ImagePixelT,
typename MaskPixelT,
typename VariancePixelT>
class MaskedImage;
59 class SpatialCellCandidate;
76 typedef boost::shared_ptr<SpatialCellCandidate>
Ptr;
77 typedef boost::shared_ptr<const SpatialCellCandidate>
ConstPtr;
132 template<
typename PixelT>
135 typedef boost::shared_ptr<SpatialCellImageCandidate>
Ptr;
136 typedef boost::shared_ptr<const SpatialCellImageCandidate>
ConstPtr;
143 _chi2(std::numeric_limits<double>::
max()) {
191 typedef boost::shared_ptr<SpatialCellMaskedImageCandidate>
Ptr;
192 typedef boost::shared_ptr<const SpatialCellMaskedImageCandidate>
ConstPtr;
197 ) : SpatialCellCandidate(xCenter, yCenter),
201 _chi2(std::numeric_limits<double>::
max()) {
254 size_t operator-(SpatialCellCandidateIterator
const& rhs)
const;
256 CONST_PTR(SpatialCellCandidate) operator*() const;
257 PTR(SpatialCellCandidate) operator*();
260 bool operator==(SpatialCellCandidateIterator const& rhs)
const {
261 return _iterator == rhs._iterator;
264 bool operator!=(SpatialCellCandidateIterator
const& rhs)
const {
269 SpatialCellCandidateIterator(CandidateList::iterator iterator, CandidateList::iterator end,
bool ignoreBad);
270 SpatialCellCandidateIterator(CandidateList::iterator iterator, CandidateList::iterator end,
bool ignoreBad,
bool);
292 typedef boost::shared_ptr<SpatialCell>
Ptr;
293 typedef boost::shared_ptr<const SpatialCell>
ConstPtr;
311 void sortCandidates();
333 void insertCandidate(
PTR(SpatialCellCandidate) candidate);
340 void removeCandidate(
PTR(SpatialCellCandidate) candidate);
347 PTR(SpatialCellCandidate) getCandidateById(
int id,
bool noThrow=false);
351 std::
string const& getLabel()
const {
return _label; }
360 bool const ignoreExceptions=
false,
bool const reset=
true);
362 bool const ignoreExceptions=
false,
bool const reset=
true)
const;
364 bool const ignoreExceptions=
false,
bool const reset=
true);
366 bool const ignoreExceptions=
false,
bool const reset=
true)
const;
380 typedef boost::shared_ptr<SpatialCellSet>
Ptr;
381 typedef boost::shared_ptr<const SpatialCellSet>
ConstPtr;
402 void insertCandidate(
PTR(SpatialCellCandidate) candidate);
404 void sortCandidates();
407 bool const ignoreExceptions=
false);
409 bool const ignoreExceptions=
false)
const;
410 void visitAllCandidates(
CandidateVisitor * visitor,
bool const ignoreExceptions=
false);
411 void visitAllCandidates(
CandidateVisitor * visitor,
bool const ignoreExceptions=
false)
const;
413 PTR(SpatialCellCandidate) getCandidateById(
int id,
bool noThrow=false);
415 void setIgnoreBad(
bool ignoreBad);
418 lsst::afw::geom::Box2I _region;
boost::uint16_t MaskPixel
An include file to include the header files for lsst::afw::geom.
CandidateList::iterator _end
void setIgnoreBad(bool ignoreBad)
Set whether we should omit BAD candidates from candidate list when traversing.
SpatialCellImageCandidate(float const xCenter, float const yCenter)
ctor
CandidateList::iterator _iterator
float getYCenter() const
Return the object's row-centre.
virtual ~SpatialCellImageCandidate()
static void setHeight(int height)
Set the height of the image that getImage should return.
SpatialCellCandidateIterator end(bool ignoreBad)
virtual boost::shared_ptr< lsst::afw::image::Image< PixelT > const > getImage() const =0
Return the Candidate's Image.
bool operator!=(SpatialCellCandidateIterator const &rhs) const
Are two SpatialCellCandidateIterators unequal?
int getId() const
Return the candidate's unique ID.
boost::shared_ptr< SpatialCellMaskedImageCandidate > Ptr
static int getWidth()
Return the width of the image that getImage should return.
static int _CandidateId
Unique identifier for candidates; useful for preserving current candidate following insertion...
virtual ~SpatialCellSet()
static int _width
The width of images that SpatialCellImageCandidate should return; may be ignored by subclasses...
static int getWidth()
Return the width of the image that getImage should return.
boost::shared_ptr< const SpatialCellSet > ConstPtr
void setStatus(Status status)
Set the candidate's status.
std::complex< double > operator-(const std::complex< double > &z1, const Position &p2)
boost::shared_ptr< const SpatialCellMaskedImageCandidate > ConstPtr
virtual bool instantiate()
Do anything needed to make this candidate usable.
boost::shared_ptr< const SpatialCellCandidate > ConstPtr
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
Status getStatus() const
Return the candidate's status.
static void setHeight(int height)
Set the height of the image that getImage should return.
A collection of SpatialCells covering an entire image.
boost::shared_ptr< SpatialCellImageCandidate > Ptr
virtual ~SpatialCellCandidate()
std::vector< boost::shared_ptr< SpatialCell > > CellList
virtual void setCandidateRating(double)
Set the candidate's rating.
lsst::afw::geom::Box2I const & getBBox() const
geom::Box2I const & _bbox
A class to manipulate images, masks, and variance as a single object.
virtual ~CandidateVisitor()
bool getIgnoreBad() const
Get whether we are omitting BAD candidates from candidate list when traversing.
double getChi2() const
Return the candidate's chi^2.
boost::shared_ptr< SpatialCell > Ptr
float VariancePixel
! default type for Masks and MaskedImage Masks
static int getHeight()
Return the height of the image that getImage should return.
boost::shared_ptr< SpatialCellCandidate > Ptr
void setChi2(double chi2)
Set the candidate's chi^2.
void setChi2(double chi2)
Set the candidate's chi^2.
lsst::afw::geom::Box2I getBBox() const
SpatialCellCandidateIterator begin(bool ignoreBad)
SpatialCellCandidateIterator end()
CandidateList _candidateList
static int _height
The height of images that SpatialCellImageCandidate should return; may be ignored by subclasses...
std::vector< boost::shared_ptr< SpatialCellCandidate > > CandidateList
double getChi2() const
Return the candidate's chi^2.
SpatialCellMaskedImageCandidate(float const xCenter, float const yCenter)
ctor
Class to ensure constraints for spatial modeling.
virtual bool isBad() const
Is this candidate unacceptable?
virtual ~SpatialCellMaskedImageCandidate()
SpatialCellCandidate(float const xCenter, float const yCenter)
boost::shared_ptr< SpatialCellSet > Ptr
virtual void processCandidate(SpatialCellCandidate *)
SpatialCellCandidateIterator begin()
lsst::afw::geom::Box2I _bbox
static int getHeight()
Return the height of the image that getImage should return.
std::vector< boost::shared_ptr< SpatialCellCandidate > > CandidateList
Definition of default types for Masks and Variance Images.
boost::shared_ptr< const SpatialCell > ConstPtr
An iterator that only returns usable members of the SpatialCell.
Include files required for standard LSST Exception handling.
static void setWidth(int width)
Set the width of the image that getImage should return.
boost::shared_ptr< const SpatialCellImageCandidate > ConstPtr
virtual double getCandidateRating() const =0
Return candidate's rating.
SpatialCellCandidateIterator iterator
boost::shared_ptr< lsst::afw::image::Image< PixelT > > _image
a pointer to the Image, for the use of the base class
float getXCenter() const
Return the object's column-centre.