casacore
Loading...
Searching...
No Matches
GaussianConvert.h
Go to the documentation of this file.
1// # GaussianConvert.h: Class to convert units of Gaussians from pixel to world
2// # Copyright (C) 1997,1998,1999,2000
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef COORDINATES_GAUSSIANCONVERT_H
27#define COORDINATES_GAUSSIANCONVERT_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/coordinates/Coordinates/CoordinateSystem.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36template <class T>
37class Quantum;
38
39// <summary>
40// Converts Gaussian parameters between pixel and world
41// </summary>
42
43// <use visibility=export>
44
45// <reviewed reviewer="" date="" tests="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class=CoordinateSystem>CoordinateSystem</linkto>
50// </prerequisite>
51
52// <synopsis>
53// Converts Gaussian parameters between world and pixel.
54// In the pixel coordinate system ([0,0] in center of image)
55// the position angle is positive +y to -x. This is consistent
56// with Gaussian2D. In the world coordinate system the pa
57// is positive N through E
58// </synopsis>
59
60// <example>
61// <srcblock>
62// </srcblock>
63// </example>
64
65// <todo asof="1998/12/11">
66// <li> Position angle signs require more thinking in Casacore
67// </todo>
68
70 public:
71 // Default constructor
73
74 // Constructor. You specify which world axes (must be length 2)
75 // of the coordinate system are the relevant ones for
76 // your gaussian (x then y)
77 GaussianConvert(const CoordinateSystem& cSys, const Vector<uInt>& worldAxes);
78
79 // Destructor
81
82 // Copy constructor. Uses copy semantics.
84
85 // Assignment operator. Uses copy semantics.
87
88 // (Re)set the coordinate system
90
91 // Re(set) the world axes
92 void setWorldAxes(const Vector<uInt>& worldAxes);
93
94 // Convert Gaussian parameters from pixels to world. Returns
95 // False if it fails with an error message recoverable with
96 // function errorMessage. If you set the units of the output
97 // axis quanta they will be honoured, otherwise they will come out
98 // in the axis units of the coordinate system. For the output position angle,
99 // if the output units are not set, the units of the input position angle
100 // will be used.
101 Bool toWorld(Quantum<Double>& majorAxisOut, Quantum<Double>& minorAxisOut,
102 Quantum<Double>& positionAngleOut, Double majorAxisIn, Double minorAxisIn,
103 const Quantum<Double>& positionAngleIn);
104
105 // Convert Gaussian parameters from world to pixel. Returns
106 // False if it fails with an error message recoverable with
107 // function errorMessage. For the output position angle,
108 // if the output units are not set, the units of the input position angle
109 // will be used.
110 Bool toPixel(Double& majorAxisOut, Double& minorAxisOut, Quantum<Double>& positionAngleOut,
111 const Quantum<Double>& majorAxisIn, const Quantum<Double>& minorAxisIn,
112 const Quantum<Double>& positionAngleIn);
113
114 // Convert location
115 // <group>
118 // </group>
119
120 // Recover error messages from the conversion functions
122
123 private:
128
129 void convertAxes(Double& minorAxisOut, Double& majorAxisOut, Quantum<Double>& positionAngleOut,
130 Double minorAxisIn, Double majorAxisIn, const Quantum<Double>& positionAngleIn,
131 const CoordinateSystem& cSys, String dir);
132
134
136
138};
139
140} // namespace casacore
141
142#endif
GaussianConvert(const GaussianConvert &other)
Copy constructor.
Double positionAngleRange(Double pa)
~GaussianConvert()
Destructor.
GaussianConvert & operator=(const GaussianConvert &other)
Assignment operator.
void setCoordinateSystem(const CoordinateSystem &cSys)
(Re)set the coordinate system
String errorMessage() const
Recover error messages from the conversion functions.
void setWorldAxes(const Vector< uInt > &worldAxes)
Re(set) the world axes.
Bool toWorld(Quantum< Double > &majorAxisOut, Quantum< Double > &minorAxisOut, Quantum< Double > &positionAngleOut, Double majorAxisIn, Double minorAxisIn, const Quantum< Double > &positionAngleIn)
Convert Gaussian parameters from pixels to world.
Bool toWorld(Vector< Quantum< Double > > &world, const Vector< Double > &pixel)
Bool toPixel(Double &majorAxisOut, Double &minorAxisOut, Quantum< Double > &positionAngleOut, const Quantum< Double > &majorAxisIn, const Quantum< Double > &minorAxisIn, const Quantum< Double > &positionAngleIn)
Convert Gaussian parameters from world to pixel.
Bool toPixel(Vector< Double > &pixel, const Vector< Quantum< Double > > &world)
Convert location.
GaussianConvert()
Default constructor.
void convertAxes(Double &minorAxisOut, Double &majorAxisOut, Quantum< Double > &positionAngleOut, Double minorAxisIn, Double majorAxisIn, const Quantum< Double > &positionAngleIn, const CoordinateSystem &cSys, String dir)
GaussianConvert(const CoordinateSystem &cSys, const Vector< uInt > &worldAxes)
Constructor.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53