LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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 
29 #ifndef LSST_AFW_IMAGE_IMAGEPCA_H
30 #define LSST_AFW_IMAGE_IMAGEPCA_H
31 
32 #include <vector>
33 #include <string>
34 #include <utility>
35 
36 #include "boost/mpl/bool.hpp"
37 #include "boost/shared_ptr.hpp"
38 
39 #include "lsst/pex/exceptions.h"
41 
42 namespace lsst {
43 namespace afw {
44 namespace image {
45 
46  template <typename ImageT>
47  class ImagePca {
48  public:
49  typedef typename boost::shared_ptr<ImageT> Ptr;
50  typedef typename boost::shared_ptr<const ImageT> ConstPtr;
51 
52  typedef std::vector<typename ImageT::Ptr> ImageList;
53 
54  explicit ImagePca(bool constantWeight=true);
55  virtual ~ImagePca() {}
56 
57  void addImage(typename ImageT::Ptr img, double flux=0.0);
58  ImageList getImageList() const;
59 
61  geom::Extent2I const getDimensions() const { return _dimensions; }
62 
63  typename ImageT::Ptr getMean() const;
64  virtual void analyze();
65  virtual double updateBadPixels(unsigned long mask, int const ncomp);
66 
68  std::vector<double> const& getEigenValues() const { return _eigenValues; }
70  ImageList const& getEigenImages() const { return _eigenImages; }
71 
72  private:
73  double getFlux(int i) const { return _fluxList[i]; }
74 
75  ImageList _imageList; // image to analyze
76  std::vector<double> _fluxList; // fluxes of images
77  geom::Extent2I _dimensions; // width/height of images on _imageList
78 
79  bool _constantWeight; // should all stars have the same weight?
80 
81  std::vector<double> _eigenValues; // Eigen values
82  ImageList _eigenImages; // Eigen images
83  };
84 
85 template <typename Image1T, typename Image2T>
86 double innerProduct(Image1T const& lhs, Image2T const& rhs, int const border=0);
87 
88 }}}
89 
90 #endif
std::vector< double > _fluxList
Definition: ImagePca.h:76
std::vector< double > const & getEigenValues() const
Return Eigen values.
Definition: ImagePca.h:68
boost::shared_ptr< const ImageT > ConstPtr
Definition: ImagePca.h:50
Include files required for standard LSST Exception handling.
double innerProduct(Image1T const &lhs, Image2T const &rhs, int const border=0)
Definition: ImagePca.cc:454
std::vector< double > _eigenValues
Definition: ImagePca.h:81
ImageList getImageList() const
Return the list of images being analyzed.
Definition: ImagePca.cc:92
void addImage(typename ImageT::Ptr img, double flux=0.0)
Definition: ImagePca.cc:65
boost::shared_ptr< ImageT > Ptr
Definition: ImagePca.h:49
geom::Extent2I const getDimensions() const
Return the dimension of the images being analyzed.
Definition: ImagePca.h:61
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
ImageT::Ptr getMean() const
Definition: ImagePca.cc:101
ImageList const & getEigenImages() const
Return Eigen images.
Definition: ImagePca.h:70
std::vector< typename ImageT::Ptr > ImageList
Definition: ImagePca.h:52
virtual void analyze()
Definition: ImagePca.cc:135
ImagePca(bool constantWeight=true)
ctor
Definition: ImagePca.cc:49
Implementation of the Class MaskedImage.
geom::Extent2I _dimensions
Definition: ImagePca.h:77
double getFlux(int i) const
Definition: ImagePca.h:73
virtual double updateBadPixels(unsigned long mask, int const ncomp)
Definition: ImagePca.cc:417