LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
BoundedField.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008-2014 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 #ifndef LSST_AFW_MATH_BoundedField_h_INCLUDED
26 #define LSST_AFW_MATH_BoundedField_h_INCLUDED
27 
28 #include "ndarray.h"
29 
30 #include "lsst/base.h"
31 #include "lsst/afw/geom/Point.h"
32 #include "lsst/afw/image/Image.h"
34 
35 namespace lsst { namespace afw { namespace math {
36 
50 public:
51 
60  virtual double evaluate(geom::Point2D const & position) const = 0;
61 
70  double evaluate(double x, double y) const { return evaluate(geom::Point2D(x, y)); }
71 
85  ) const;
86 
95  geom::Box2I getBBox() const { return _bbox; }
96 
107  template <typename T>
108  void fillImage(image::Image<T> & image, bool overlapOnly=false) const;
109 
121  template <typename T>
122  void addToImage(image::Image<T> & image, double scaleBy=1.0, bool overlapOnly=false) const;
123 
134  template <typename T>
135  void multiplyImage(image::Image<T> & image, bool overlapOnly=false) const;
136 
147  template <typename T>
148  void divideImage(image::Image<T> & image, bool overlapOnly=false) const;
149 
155  virtual PTR(BoundedField) operator*(double const scale) const = 0;
156  PTR(BoundedField) operator/(double scale) const {
157  return (*this)*(1.0/scale);
158  }
159 
160  virtual ~BoundedField() {}
161 
162 protected:
163 
164  explicit BoundedField(geom::Box2I const & bbox) : _bbox(bbox) {}
165 
166 private:
168 };
169 
170 PTR(BoundedField) operator*(double const scale, CONST_PTR(BoundedField) bf);
171 
172 }}} // namespace lsst::afw::math
173 
174 #endif // !LSST_AFW_MATH_BoundedField_h_INCLUDED
int y
A coordinate class intended to represent absolute positions.
void multiplyImage(image::Image< T > &image, bool overlapOnly=false) const
virtual double evaluate(geom::Point2D const &position) const =0
#define PTR(...)
Definition: base.h:41
geom::Box2I getBBox() const
Definition: BoundedField.h:95
An integer coordinate rectangle.
Definition: Box.h:53
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
double scaleBy
Definition: BoundedField.cc:63
Support for 2-D images.
void divideImage(image::Image< T > &image, bool overlapOnly=false) const
BoundedField(geom::Box2I const &bbox)
Definition: BoundedField.h:164
void fillImage(image::Image< T > &image, bool overlapOnly=false) const
double x
double evaluate(double x, double y) const
Definition: BoundedField.h:70
#define CONST_PTR(...)
Definition: base.h:47
An abstract base class for 2-d functions defined on an integer bounding boxes.
Definition: BoundedField.h:49
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:182
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:415
void addToImage(image::Image< T > &image, double scaleBy=1.0, bool overlapOnly=false) const