LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Psf.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2013 LSST Corporation.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 #ifndef LSST_AFW_DETECTION_Psf_h_INCLUDED
24 #define LSST_AFW_DETECTION_Psf_h_INCLUDED
25 
26 #include <string>
27 #include <limits>
28 
29 #include "boost/shared_ptr.hpp"
30 
31 #include "lsst/daf/base.h"
33 #include "lsst/afw/math/Kernel.h"
34 #include "lsst/afw/image/Color.h"
36 
37 namespace lsst { namespace afw { namespace detection {
38 
39 class PsfFormatter;
40 
70 {
72  return geom::Point2D(std::numeric_limits<double>::quiet_NaN());
73  }
74 public:
75  typedef boost::shared_ptr<Psf> Ptr;
76  typedef boost::shared_ptr<const Psf> ConstPtr;
77 
80 
83  COPY=0,
88  };
89 
90  virtual ~Psf() {}
91 
99  virtual PTR(Psf) clone() const = 0;
100 
122  geom::Point2D position=makeNullPoint(),
123  image::Color color=image::Color(),
124  ImageOwnerEnum owner=COPY
125  ) const;
126 
150  geom::Point2D position=makeNullPoint(),
151  image::Color color=image::Color(),
152  ImageOwnerEnum owner=COPY
153  ) const;
154 
166  double computePeak(
167  geom::Point2D position=makeNullPoint(),
168  image::Color color=image::Color()
169  ) const;
170 
182  double computeApertureFlux(
183  double radius,
184  geom::Point2D position=makeNullPoint(),
185  image::Color color=image::Color()
186  ) const;
187 
198  geom::ellipses::Quadrupole computeShape(
199  geom::Point2D position=makeNullPoint(),
200  image::Color color=image::Color()
201  ) const;
202 
209  PTR(math::Kernel const) getLocalKernel(
210  geom::Point2D position=makeNullPoint(),
211  image::Color color=image::Color()
212  ) const;
213 
219  image::Color getAverageColor() const { return image::Color(); }
220 
226  virtual geom::Point2D getAveragePosition() const;
227 
246  static PTR(Image) recenterKernelImage(
247  PTR(Image) im,
248  geom::Point2D const & position,
249  std::string const & warpAlgorithm = "lanczos5",
250  unsigned int warpBuffer = 5
251  );
252 
253 protected:
254 
261  explicit Psf(bool isFixed=false);
262 
263 private:
264 
266 
273  virtual PTR(Image) doComputeImage(
274  geom::Point2D const & position, image::Color const& color
275  ) const;
276  virtual PTR(Image) doComputeKernelImage(
277  geom::Point2D const & position, image::Color const & color
278  ) const = 0;
279  virtual double doComputeApertureFlux(
280  double radius, geom::Point2D const & position, image::Color const & color
281  ) const = 0;
282  virtual geom::ellipses::Quadrupole doComputeShape(
283  geom::Point2D const & position, image::Color const & color
284  ) const = 0;
286 
287  bool const _isFixed;
290  mutable image::Color _cachedImageColor;
294 
296 };
297 
298 }}} // namespace lsst::afw::detection
299 
300 #endif // !LSST_AFW_DETECTION_Psf_h_INCLUDED
virtual geom::Point2D getAveragePosition() const
Return the average position of the stars used to construct the Psf.
virtual ~Psf()
Definition: Psf.h:90
geom::ellipses::Quadrupole computeShape(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Compute the ellipse corresponding to the second moments of the Psf.
Declare the Kernel class and subclasses.
boost::shared_ptr< math::Kernel const > getLocalKernel(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Return a FixedKernel corresponding to the Psf image at the given point.
geom::Point2D _cachedKernelImagePosition
Definition: Psf.h:293
#define PTR(...)
Definition: base.h:41
image::Color getAverageColor() const
Return the average Color of the stars used to construct the Psf.
Definition: Psf.h:219
boost::shared_ptr< Image > _cachedKernelImage
Definition: Psf.h:289
static geom::Point2D makeNullPoint()
Definition: Psf.h:71
boost::shared_ptr< Image > computeKernelImage(geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form suitable for convolution.
ImageOwnerEnum
Enum passed to computeImage and computeKernelImage to determine image ownership.
Definition: Psf.h:82
geom::Point2D _cachedImagePosition
Definition: Psf.h:292
bool const _isFixed
Definition: Psf.h:287
boost::shared_ptr< Psf > Ptr
Definition: Psf.h:75
Definitions and inlines for Quadrupole.
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
static boost::shared_ptr< Image > recenterKernelImage(boost::shared_ptr< Image > im, geom::Point2D const &position, std::string const &warpAlgorithm="lanczos5", unsigned int warpBuffer=5)
virtual boost::shared_ptr< Image > doComputeKernelImage(geom::Point2D const &position, image::Color const &color) const =0
boost::shared_ptr< Image > _cachedImage
Definition: Psf.h:288
image::Color _cachedImageColor
Definition: Psf.h:290
math::Kernel::Pixel Pixel
Pixel type of Image returned by computeImage.
Definition: Psf.h:78
virtual boost::shared_ptr< Psf > clone() const =0
Polymorphic deep-copy.
double computePeak(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Return the peak value of the PSF image.
#define LSST_PERSIST_FORMATTER(formatter...)
Definition: Persistable.h:98
boost::shared_ptr< const Psf > ConstPtr
Definition: Psf.h:76
double computeApertureFlux(double radius, geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Compute the &quot;flux&quot; of the Psf model within a circular aperture of the given radius.
Formatter for persistence of Psf instances.
Definition: PsfFormatter.h:30
boost::shared_ptr< Image > computeImage(geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form that can be compared directly with star images.
Point< double, 2 > Point2D
Definition: Point.h:286
Capture the colour of an object.
Base class for all persistable classes.
Definition: Persistable.h:74
virtual geom::ellipses::Quadrupole doComputeShape(geom::Point2D const &position, image::Color const &color) const =0
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
virtual double doComputeApertureFlux(double radius, geom::Point2D const &position, image::Color const &color) const =0
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:182
image::Image< Pixel > Image
Image type returned by computeImage.
Definition: Psf.h:79
virtual boost::shared_ptr< Image > doComputeImage(geom::Point2D const &position, image::Color const &color) const
image::Color _cachedKernelImageColor
Definition: Psf.h:291
The image will be copied before returning; caller will own it.
Definition: Psf.h:83