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;
132 template<
typename PixelT>
135 typedef std::shared_ptr<SpatialCellImageCandidate>
Ptr;
136 typedef std::shared_ptr<const SpatialCellImageCandidate>
ConstPtr;
143 _chi2(std::numeric_limits<double>::max()) {
191 typedef std::shared_ptr<SpatialCellMaskedImageCandidate>
Ptr;
192 typedef std::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 std::shared_ptr<SpatialCell>
Ptr;
293 typedef std::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 std::shared_ptr<SpatialCellSet>
Ptr;
381 typedef std::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.
std::shared_ptr< const SpatialCellImageCandidate > ConstPtr
std::shared_ptr< SpatialCellImageCandidate > Ptr
static int getWidth()
Return the width of the image that getImage should return.
double getChi2() const
Return the candidate's chi^2.
virtual ~SpatialCellCandidate()
virtual ~SpatialCellImageCandidate()
SpatialCellCandidateIterator end()
SpatialCellMaskedImageCandidate(float const xCenter, float const yCenter)
ctor
std::shared_ptr< const SpatialCellCandidate > ConstPtr
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
void setChi2(double chi2)
Set the candidate's chi^2.
static int getHeight()
Return the height of the image that getImage should return.
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.
std::shared_ptr< SpatialCellCandidate > Ptr
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 *)
std::complex< double > operator-(const std::complex< double > &z1, const Position &p2)
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.
std::shared_ptr< const SpatialCellSet > ConstPtr
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
std::shared_ptr< SpatialCellSet > Ptr
int getId() const
Return the candidate's unique ID.
std::shared_ptr< SpatialCellMaskedImageCandidate > Ptr
virtual ~SpatialCellSet()
virtual bool isBad() const
Is this candidate unacceptable?
geom::Box2I const & _bbox
std::shared_ptr< const SpatialCell > ConstPtr
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
virtual bool instantiate()
Do anything needed to make this candidate usable.
virtual void setCandidateRating(double)
Set the candidate's rating.
virtual ~SpatialCellMaskedImageCandidate()
std::shared_ptr< SpatialCell > Ptr
CandidateList::iterator _end
static int getHeight()
Return the height of the image that getImage should return.
Class to ensure constraints for spatial modeling.
static void setHeight(int height)
Set the height of the image that getImage should return.
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
Include files required for standard LSST Exception handling.
bool operator!=(SpatialCellCandidateIterator const &rhs) const
Are two SpatialCellCandidateIterators unequal?
float VariancePixel
! default type for Masks and MaskedImage Masks
std::shared_ptr< const SpatialCellMaskedImageCandidate > ConstPtr
Definition of default types for Masks and Variance Images.
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