LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
LSSTDataManagementBasePackage
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,
39  lsst::meas::algorithms::NotImplementedException);
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 {
61  }
62  virtual void rotateImageBy90(int nQuarter, afw::geom::Extent2I dimensions) const {
64  }
67  return PTR(daf::base::PropertyList)(); // unreached
68  }
69 
72 
73 protected:
74  virtual void pixelToSkyImpl(double pixel1, double pixel2, afw::geom::Angle skyTmp[2]) const;
76 
77 private:
78  void notImplemented() const {
79  throw LSST_EXCEPT(NotImplementedException, "Feature has not been implemented");
80  }
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::Point2I const _xy0
Definition: BinnedWcs.h:83
A coordinate class intended to represent absolute positions.
unsigned int const _xBin
Definition: BinnedWcs.h:82
afw::geom::AffineTransform getBinnedToOriginal() const
Definition: BinnedWcs.h:70
Class for storing ordered metadata with comments.
Definition: PropertyList.h:82
unsigned int getXBin() const
Definition: BinnedWcs.h:52
virtual bool isPersistable() const
Whether the Wcs is persistable using afw::table::io archives.
Definition: BinnedWcs.h:57
virtual boost::shared_ptr< daf::base::PropertyList > getFitsMetadata() const
Return a PropertyList containing FITS header keywords that can be used to save the Wcs...
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
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
Point< int, 2 > Point2I
Definition: PSF.h:39
virtual void rotateImageBy90(int nQuarter, afw::geom::Extent2I dimensions) const
Rotate image by nQuarter times 90 degrees.
Definition: BinnedWcs.h:62
afw::geom::AffineTransform const _binnedToOriginal
Definition: BinnedWcs.h:84
boost::shared_ptr< afw::image::Wcs > const _parent
Definition: BinnedWcs.h:81
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:42
An affine coordinate transformation consisting of a linear transformation and an offset.
boost::shared_ptr< afw::image::Wcs > upcast()
Definition: BinnedWcs.h:49
afw::geom::AffineTransform const _originalToBinned
Definition: BinnedWcs.h:84
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
Flip CD matrix around the y-axis.
Definition: BinnedWcs.h:59
boost::shared_ptr< afw::image::Wcs > getParent() const
Definition: BinnedWcs.h:51
LSST_EXCEPTION_TYPE(NotImplementedException, lsst::pex::exceptions::RuntimeError, lsst::meas::algorithms::NotImplementedException)
An exception that indicates the feature has not been implemented.
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
#define PTR(...)
Definition: base.h:41
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
Include files required for standard LSST Exception handling.
unsigned int getYBin() const
Definition: BinnedWcs.h:53
afw::geom::AffineTransform getOriginalToBinned() const
Definition: BinnedWcs.h:71
unsigned int const _yBin
Definition: BinnedWcs.h:82