LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
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"
30 #include "lsst/geom/Point.h"
32 #include "lsst/afw/geom/SkyWcs.h"
33 
34 namespace lsst {
35 namespace meas {
36 namespace algorithms {
37 
41 template <typename ExposureT>
43 public:
44  typedef unsigned char FlagT;
45  typedef PTR(ExposurePatch) Ptr;
47 
49  ExposurePatch(CONST_PTR(ExposureT) exp,
51  geom::Point2D const& center
52  )
53  : _exp(exp), _foot(foot), _center(center), _fromStandard(), _toStandard() {}
54  ExposurePatch(CONST_PTR(ExposureT) exp,
55  afw::detection::Footprint const& standardFoot,
56  geom::Point2D const& standardCenter,
57  afw::geom::SkyWcs const& standardWcs
58  )
59  : _exp(exp) {
60  afw::geom::SkyWcs const& expWcs = *exp->getWcs();
61  auto const sky = standardWcs.pixelToSky(standardCenter);
62  const_cast<CONST_PTR(afw::detection::Footprint)&>(_foot) =
63  standardFoot.transform(standardWcs, expWcs, exp->getBBox());
64  const_cast<geom::Point2D&>(_center) = expWcs.skyToPixel(sky);
65  const_cast<geom::AffineTransform&>(_fromStandard) =
66  standardWcs.linearizePixelToSky(sky) * expWcs.linearizeSkyToPixel(sky);
67  const_cast<geom::AffineTransform&>(_toStandard) =
68  expWcs.linearizePixelToSky(sky) * standardWcs.linearizeSkyToPixel(sky);
69  }
70 
72  CONST_PTR(ExposureT) const getExposure() const { return _exp; }
73  CONST_PTR(afw::detection::Footprint) const getFootprint() const { return _foot; }
74  geom::Point2D const& getCenter() const { return _center; }
75  geom::AffineTransform const& fromStandard() const { return _fromStandard; }
76  geom::AffineTransform const& toStandard() const { return _toStandard; }
77 
79  void setCenter(geom::Point2D const& center) { _center = center; }
80 
81 private:
82  CONST_PTR(ExposureT) const _exp;
84  geom::Point2D _center;
85  geom::AffineTransform const _fromStandard;
86  geom::AffineTransform const _toStandard;
87 };
88 
90 template <typename ExposureT>
91 PTR(ExposurePatch<ExposureT>)
92 makeExposurePatch(CONST_PTR(ExposureT) exp, CONST_PTR(afw::detection::Footprint) foot,
93  geom::Point2D const& center) {
94  return std::make_shared<ExposurePatch<ExposureT> >(exp, foot, center);
95 }
96 template <typename ExposureT>
97 PTR(ExposurePatch<ExposureT>)
98 makeExposurePatch(CONST_PTR(ExposureT) exp, afw::detection::Footprint const& standardFoot,
99  geom::Point2D const& standardCenter, afw::geom::SkyWcs const& standardWcs) {
100  return std::make_shared<ExposurePatch<ExposureT> >(exp, standardFoot, standardCenter, standardWcs);
101 }
102 
103 } // namespace algorithms
104 } // namespace meas
105 } // namespace lsst
106 
107 #endif
Basic LSST definitions.
#define PTR(...)
Definition: base.h:41
#define CONST_PTR(...)
A shared pointer to a const object.
Definition: base.h:47
Class to describe the properties of a detected object from an image.
Definition: Footprint.h:63
std::shared_ptr< Footprint > transform(std::shared_ptr< geom::SkyWcs > source, std::shared_ptr< geom::SkyWcs > target, lsst::geom::Box2I const &region, bool doClip=true) const
Transform the footprint from one WCS to another.
Definition: Footprint.cc:81
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition: SkyWcs.h:117
lsst::geom::SpherePoint pixelToSky(lsst::geom::Point2D const &pixel) const
Compute sky position(s) from pixel position(s)
Definition: SkyWcs.h:334
lsst::geom::AffineTransform linearizePixelToSky(lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const
Return the local linear approximation to pixelToSky at a point given in sky coordinates.
Definition: SkyWcs.cc:280
lsst::geom::AffineTransform linearizeSkyToPixel(lsst::geom::SpherePoint const &coord, lsst::geom::AngleUnit const &skyUnit) const
Return the local linear approximation to skyToPixel at a point given in sky coordinates.
Definition: SkyWcs.cc:289
lsst::geom::Point2D skyToPixel(lsst::geom::SpherePoint const &sky) const
Compute pixel position(s) from sky position(s)
Definition: SkyWcs.h:349
An affine coordinate transformation consisting of a linear transformation and an offset.
A convenience container for the exposure, peak and footprint that will be measured.
Definition: ExposurePatch.h:42
geom::Point2D const & getCenter() const
Definition: ExposurePatch.h:74
void setCenter(geom::Point2D const &center)
Modifiers.
Definition: ExposurePatch.h:79
boost::shared_ptr< afw::detection::Footprint const > const getFootprint() const
Definition: ExposurePatch.h:73
geom::AffineTransform const & toStandard() const
Definition: ExposurePatch.h:76
ExposurePatch(boost::shared_ptr< ExposureT const > exp, boost::shared_ptr< afw::detection::Footprint const > foot, geom::Point2D const &center)
Constructor.
Definition: ExposurePatch.h:49
ExposurePatch(boost::shared_ptr< ExposureT const > exp, afw::detection::Footprint const &standardFoot, geom::Point2D const &standardCenter, afw::geom::SkyWcs const &standardWcs)
Definition: ExposurePatch.h:54
geom::AffineTransform const & fromStandard() const
Definition: ExposurePatch.h:75
boost::shared_ptr< ExposureT const > const getExposure() const
Accessors.
Definition: ExposurePatch.h:72
unsigned char FlagT
Type for flags.
Definition: ExposurePatch.h:44
boost::shared_ptr< ExposurePatch const > ConstPtr
Definition: ExposurePatch.h:46
boost::shared_ptr< ExposurePatch > Ptr
Definition: ExposurePatch.h:45
lsst::afw::detection::Footprint Footprint
Definition: Source.h:59
Point< double, 2 > Point2D
Definition: Point.h:324
boost::shared_ptr< ExposurePatch< ExposureT > > makeExposurePatch(boost::shared_ptr< ExposureT const > exp, boost::shared_ptr< afw::detection::Footprint const > foot, geom::Point2D const &center)
Factory function for ExposurePatch.
Definition: ExposurePatch.h:92
A base class for image defects.