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
SingleGaussianPsf.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 
24 #ifndef LSST_MEAS_ALGORITHMS_SingleGaussianPsf_h_INCLUDED
25 #define LSST_MEAS_ALGORITHMS_SingleGaussianPsf_h_INCLUDED
26 
27 #include "lsst/base.h"
29 #include "boost/serialization/nvp.hpp"
30 #include "boost/serialization/void_cast.hpp"
31 
32 namespace lsst { namespace meas { namespace algorithms {
33 
37 class SingleGaussianPsf : public afw::table::io::PersistableFacade<SingleGaussianPsf>, public KernelPsf {
38 public:
39 
49  explicit SingleGaussianPsf(int width, int height, double sigma);
50 
52  virtual PTR(afw::detection::Psf) clone() const;
53 
55  SingleGaussianPsf resized(int width, int height) const;
56 
58  double getSigma() const { return _sigma; }
59 
61  virtual bool isPersistable() const { return true; }
62 
63 protected:
64 
65  virtual std::string getPersistenceName() const;
66 
67  virtual void write(OutputArchiveHandle & handle) const;
68 
69 private:
70  double _sigma;
71 
72 private:
74  template <class Archive>
75  void serialize(Archive&, unsigned int const) {
76  boost::serialization::void_cast_register<SingleGaussianPsf, lsst::afw::detection::Psf>(
77  static_cast<SingleGaussianPsf*>(0), static_cast<lsst::afw::detection::Psf*>(0));
78  }
79 };
80 
81 }}} // namespace lsst::meas::algorithms
82 
83 namespace boost { namespace serialization {
84 
85 template <class Archive>
86 inline void save_construct_data(
87  Archive& ar, lsst::meas::algorithms::SingleGaussianPsf const* p,
88  unsigned int const) {
89  int width = p->getKernel()->getWidth();
90  int height = p->getKernel()->getHeight();
91  double sigma = p->getSigma();
92  ar << make_nvp("width", width);
93  ar << make_nvp("height", height);
94  ar << make_nvp("sigma", sigma);
95 }
96 
97 template <class Archive>
98 inline void load_construct_data(
100  unsigned int const) {
101  int width;
102  int height;
103  double sigma;
104  ar >> make_nvp("width", width);
105  ar >> make_nvp("height", height);
106  ar >> make_nvp("sigma", sigma);
107  ::new(p) lsst::meas::algorithms::SingleGaussianPsf(width, height, sigma);
108 }
109 
110 }} // namespace boost::serialization
111 
112 #endif // !LSST_MEAS_ALGORITHMS_SingleGaussianPsf_h_INCLUDED
double getSigma() const
Return the radius of the Gaussian.
SingleGaussianPsf resized(int width, int height) const
Return a clone with specified kernel dimensions.
A Psf defined by a Kernel.
Definition: KernelPsf.h:33
io::OutputArchiveHandle OutputArchiveHandle
Definition: Persistable.h:112
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy; should usually unnecessary because Psfs are immutable.
friend class boost::serialization::access
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
void serialize(Archive &, unsigned int const)
afw::table::Key< double > sigma
Definition: GaussianPsf.cc:43
Represent a PSF as a circularly symmetrical Gaussian.
void ImageT ImageT int float saturatedPixelValue int const width
Definition: saturated.cc:44
SingleGaussianPsf(int width, int height, double sigma)
Constructor for a SingleGaussianPsf.
void load_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel *k, unsigned int const file_version)
Definition: Kernel.h:1171
boost::shared_ptr< afw::math::Kernel const > getKernel() const
Return the Kernel used to define this Psf.
Definition: KernelPsf.h:52
void ImageT ImageT int float saturatedPixelValue int const height
Definition: saturated.cc:44
#define PTR(...)
Definition: base.h:41
virtual bool isPersistable() const
Whether the Psf is persistable; always true.
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
Basic LSST definitions.
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:180
void save_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel const *k, unsigned int const file_version)
Definition: Kernel.h:1157