LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
SipTransform.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2016 LSST/AURA
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 #ifndef LSST_MEAS_ASTROM_SipTransform_INCLUDED
25 #define LSST_MEAS_ASTROM_SipTransform_INCLUDED
26 
29 
30 
31 namespace lsst { namespace afw { namespace image {
32 
33 class TanWcs;
34 
35 } // namespace image
36 
37 namespace coord {
38 
39 class Coord;
40 
41 } // namespace coord
42 
43 } // namespace afw
44 
45 namespace meas { namespace astrom {
46 
55 public:
56 
60  afw::geom::Point2D const & getPixelOrigin() const { return _pixelOrigin; }
61 
65  afw::geom::LinearTransform const & getCDMatrix() const { return _cdMatrix; }
66 
70  PolynomialTransform const & getPoly() const { return _poly; }
71 
72 protected:
73 
87  afw::geom::Point2D const & pixelOrigin,
88  afw::geom::LinearTransform const & cdMatrix,
89  PolynomialTransform const & poly
90  ) : _pixelOrigin(pixelOrigin),
91  _cdMatrix(cdMatrix),
92  _poly(poly)
93  {}
94 
95  SipTransformBase(SipTransformBase const & other) = default;
96  SipTransformBase(SipTransformBase && other) = default;
97  SipTransformBase & operator=(SipTransformBase const & other) = default;
98  SipTransformBase & operator=(SipTransformBase && other) = default;
99 
100  void swap(SipTransformBase & other) {
102  std::swap(_cdMatrix, other._cdMatrix);
103  _poly.swap(other._poly);
104  }
105 
109 };
110 
111 
151 public:
152 
161  PolynomialTransform const & poly,
162  afw::geom::Point2D const & pixelOrigin,
163  afw::geom::LinearTransform const & cdMatrix
164  );
165 
174  ScaledPolynomialTransform const & scaled,
175  afw::geom::Point2D const & pixelOrigin,
176  afw::geom::LinearTransform const & cdMatrix
177  );
178 
187 
196  afw::geom::Point2D const & pixelOrigin,
197  afw::geom::LinearTransform const & cdMatrix,
198  PolynomialTransform const & forwardSipPoly
199  ) :
200  SipTransformBase(pixelOrigin, cdMatrix, forwardSipPoly)
201  {}
202 
203  SipForwardTransform(SipForwardTransform const & other) = default;
204 
205  SipForwardTransform(SipForwardTransform && other) = default;
206 
207  SipForwardTransform & operator=(SipForwardTransform const & other) = default;
208 
209  SipForwardTransform & operator=(SipForwardTransform && other) = default;
210 
211  void swap(SipForwardTransform & other) {
212  SipTransformBase::swap(other);
213  }
214 
219 
224 
225 };
226 
227 
269 public:
270 
279  PolynomialTransform const & poly,
280  afw::geom::Point2D const & pixelOrigin,
281  afw::geom::LinearTransform const & cdMatrix
282  );
283 
292  ScaledPolynomialTransform const & scaled,
293  afw::geom::Point2D const & pixelOrigin,
294  afw::geom::LinearTransform const & cdMatrix
295  );
296 
305 
314  afw::geom::Point2D const & pixelOrigin,
315  afw::geom::LinearTransform const & cdMatrix,
316  PolynomialTransform const & reverseSipPoly
317  ) : SipTransformBase(pixelOrigin, cdMatrix, reverseSipPoly),
318  _cdInverse(cdMatrix.invert())
319  {}
320 
321  SipReverseTransform(SipReverseTransform const & other) = default;
322 
323  SipReverseTransform(SipReverseTransform && other) = default;
324 
325  SipReverseTransform & operator=(SipReverseTransform const & other) = default;
326 
327  SipReverseTransform & operator=(SipReverseTransform && other) = default;
328 
329  void swap(SipReverseTransform & other) {
330  SipTransformBase::swap(other);
332  }
333 
338 
343 
344 private:
345  friend class PolynomialTransform;
348 };
349 
364 std::shared_ptr<afw::image::TanWcs> makeWcs(
365  SipForwardTransform const & sipForward,
366  SipReverseTransform const & sipReverse,
367  afw::coord::Coord const & skyOrigin
368 );
369 
370 }}} // namespace lsst::meas::astrom
371 
372 #endif // !LSST_MEAS_ASTROM_SipTransform_INCLUDED
SipForwardTransform & operator=(SipForwardTransform const &other)=default
static SipReverseTransform convert(PolynomialTransform const &poly, afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix)
Convert a PolynomialTransform to an equivalent SipReverseTransform.
Definition: SipTransform.cc:90
afw::geom::Point2D operator()(afw::geom::Point2D const &xy) const
Apply the transform to a point.
SipTransformBase & operator=(SipTransformBase const &other)=default
afw::geom::LinearTransform const & getCDMatrix() const
Return the CD matrix of the transform.
Definition: SipTransform.h:65
void swap(Mask< PixelT > &a, Mask< PixelT > &b)
Definition: Mask.cc:524
void swap(SipForwardTransform &other)
Definition: SipTransform.h:211
afw::geom::LinearTransform _cdInverse
Definition: SipTransform.h:347
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
SipReverseTransform(afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix, PolynomialTransform const &reverseSipPoly)
Construct a SipReverseTransform from its components.
Definition: SipTransform.h:313
A 2D linear coordinate transformation.
A transform that maps pixel coordinates to intermediate world coordinates according to the SIP conven...
Definition: SipTransform.h:150
An affine coordinate transformation consisting of a linear transformation and an offset.
SipTransformBase(afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix, PolynomialTransform const &poly)
Construct a SipTransformBase from its components.
Definition: SipTransform.h:86
void swap(PolynomialTransform &other)
Lightweight swap.
SipForwardTransform(afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix, PolynomialTransform const &forwardSipPoly)
Construct a SipForwardTransform from its components.
Definition: SipTransform.h:195
Base class for SIP transform objects.
Definition: SipTransform.h:54
std::shared_ptr< afw::image::TanWcs > makeWcs(SipForwardTransform const &sipForward, SipReverseTransform const &sipReverse, afw::coord::Coord const &skyOrigin)
Create a new TAN SIP Wcs from a pair of SIP transforms and the sky origin.
A 2-d coordinate transform represented by a lazy composition of an AffineTransform, a PolynomialTransform, and another AffineTransform.
A transform that maps intermediate world coordinates to pixel coordinates according to the SIP conven...
Definition: SipTransform.h:268
afw::geom::AffineTransform linearize(afw::geom::Point2D const &in) const
Return an approximate affine transform at the given point.
Definition: SipTransform.cc:78
afw::geom::AffineTransform linearize(afw::geom::Point2D const &in) const
Return an approximate affine transform at the given point.
SipReverseTransform & operator=(SipReverseTransform const &other)=default
afw::geom::Point2D operator()(afw::geom::Point2D const &uv) const
Apply the transform to a point.
Definition: SipTransform.cc:85
afw::geom::Point2D const & getPixelOrigin() const
Return the pixel origin (CRPIX) of the transform.
Definition: SipTransform.h:60
This is the base class for spherical coordinates.
Definition: Coord.h:69
void swap(SipReverseTransform &other)
Definition: SipTransform.h:329
afw::geom::LinearTransform _cdMatrix
Definition: SipTransform.h:107
PolynomialTransform const & getPoly() const
Return the polynomial component of the transform (A,B) or (AP,BP).
Definition: SipTransform.h:70
void swap(SipTransformBase &other)
Definition: SipTransform.h:100
static SipForwardTransform convert(PolynomialTransform const &poly, afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix)
Convert a PolynomialTransform to an equivalent SipForwardTransform.
Definition: SipTransform.cc:33
A 2-d coordinate transform represented by a pair of standard polynomials (one for each coordinate)...