lsst.afw  14.0-42-g99f9a3040+1
PositionFunctor.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008 - 2012 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 /*
26  * image warping
27  */
28 #ifndef LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H
29 #define LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H
30 
31 #include "lsst/afw/geom/Point.h"
35 #include "lsst/afw/image/Wcs.h"
36 
37 namespace lsst {
38 namespace afw {
39 namespace math {
40 namespace detail {
41 
54 public:
55  explicit PositionFunctor() = default;
56  virtual ~PositionFunctor() = default;
57  PositionFunctor(PositionFunctor const &) = default;
58  PositionFunctor(PositionFunctor &&) = default;
59  PositionFunctor & operator=(PositionFunctor const &) = default;
61 
62  virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const = 0;
63 };
64 
69 public:
71  lsst::afw::geom::Point2D const &destXY0,
72  lsst::afw::geom::XYTransform const &XYTransform
73  )
75  : PositionFunctor(), _destXY0(destXY0), _xyTransformPtr(XYTransform.clone()) {}
76 
77  virtual ~XYTransformPositionFunctor() = default;
82 
83  virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const {
84  afw::geom::Point2D const destPos{lsst::afw::image::indexToPosition(destCol + _destXY0[0]),
85  lsst::afw::image::indexToPosition(destRow + _destXY0[1])};
86  return _xyTransformPtr->reverseTransform(destPos);
87  }
88 
89 private:
90  lsst::afw::geom::Point2D const _destXY0;
92 };
93 }
94 }
95 }
96 } // namespace lsst::afw::math::detail
97 
98 #endif // !defined(LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H)
PositionFunctor & operator=(PositionFunctor const &)=default
Functor class that wraps an XYTransform.
double indexToPosition(double ind)
Convert image index to image position.
Definition: ImageUtils.h:55
virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const
XYTransformPositionFunctor(lsst::afw::geom::Point2D const &destXY0, lsst::afw::geom::XYTransform const &XYTransform)
Base class to transform pixel position for a destination image to its position in the original source...
A base class for image defects.
Virtual base class for 2D transforms.
Definition: XYTransform.h:49
virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const =0