lsst.meas.algorithms  13.0-23-gb99accf
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinnedWcs.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2014 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 #ifndef LSST_MEAS_ALGORITHMS_BINNEDWCS_H
26 #define LSST_MEAS_ALGORITHMS_BINNEDWCS_H
27 
28 #include <memory>
29 
30 #include "lsst/pex/exceptions.h"
31 #include "lsst/afw/image/Wcs.h"
32 #include "lsst/afw/geom/Point.h"
33 
34 
35 namespace lsst { namespace meas { namespace algorithms {
36 
38 LSST_EXCEPTION_TYPE(NotImplementedException, lsst::pex::exceptions::RuntimeError,
40 
41 class BinnedWcs : public afw::image::Wcs, public std::enable_shared_from_this<BinnedWcs> {
42 public:
43  BinnedWcs(PTR(afw::image::Wcs) parent, unsigned int xBin, unsigned int yBin, afw::geom::Point2I xy0);
44  virtual ~BinnedWcs() {}
45 
46  virtual PTR(afw::image::Wcs) clone() const {
47  return PTR(afw::image::Wcs)(std::make_shared<BinnedWcs>(_parent, _xBin, _yBin, _xy0));
48  }
49  PTR(afw::image::Wcs) upcast() { return shared_from_this(); }
50 
51  PTR(afw::image::Wcs) getParent() const { return _parent; }
52  unsigned int getXBin() const { return _xBin; }
53  unsigned int getYBin() const { return _yBin; }
54  afw::geom::Point2I getXY0() const { return _xy0; }
55 
56  virtual bool hasDistortion() const { return _parent->hasDistortion(); }
57  virtual bool isPersistable() const { return false; }
58 
59  virtual void flipImage(int flipLR, int flipTB, afw::geom::Extent2I dimensions) const {
60  notImplemented();
61  }
62  virtual void rotateImageBy90(int nQuarter, afw::geom::Extent2I dimensions) const {
63  notImplemented();
64  }
65  virtual PTR(daf::base::PropertyList) getFitsMetadata() const {
66  notImplemented();
67  return PTR(daf::base::PropertyList)(); // unreached
68  }
69 
70  afw::geom::AffineTransform getBinnedToOriginal() const { return _binnedToOriginal; }
71  afw::geom::AffineTransform getOriginalToBinned() const { return _originalToBinned; }
72 
73 protected:
74  virtual void pixelToSkyImpl(double pixel1, double pixel2, afw::geom::Angle skyTmp[2]) const;
75  virtual afw::geom::Point2D skyToPixelImpl(afw::geom::Angle sky1, afw::geom::Angle sky2) const;
76 
77 private:
78  void notImplemented() const {
79  throw LSST_EXCEPT(NotImplementedException, "Feature has not been implemented");
80  }
81  PTR(afw::image::Wcs) const _parent;
82  unsigned int const _xBin, _yBin;
83  afw::geom::Point2I const _xy0;
84  afw::geom::AffineTransform const _binnedToOriginal, _originalToBinned;
85 };
86 
87 }}} // namespace lsst::meas::algorithms
88 
89 #endif // LSST_MEAS_ALGORITHMS_BINNED_WCS_H
afw::geom::AffineTransform getBinnedToOriginal() const
Definition: BinnedWcs.h:70
unsigned int getXBin() const
Definition: BinnedWcs.h:52
virtual bool isPersistable() const
Definition: BinnedWcs.h:57
virtual boost::shared_ptr< daf::base::PropertyList > getFitsMetadata() const
Definition: BinnedWcs.h:65
virtual void pixelToSkyImpl(double pixel1, double pixel2, afw::geom::Angle skyTmp[2]) const
Definition: BinnedWcs.cc:48
virtual bool hasDistortion() const
Definition: BinnedWcs.h:56
virtual void rotateImageBy90(int nQuarter, afw::geom::Extent2I dimensions) const
Definition: BinnedWcs.h:62
afw::table::PointKey< int > dimensions
An exception that indicates the feature has not been implemented.
Definition: BinnedWcs.h:39
boost::shared_ptr< afw::image::Wcs > upcast()
Definition: BinnedWcs.h:49
afw::geom::Point2I getXY0() const
Definition: BinnedWcs.h:54
BinnedWcs(boost::shared_ptr< afw::image::Wcs > parent, unsigned int xBin, unsigned int yBin, afw::geom::Point2I xy0)
Definition: BinnedWcs.cc:29
virtual void flipImage(int flipLR, int flipTB, afw::geom::Extent2I dimensions) const
Definition: BinnedWcs.h:59
Point< int, 2 > Point2I
Definition: PSF.h:39
boost::shared_ptr< afw::image::Wcs > getParent() const
Definition: BinnedWcs.h:51
virtual boost::shared_ptr< afw::image::Wcs > clone() const
Definition: BinnedWcs.h:46
virtual afw::geom::Point2D skyToPixelImpl(afw::geom::Angle sky1, afw::geom::Angle sky2) const
Definition: BinnedWcs.cc:55
unsigned int getYBin() const
Definition: BinnedWcs.h:53
afw::geom::AffineTransform getOriginalToBinned() const
Definition: BinnedWcs.h:71