lsst.meas.astrom  15.0-1-g1eca518+1
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 #include "lsst/afw/geom/Box.h"
30 #include "lsst/afw/geom/Angle.h"
32 #include "lsst/afw/geom/SkyWcs.h"
34 
35 namespace lsst {
36 namespace meas { namespace astrom {
37 
46 public:
47 
51  afw::geom::Point2D const & getPixelOrigin() const { return _pixelOrigin; }
52 
56  afw::geom::LinearTransform const & getCdMatrix() const { return _cdMatrix; }
57 
61  PolynomialTransform const & getPoly() const { return _poly; }
62 
63 protected:
64 
78  afw::geom::Point2D const & pixelOrigin,
79  afw::geom::LinearTransform const & cdMatrix,
80  PolynomialTransform const & poly
81  ) : _pixelOrigin(pixelOrigin),
82  _cdMatrix(cdMatrix),
83  _poly(poly)
84  {}
85 
86  SipTransformBase(SipTransformBase const & other) = default;
87  SipTransformBase(SipTransformBase && other) = default;
88  SipTransformBase & operator=(SipTransformBase const & other) = default;
89  SipTransformBase & operator=(SipTransformBase && other) = default;
90 
91  void swap(SipTransformBase & other) {
94  _poly.swap(other._poly);
95  }
96 
98 
102 };
103 
104 
144 public:
145 
153  static SipForwardTransform convert(
154  PolynomialTransform const & poly,
155  afw::geom::Point2D const & pixelOrigin,
156  afw::geom::LinearTransform const & cdMatrix
157  );
158 
166  static SipForwardTransform convert(
167  ScaledPolynomialTransform const & scaled,
168  afw::geom::Point2D const & pixelOrigin,
169  afw::geom::LinearTransform const & cdMatrix
170  );
171 
179  static SipForwardTransform convert(ScaledPolynomialTransform const & scaled);
180 
189  afw::geom::Point2D const & pixelOrigin,
190  afw::geom::LinearTransform const & cdMatrix,
191  PolynomialTransform const & forwardSipPoly
192  ) :
193  SipTransformBase(pixelOrigin, cdMatrix, forwardSipPoly)
194  {}
195 
196  SipForwardTransform(SipForwardTransform const & other) = default;
197 
198  SipForwardTransform(SipForwardTransform && other) = default;
199 
200  SipForwardTransform & operator=(SipForwardTransform const & other) = default;
201 
202  SipForwardTransform & operator=(SipForwardTransform && other) = default;
203 
204  void swap(SipForwardTransform & other) {
205  SipTransformBase::swap(other);
206  }
207 
211  afw::geom::AffineTransform linearize(afw::geom::Point2D const & in) const;
212 
216  afw::geom::Point2D operator()(afw::geom::Point2D const & uv) const;
217 
222  SipForwardTransform transformPixels(afw::geom::AffineTransform const & s) const;
223 
224 };
225 
226 
268 public:
269 
277  static SipReverseTransform convert(
278  PolynomialTransform const & poly,
279  afw::geom::Point2D const & pixelOrigin,
280  afw::geom::LinearTransform const & cdMatrix
281  );
282 
290  static SipReverseTransform convert(
291  ScaledPolynomialTransform const & scaled,
292  afw::geom::Point2D const & pixelOrigin,
293  afw::geom::LinearTransform const & cdMatrix
294  );
295 
303  static SipReverseTransform convert(ScaledPolynomialTransform const & scaled);
304 
313  afw::geom::Point2D const & pixelOrigin,
314  afw::geom::LinearTransform const & cdMatrix,
315  PolynomialTransform const & reverseSipPoly
316  ) : SipTransformBase(pixelOrigin, cdMatrix, reverseSipPoly),
317  _cdInverse(cdMatrix.invert())
318  {}
319 
320  SipReverseTransform(SipReverseTransform const & other) = default;
321 
322  SipReverseTransform(SipReverseTransform && other) = default;
323 
324  SipReverseTransform & operator=(SipReverseTransform const & other) = default;
325 
326  SipReverseTransform & operator=(SipReverseTransform && other) = default;
327 
328  void swap(SipReverseTransform & other) {
329  SipTransformBase::swap(other);
330  std::swap(_cdInverse, other._cdInverse);
331  }
332 
336  afw::geom::AffineTransform linearize(afw::geom::Point2D const & in) const;
337 
341  afw::geom::Point2D operator()(afw::geom::Point2D const & xy) const;
342 
347  SipReverseTransform transformPixels(afw::geom::AffineTransform const & s) const;
348 
349 private:
350  friend class PolynomialTransform;
352  afw::geom::LinearTransform _cdInverse;
353 };
354 
370  SipForwardTransform const & sipForward,
371  SipReverseTransform const & sipReverse,
372  afw::geom::SpherePoint const & skyOrigin
373 );
374 
392  afw::geom::SkyWcs const & wcs,
394 );
395 
405  afw::geom::SkyWcs const & wcs,
406  int nQuarter,
407  afw::geom::Extent2I const & dimensions
408 );
409 
410 
411 }}} // namespace lsst::meas::astrom
412 
413 #endif // !LSST_MEAS_ASTROM_SipTransform_INCLUDED
PolynomialTransform const & getPoly() const
Return the polynomial component of the transform (A,B) or (AP,BP).
Definition: SipTransform.h:61
SipForwardTransform(afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix, PolynomialTransform const &forwardSipPoly)
Construct a SipForwardTransform from its components.
Definition: SipTransform.h:188
T swap(T... args)
afw::geom::Point2D const & getPixelOrigin() const
Return the pixel origin (CRPIX, but zero-indexed) of the transform.
Definition: SipTransform.h:51
afw::geom::LinearTransform const & getCdMatrix() const
Return the CD matrix of the transform.
Definition: SipTransform.h:56
void swap(SipReverseTransform &other)
Definition: SipTransform.h:328
ItemVariant const * other
std::shared_ptr< afw::geom::SkyWcs > makeWcs(SipForwardTransform const &sipForward, SipReverseTransform const &sipReverse, afw::geom::SpherePoint const &skyOrigin)
Create a new TAN SIP Wcs from a pair of SIP transforms and the sky origin.
SipReverseTransform(afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix, PolynomialTransform const &reverseSipPoly)
Construct a SipReverseTransform from its components.
Definition: SipTransform.h:312
A transform that maps pixel coordinates to intermediate world coordinates according to the SIP conven...
Definition: SipTransform.h:143
void swap(PolynomialTransform &other)
Lightweight swap.
Base class for SIP transform objects.
Definition: SipTransform.h:45
SipTransformBase(afw::geom::Point2D const &pixelOrigin, afw::geom::LinearTransform const &cdMatrix, PolynomialTransform const &poly)
Construct a SipTransformBase from its components.
Definition: SipTransform.h:77
std::shared_ptr< afw::geom::SkyWcs > rotateWcsPixelsBy90(afw::geom::SkyWcs const &wcs, int nQuarter, afw::geom::Extent2I const &dimensions)
Return a new SkyWcs that represents a rotation of the image it corresponds to about the image&#39;s cente...
A 2-d coordinate transform represented by a lazy composition of an AffineTransform, a PolynomialTransform, and another AffineTransform.
afw::geom::LinearTransform _cdMatrix
Definition: SipTransform.h:100
A transform that maps intermediate world coordinates to pixel coordinates according to the SIP conven...
Definition: SipTransform.h:267
void transformPixelsInPlace(afw::geom::AffineTransform const &s)
Definition: SipTransform.cc:33
void swap(SipForwardTransform &other)
Definition: SipTransform.h:204
void swap(SipTransformBase &other)
Definition: SipTransform.h:91
SipTransformBase & operator=(SipTransformBase const &other)=default
std::shared_ptr< afw::geom::SkyWcs > transformWcsPixels(afw::geom::SkyWcs const &wcs, afw::geom::AffineTransform const &s)
Create a new SkyWcs whose pixel coordinate system has been transformed via an affine transform...
A 2-d coordinate transform represented by a pair of standard polynomials (one for each coordinate)...