LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
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
virtual double evaluate(geom::Point2D const &position) const =0
#define CONST_PTR(...)
Definition: base.h:47
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:72
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 PTR(...)
Definition: base.h:41
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:180
A class to represent a 2-dimensional array of pixels.
Definition: PSF.h:43
void addToImage(image::Image< T > &image, double scaleBy=1.0, bool overlapOnly=false) const