25 #if !defined(LSST_MEAS_ALGORITHMS_EXPOSURE_PATCH_H)
26 #define LSST_MEAS_ALGORITHMS_EXPOSURE_PATCH_H
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"
33 namespace lsst {
namespace meas {
namespace algorithms {
38 template<
typename ExposureT>
47 CONST_PTR(afw::detection::Footprint) foot,
48 afw::geom::Point2D const& center
49 ): _exp(exp), _foot(foot), _center(center), _fromStandard(), _toStandard() {}
51 afw::detection::Footprint
const& standardFoot,
52 afw::geom::Point2D
const& standardCenter,
53 afw::image::Wcs
const& standardWcs
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,
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);
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; }
74 void setCenter(afw::geom::Point2D
const& center) { _center = center; }
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;
85 template<typename ExposureT>
87 CONST_PTR(ExposureT) exp,
88 CONST_PTR(afw::detection::Footprint) foot,
89 afw::geom::Point2D const& center
91 return std::make_shared<ExposurePatch<ExposureT> >(exp, foot, center);
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
100 return std::make_shared<ExposurePatch<ExposureT> >(exp, standardFoot, standardCenter, standardWcs);
void setCenter(afw::geom::Point2D const ¢er)
Modifiers.
boost::shared_ptr< ExposureT const > const getExposure() const
Accessors.
afw::geom::Point2D const & getCenter() const
A convenience container for the exposure, peak and footprint that will be measured.
unsigned char FlagT
Type for flags.
ExposurePatch(boost::shared_ptr< ExposureT const > exp, afw::detection::Footprint const &standardFoot, afw::geom::Point2D const &standardCenter, afw::image::Wcs const &standardWcs)
boost::shared_ptr< ExposurePatch const > ConstPtr
boost::shared_ptr< ExposurePatch< ExposureT > > makeExposurePatch(boost::shared_ptr< ExposureT const > exp, boost::shared_ptr< afw::detection::Footprint const > foot, afw::geom::Point2D const ¢er)
Factory function for ExposurePatch.
boost::shared_ptr< ExposurePatch > Ptr
afw::geom::AffineTransform const & fromStandard() const
afw::geom::AffineTransform const & toStandard() const
boost::shared_ptr< afw::detection::Footprint const > const getFootprint() const