lsst.meas.algorithms  13.0-18-gc4ad422+4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExposurePatch.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 #if !defined(LSST_MEAS_ALGORITHMS_EXPOSURE_PATCH_H)
26 #define LSST_MEAS_ALGORITHMS_EXPOSURE_PATCH_H
27 
28 #include "lsst/base.h"
29 #include "lsst/afw/detection/Footprint.h"
30 #include "lsst/afw/image/Wcs.h"
31 #include "lsst/afw/geom/AffineTransform.h"
32 
33 namespace lsst { namespace meas { namespace algorithms {
34 
38 template<typename ExposureT>
40 public:
41  typedef unsigned char FlagT;
42  typedef PTR(ExposurePatch) Ptr;
43  typedef CONST_PTR(ExposurePatch) ConstPtr;
44 
46  ExposurePatch(CONST_PTR(ExposureT) exp,
47  CONST_PTR(afw::detection::Footprint) foot,
48  afw::geom::Point2D const& center
49  ): _exp(exp), _foot(foot), _center(center), _fromStandard(), _toStandard() {}
50  ExposurePatch(CONST_PTR(ExposureT) exp,
51  afw::detection::Footprint const& standardFoot,
52  afw::geom::Point2D const& standardCenter,
53  afw::image::Wcs const& standardWcs
54  ) : _exp(exp) {
55  afw::image::Wcs const& expWcs = *exp->getWcs();
56  std::shared_ptr<afw::coord::Coord const> sky = standardWcs.pixelToSky(standardCenter);
57  const_cast<CONST_PTR(afw::detection::Footprint)&>(_foot) = standardFoot.transform(standardWcs, expWcs,
58  exp->getBBox());
59  const_cast<afw::geom::Point2D&>(_center) = expWcs.skyToPixel(*sky);
60  const_cast<afw::geom::AffineTransform&>(_fromStandard) = standardWcs.linearizePixelToSky(*sky) *
61  expWcs.linearizeSkyToPixel(*sky);
62  const_cast<afw::geom::AffineTransform&>(_toStandard) = expWcs.linearizePixelToSky(*sky) *
63  standardWcs.linearizeSkyToPixel(*sky);
64  }
65 
67  CONST_PTR(ExposureT) const getExposure() const { return _exp; }
68  CONST_PTR(afw::detection::Footprint) const getFootprint() const { return _foot; }
69  afw::geom::Point2D const& getCenter() const { return _center; }
70  afw::geom::AffineTransform const& fromStandard() const { return _fromStandard; }
71  afw::geom::AffineTransform const& toStandard() const { return _toStandard; }
72 
74  void setCenter(afw::geom::Point2D const& center) { _center = center; }
75 
76 private:
77  CONST_PTR(ExposureT) const _exp;
78  CONST_PTR(afw::detection::Footprint) const _foot;
79  afw::geom::Point2D _center;
80  afw::geom::AffineTransform const _fromStandard;
81  afw::geom::AffineTransform const _toStandard;
82 };
83 
85 template<typename ExposureT>
87  CONST_PTR(ExposureT) exp,
88  CONST_PTR(afw::detection::Footprint) foot,
89  afw::geom::Point2D const& center
90  ) {
91  return std::make_shared<ExposurePatch<ExposureT> >(exp, foot, center);
92 }
93 template<typename ExposureT>
95  CONST_PTR(ExposureT) exp,
96  afw::detection::Footprint const& standardFoot,
97  afw::geom::Point2D const& standardCenter,
98  afw::image::Wcs const& standardWcs
99  ) {
100  return std::make_shared<ExposurePatch<ExposureT> >(exp, standardFoot, standardCenter, standardWcs);
101 }
102 
103 }}} // namespace
104 
105 #endif
void setCenter(afw::geom::Point2D const &center)
Modifiers.
Definition: ExposurePatch.h:74
boost::shared_ptr< ExposureT const > const getExposure() const
Accessors.
Definition: ExposurePatch.h:67
afw::geom::Point2D const & getCenter() const
Definition: ExposurePatch.h:69
A convenience container for the exposure, peak and footprint that will be measured.
Definition: ExposurePatch.h:39
unsigned char FlagT
Type for flags.
Definition: ExposurePatch.h:41
ExposurePatch(boost::shared_ptr< ExposureT const > exp, afw::detection::Footprint const &standardFoot, afw::geom::Point2D const &standardCenter, afw::image::Wcs const &standardWcs)
Definition: ExposurePatch.h:50
boost::shared_ptr< ExposurePatch const > ConstPtr
Definition: ExposurePatch.h:43
boost::shared_ptr< ExposurePatch< ExposureT > > makeExposurePatch(boost::shared_ptr< ExposureT const > exp, boost::shared_ptr< afw::detection::Footprint const > foot, afw::geom::Point2D const &center)
Factory function for ExposurePatch.
Definition: ExposurePatch.h:86
boost::shared_ptr< ExposurePatch > Ptr
Definition: ExposurePatch.h:42
afw::geom::AffineTransform const & fromStandard() const
Definition: ExposurePatch.h:70
afw::geom::AffineTransform const & toStandard() const
Definition: ExposurePatch.h:71
boost::shared_ptr< afw::detection::Footprint const > const getFootprint() const
Definition: ExposurePatch.h:68