LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
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 
82  ndarray::Array<double,1,1> evaluate(
83  ndarray::Array<double const,1> const & x,
84  ndarray::Array<double const,1> const & y
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
Multiply an image by the field in-place.
virtual double evaluate(geom::Point2D const &position) const =0
Evaluate the field at the given point.
geom::Box2I getBBox() const
Return the bounding box that defines the region where the field is valid.
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:72
double scaleBy
Definition: BoundedField.cc:63
Support for 2-D images.
void divideImage(image::Image< T > &image, bool overlapOnly=false) const
Divide an image by the field in-place.
BoundedField(geom::Box2I const &bbox)
Definition: BoundedField.h:164
void fillImage(image::Image< T > &image, bool overlapOnly=false) const
Assign the field to an image, overwriting values already present.
double x
double evaluate(double x, double y) const
Evaluate the field at the given point.
Definition: BoundedField.h:70
#define PTR(...)
Definition: base.h:41
An abstract base class for 2-d functions defined on an integer bounding boxes.
Definition: BoundedField.h:49
#define CONST_PTR(...)
A shared pointer to a const object.
Definition: base.h:47
Basic LSST definitions.
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:180
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:416
void addToImage(image::Image< T > &image, double scaleBy=1.0, bool overlapOnly=false) const
Add the field or a constant multiple of it to an image in-place.