lsst.meas.algorithms  15.0-7-gab79a70c+1
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  virtual PTR(afw::detection::Psf) 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
virtual void write(OutputArchiveHandle &handle) const
A Psf defined by a Kernel.
Definition: KernelPsf.h:33
friend class boost::serialization::access
#define PTR(...)
boost::shared_ptr< afw::math::Kernel const > getKernel() const
Return the Kernel used to define this Psf.
Definition: KernelPsf.h:52
virtual std::string getPersistenceName() const
afw::table::Key< double > sigma
STL class.
double getSigma() const
Return the radius of the Gaussian.
Represent a PSF as a circularly symmetrical Gaussian.
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)
virtual boost::shared_ptr< afw::detection::Psf > resized(int width, int height) const
Return a clone with specified kernel dimensions.
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy; should usually unnecessary because Psfs are immutable.
io::OutputArchiveHandle OutputArchiveHandle
virtual bool isPersistable() const
Whether the Psf is persistable; always true.
void save_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel const *k, unsigned int const file_version)