LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
afw
11.0-2-g04d2804
include
lsst
afw
math
detail
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
34
#ifndef LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H
35
#define LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H
36
37
#include "
lsst/afw/geom/Point.h
"
38
#include "
lsst/afw/geom/AffineTransform.h
"
39
#include "
lsst/afw/image/ImageUtils.h
"
40
#include "
lsst/afw/image/Wcs.h
"
41
42
namespace
lsst {
43
namespace
afw {
44
namespace
math {
45
namespace
detail {
46
58
class
PositionFunctor
{
59
public
:
60
typedef
boost::shared_ptr<PositionFunctor>
Ptr
;
61
62
explicit
PositionFunctor
() {};
63
virtual
~PositionFunctor
() {};
64
65
virtual
lsst::afw::geom::Point2D
operator()
(
int
destCol,
int
destRow)
const
= 0;
66
};
67
68
73
class
WcsPositionFunctor
:
public
PositionFunctor
{
74
public
:
75
typedef
boost::shared_ptr<WcsPositionFunctor>
Ptr
;
76
77
explicit
WcsPositionFunctor
(
78
lsst::afw::geom::Point2D
const
&destXY0,
79
lsst::afw::image::Wcs
const
&destWcs,
80
lsst::afw::image::Wcs
const
&srcWcs
81
) :
82
PositionFunctor
(),
83
_destXY0
(destXY0),
84
_destWcs
(destWcs),
85
_srcWcs
(srcWcs)
86
{}
87
88
virtual
~WcsPositionFunctor
() {};
89
90
virtual
lsst::afw::geom::Point2D
operator()
(
int
destCol,
int
destRow)
const
{
91
double
const
col
=
lsst::afw::image::indexToPosition
(destCol +
_destXY0
[0]);
92
double
const
row
=
lsst::afw::image::indexToPosition
(destRow +
_destXY0
[1]);
93
lsst::afw::geom::Angle
sky1, sky2;
94
_destWcs
.
pixelToSky
(col, row, sky1, sky2);
95
return
_srcWcs
.
skyToPixel
(sky1, sky2);
96
}
97
98
private
:
99
lsst::afw::geom::Point2D
const
&
_destXY0
;
100
lsst::afw::image::Wcs
const
&
_destWcs
;
101
lsst::afw::image::Wcs
const
&
_srcWcs
;
102
};
103
104
109
class
AffineTransformPositionFunctor
:
public
PositionFunctor
{
110
public
:
111
// NOTE: The transform will be called to locate a *source* pixel given a *dest* pixel
112
// ... so we actually want to use the *inverse* transform of the affineTransform we were given.
113
// Thus _affineTransform is initialized to affineTransform.invert()
114
AffineTransformPositionFunctor
(
115
lsst::afw::geom::Point2D
const
&destXY0,
116
lsst::afw::geom::AffineTransform
const
&affineTransform
118
) :
119
PositionFunctor
(),
120
_destXY0
(destXY0),
121
_affineTransform
() {
122
_affineTransform
= affineTransform.
invert
();
123
}
124
125
virtual
lsst::afw::geom::Point2D
operator()
(
int
destCol,
int
destRow)
const
{
126
double
const
col
=
lsst::afw::image::indexToPosition
(destCol +
_destXY0
[0]);
127
double
const
row
=
lsst::afw::image::indexToPosition
(destRow +
_destXY0
[1]);
128
lsst::afw::geom::Point2D
p =
_affineTransform
(
lsst::afw::geom::Point2D
(col, row));
129
return
p;
130
}
131
private
:
132
lsst::afw::geom::Point2D
const
&
_destXY0
;
133
lsst::afw::geom::AffineTransform
_affineTransform
;
134
};
135
136
}}}}
// namespace lsst::afw::math::detail
137
138
#endif // !defined(LSST_AFW_MATH_DETAIL_POSITIONFUNCTOR_H)
lsst::afw::math::detail::WcsPositionFunctor::~WcsPositionFunctor
virtual ~WcsPositionFunctor()
Definition:
PositionFunctor.h:88
Point.h
A coordinate class intended to represent absolute positions.
lsst::afw::math::detail::PositionFunctor::Ptr
boost::shared_ptr< PositionFunctor > Ptr
Definition:
PositionFunctor.h:60
lsst::afw::image::indexToPosition
double indexToPosition(double ind)
Convert image index to image position.
Definition:
ImageUtils.h:54
lsst::afw::math::detail::WcsPositionFunctor::_srcWcs
lsst::afw::image::Wcs const & _srcWcs
Definition:
PositionFunctor.h:101
lsst::afw::image::Wcs::skyToPixel
geom::Point2D skyToPixel(geom::Angle sky1, geom::Angle sky2) const
Convert from sky coordinates (e.g. RA/dec) to pixel positions.
Definition:
Wcs.cc:782
lsst::afw::geom::AffineTransform::invert
AffineTransform const invert() const
lsst::afw::math::detail::WcsPositionFunctor::Ptr
boost::shared_ptr< WcsPositionFunctor > Ptr
Definition:
PositionFunctor.h:75
lsst::afw::math::detail::AffineTransformPositionFunctor
Derived functor class to transform pixel position for a destination image to its position in the sour...
Definition:
PositionFunctor.h:109
lsst::afw::math::detail::PositionFunctor::PositionFunctor
PositionFunctor()
Definition:
PositionFunctor.h:62
lsst::afw::math::detail::AffineTransformPositionFunctor::AffineTransformPositionFunctor
AffineTransformPositionFunctor(lsst::afw::geom::Point2D const &destXY0, lsst::afw::geom::AffineTransform const &affineTransform)
Definition:
PositionFunctor.h:114
lsst::afw::image::Wcs
Implementation of the WCS standard for a any projection.
Definition:
Wcs.h:107
lsst::afw::math::detail::WcsPositionFunctor::_destXY0
lsst::afw::geom::Point2D const & _destXY0
Definition:
PositionFunctor.h:99
lsst::afw::image::Wcs::pixelToSky
boost::shared_ptr< coord::Coord > pixelToSky(double pix1, double pix2) const
Convert from pixel position to sky coordinates (e.g. RA/dec)
Definition:
Wcs.cc:858
Wcs.h
ImageUtils.h
Image utility functions.
lsst::afw::math::detail::WcsPositionFunctor
Derived functor class to transform pixel position for a destination image to its position in the sour...
Definition:
PositionFunctor.h:73
lsst::afw::geom::Point< double, 2 >
lsst::afw::math::detail::AffineTransformPositionFunctor::operator()
virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const
Definition:
PositionFunctor.h:125
lsst::afw::geom::Angle
Definition:
Angle.h:104
lsst::afw::math::detail::PositionFunctor
Base class to transform pixel position for a destination image to its position in the original source...
Definition:
PositionFunctor.h:58
lsst::afw::math::detail::WcsPositionFunctor::WcsPositionFunctor
WcsPositionFunctor(lsst::afw::geom::Point2D const &destXY0, lsst::afw::image::Wcs const &destWcs, lsst::afw::image::Wcs const &srcWcs)
Definition:
PositionFunctor.h:77
lsst::afw::geom::AffineTransform
An affine coordinate transformation consisting of a linear transformation and an offset.
Definition:
AffineTransform.h:77
lsst::afw::math::detail::AffineTransformPositionFunctor::_destXY0
lsst::afw::geom::Point2D const & _destXY0
Definition:
PositionFunctor.h:132
lsst::afw::math::detail::PositionFunctor::~PositionFunctor
virtual ~PositionFunctor()
Definition:
PositionFunctor.h:63
AffineTransform.h
row
int row
Definition:
CR.cc:153
lsst::afw::math::detail::WcsPositionFunctor::operator()
virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const
Definition:
PositionFunctor.h:90
lsst::afw::math::detail::PositionFunctor::operator()
virtual lsst::afw::geom::Point2D operator()(int destCol, int destRow) const =0
lsst::afw::math::detail::AffineTransformPositionFunctor::_affineTransform
lsst::afw::geom::AffineTransform _affineTransform
Definition:
PositionFunctor.h:133
col
int col
Definition:
CR.cc:152
lsst::afw::math::detail::WcsPositionFunctor::_destWcs
lsst::afw::image::Wcs const & _destWcs
Definition:
PositionFunctor.h:100
Generated on Thu Sep 24 2015 02:29:15 for LSSTApplications by
1.8.5