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;
CandidateList::iterator _iterator
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.
boost::shared_ptr< const SpatialCellImageCandidate > ConstPtr
double getChi2() const
Return the candidate's chi^2.
virtual ~SpatialCellCandidate()
virtual ~SpatialCellImageCandidate()
SpatialCellCandidateIterator end()
SpatialCellMaskedImageCandidate(float const xCenter, float const yCenter)
ctor
boost::shared_ptr< const SpatialCellSet > ConstPtr
Include files required for standard LSST Exception handling.
static int _height
The height of images that SpatialCellImageCandidate should return; may be ignored by subclasses...
static void setHeight(int height)
Set the height of the image that getImage should return.
std::vector< boost::shared_ptr< SpatialCell > > CellList
boost::uint16_t MaskPixel
void setChi2(double chi2)
Set the candidate's chi^2.
static int getHeight()
Return the height of the image that getImage should return.
boost::shared_ptr< SpatialCell > Ptr
static int _CandidateId
Unique identifier for candidates; useful for preserving current candidate following insertion...
float getYCenter() const
Return the object's row-centre.
static int getWidth()
Return the width of the image that getImage should return.
virtual ~CandidateVisitor()
boost::shared_ptr< lsst::afw::image::Image< PixelT > > _image
a pointer to the Image, for the use of the base class
virtual void processCandidate(SpatialCellCandidate *)
boost::shared_ptr< const SpatialCellCandidate > ConstPtr
static int _width
The width of images that SpatialCellImageCandidate should return; may be ignored by subclasses...
virtual double getCandidateRating() const =0
Return candidate's rating.
boost::shared_ptr< SpatialCellCandidate > Ptr
An integer coordinate rectangle.
table::Key< table::Array< Kernel::Pixel > > image
Status getStatus() const
Return the candidate's status.
static void setWidth(int width)
Set the width of the image that getImage should return.
SpatialCellImageCandidate(float const xCenter, float const yCenter)
ctor
A collection of SpatialCells covering an entire image.
std::vector< boost::shared_ptr< SpatialCellCandidate > > CandidateList
std::vector< boost::shared_ptr< SpatialCellCandidate > > CandidateList
void ImageT ImageT int float saturatedPixelValue int const width
boost::shared_ptr< SpatialCellMaskedImageCandidate > Ptr
int getId() const
Return the candidate's unique ID.
virtual ~SpatialCellSet()
virtual bool isBad() const
Is this candidate unacceptable?
geom::Box2I const & _bbox
boost::shared_ptr< SpatialCellImageCandidate > Ptr
A class to manipulate images, masks, and variance as a single object.
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
CandidateList _candidateList
void ImageT ImageT int float saturatedPixelValue int const height
virtual bool instantiate()
Do anything needed to make this candidate usable.
boost::shared_ptr< const SpatialCellMaskedImageCandidate > ConstPtr
virtual void setCandidateRating(double)
Set the candidate's rating.
virtual ~SpatialCellMaskedImageCandidate()
CandidateList::iterator _end
static int getHeight()
Return the height of the image that getImage should return.
Class to ensure constraints for spatial modeling.
boost::shared_ptr< const SpatialCell > ConstPtr
static void setHeight(int height)
Set the height of the image that getImage should return.
boost::shared_ptr< SpatialCellSet > Ptr
void setIgnoreBad(bool ignoreBad)
Set whether we should omit BAD candidates from candidate list when traversing.
void setChi2(double chi2)
Set the candidate's chi^2.
virtual boost::shared_ptr< lsst::afw::image::Image< PixelT > const > getImage() const =0
Return the Candidate's Image.
lsst::afw::geom::Box2I _bbox
bool operator!=(SpatialCellCandidateIterator const &rhs) const
Are two SpatialCellCandidateIterators unequal?
float VariancePixel
! default type for Masks and MaskedImage Masks
Definition of default types for Masks and Variance Images.
A class to represent a 2-dimensional array of pixels.
const Angle operator-(Angle const a, Angle const d)
SpatialCellCandidateIterator begin()
An iterator that only returns usable members of the SpatialCell.
SpatialCellCandidateIterator end(bool ignoreBad)
double getChi2() const
Return the candidate's chi^2.
SpatialCellCandidate(float const xCenter, float const yCenter)
lsst::afw::geom::Box2I const & getBBox() const