LSSTApplications  11.0-24-g0a022a1,15.0+13,15.0+9,15.0-1-g19261fa+5,15.0-1-g1eca518+15,15.0-1-g60afb23+12,15.0-1-g615e0bb+4,15.0-1-g6668b0b+5,15.0-1-g788a293+12,15.0-1-ga91101e+12,15.0-1-gae1598d+8,15.0-1-gc45031d+15,15.0-1-gd076f1f+12,15.0-1-gdf18595+2,15.0-1-gf4f1c34+8,15.0-2-g100d730+5,15.0-2-g18f3f21+5,15.0-2-g35685a8+6,15.0-2-gf38729e+5,15.0-21-g91b8abf62,15.0-3-g150fc43+14,15.0-3-g6f085af+5,15.0-3-g707930d,15.0-3-g9103c06+8,15.0-3-ga03b4ca+16,15.0-3-gaec6799+5,15.0-3-gb7a597c+12,15.0-3-ge6a6747+5,15.0-4-g45f767a+8,15.0-4-g654b129+10,15.0-4-gf5d1e39,15.0-4-gff20472+15,15.0-5-ga70c291+5,15.0-6-g9a9df217+5,15.0-7-gab4c137+6,15.0-7-gab79a70c+4
LSSTDataManagementBasePackage
ImagePca.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 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 /*
26  * Support for PCA analysis of 2-D images
27  */
28 #ifndef LSST_AFW_IMAGE_IMAGEPCA_H
29 #define LSST_AFW_IMAGE_IMAGEPCA_H
30 
31 #include <vector>
32 #include <string>
33 #include <utility>
34 
35 #include "boost/mpl/bool.hpp"
36 #include <memory>
37 
38 #include "lsst/pex/exceptions.h"
40 
41 namespace lsst {
42 namespace afw {
43 namespace image {
44 
45 template <typename ImageT>
46 class ImagePca {
47 public:
49 
55  explicit ImagePca(bool constantWeight = true);
56  virtual ~ImagePca() = default;
57 
58  ImagePca(ImagePca const&);
59  ImagePca(ImagePca&&);
60  ImagePca& operator=(ImagePca const&);
62 
71  void addImage(std::shared_ptr<ImageT> img, double flux = 0.0);
73  ImageList getImageList() const;
74 
76  geom::Extent2I const getDimensions() const { return _dimensions; }
77 
82  virtual void analyze();
96  virtual double updateBadPixels(unsigned long mask, int const ncomp);
97 
99  std::vector<double> const& getEigenValues() const { return _eigenValues; }
101  ImageList const& getEigenImages() const { return _eigenImages; }
102 
103 private:
104  double getFlux(int i) const { return _fluxList[i]; }
105 
106  ImageList _imageList; // image to analyze
107  std::vector<double> _fluxList; // fluxes of images
108  geom::Extent2I _dimensions; // width/height of images on _imageList
109 
110  bool _constantWeight; // should all stars have the same weight?
111 
112  std::vector<double> _eigenValues; // Eigen values
113  ImageList _eigenImages; // Eigen images
114 };
115 
126 template <typename Image1T, typename Image2T>
127 double innerProduct(Image1T const& lhs, Image2T const& rhs, int const border = 0);
128 }
129 }
130 }
131 
132 #endif
std::vector< double > const & getEigenValues() const
Return Eigen values.
Definition: ImagePca.h:99
ImageList getImageList() const
Return the list of images being analyzed.
Definition: ImagePca.cc:86
std::shared_ptr< ImageT > getMean() const
Return the mean of the images in ImagePca&#39;s list.
Definition: ImagePca.cc:91
double innerProduct(Image1T const &lhs, Image2T const &rhs, int const border=0)
Calculate the inner product of two images.
Definition: ImagePca.cc:415
std::vector< std::shared_ptr< ImageT > > ImageList
Definition: ImagePca.h:48
ImagePca & operator=(ImagePca const &)
A base class for image defects.
Definition: cameraGeom.dox:3
virtual ~ImagePca()=default
geom::Extent2I const getDimensions() const
Return the dimension of the images being analyzed.
Definition: ImagePca.h:76
virtual void analyze()
Definition: ImagePca.cc:124
ImagePca(bool constantWeight=true)
ctor
Definition: ImagePca.cc:47
afw::table::Key< afw::table::Array< MaskPixelT > > mask
STL class.
void addImage(std::shared_ptr< ImageT > img, double flux=0.0)
Add an image to the set to be analyzed.
Definition: ImagePca.cc:65
ImageList const & getEigenImages() const
Return Eigen images.
Definition: ImagePca.h:101
virtual double updateBadPixels(unsigned long mask, int const ncomp)
Update the bad pixels (i.e.
Definition: ImagePca.cc:387