LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
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
Include files required for standard LSST Exception handling.
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: Point.h:285
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
A class representing an Angle.
Definition: Angle.h:103
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,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
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
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