casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: aips2-request@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 //# $Id$
27 
28 #ifndef COORDINATES_GAUSSIANCONVERT_H
29 #define COORDINATES_GAUSSIANCONVERT_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 template<class T> class Quantum;
40 
41 
42 // <summary>
43 // Converts Gaussian parameters between pixel and world
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="" date="" tests="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class=CoordinateSystem>CoordinateSystem</linkto>
53 // </prerequisite>
54 
55 // <synopsis>
56 // Converts Gaussian parameters between world and pixel.
57 // In the pixel coordinate system ([0,0] in center of image)
58 // the position angle is positive +y to -x. This is consistent
59 // with Gaussian2D. In the world coordinate system the pa
60 // is positive N through E
61 // </synopsis>
62 
63 // <example>
64 // <srcblock>
65 // </srcblock>
66 // </example>
67 
68 // <todo asof="1998/12/11">
69 // <li> Position angle signs require more thinking in Casacore
70 // </todo>
71 
73 {
74 public:
75 
76  // Default constructor
77  GaussianConvert ();
78 
79  // Constructor. You specify which world axes (must be length 2)
80  // of the coordinate system are the relevant ones for
81  // your gaussian (x then y)
82  GaussianConvert (const CoordinateSystem& cSys,
83  const Vector<uInt>& worldAxes);
84 
85  // Destructor
87 
88  // Copy constructor. Uses copy semantics.
89  GaussianConvert(const GaussianConvert& other);
90 
91  // Assignment operator. Uses copy semantics.
93 
94  // (Re)set the coordinate system
95  void setCoordinateSystem (const CoordinateSystem& cSys);
96 
97  // Re(set) the world axes
98  void setWorldAxes (const Vector<uInt>& worldAxes);
99 
100  // Convert Gaussian parameters from pixels to world. Returns
101  // False if it fails with an error message recoverable with
102  // function errorMessage. If you set the units of the output
103  // axis quanta they will be honoured, otherwise they will come out
104  // in the axis units of the coordinate system. For the output position angle,
105  // if the output units are not set, the units of the input position angle
106  // will be used.
107  Bool toWorld(Quantum<Double>& majorAxisOut, Quantum<Double>& minorAxisOut,
108  Quantum<Double>& positionAngleOut, Double majorAxisIn,
109  Double minorAxisIn, const Quantum<Double>& positionAngleIn);
110 
111  // Convert Gaussian parameters from world to pixel. Returns
112  // False if it fails with an error message recoverable with
113  // function errorMessage. For the output position angle,
114  // if the output units are not set, the units of the input position angle
115  // will be used.
116  Bool toPixel(Double& majorAxisOut, Double& minorAxisOut,
117  Quantum<Double>& positionAngleOut, const Quantum<Double>& majorAxisIn,
118  const Quantum<Double>& minorAxisIn, const Quantum<Double>& positionAngleIn);
119 
120  // Convert location
121  // <group>
122  Bool toPixel(Vector<Double>& pixel,
123  const Vector<Quantum<Double> >& world);
125  const Vector<Double>& pixel);
126  // </group>
127 
128  // Recover error messages from the conversion functions
130 
131 
132 private:
133 
138 
139  void convertAxes (Double& minorAxisOut, Double& majorAxisOut,
140  Quantum<Double>& positionAngleOut,
141  Double minorAxisIn, Double majorAxisIn,
142  const Quantum<Double>& positionAngleIn,
143  const CoordinateSystem& cSys,
144  String dir);
145 
146  void checkCoordinateSystem();
147 
148  void checkWorldAxes();
149 
151 
152 };
153 
154 
155 } //# NAMESPACE CASACORE - END
156 
157 #endif
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 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.
GaussianConvert & operator=(const GaussianConvert &other)
Assignment operator.
Converts Gaussian parameters between pixel and world.
void convertAxes(Double &minorAxisOut, Double &majorAxisOut, Quantum< Double > &positionAngleOut, Double minorAxisIn, Double majorAxisIn, const Quantum< Double > &positionAngleIn, const CoordinateSystem &cSys, String dir)
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
~GaussianConvert()
Destructor.
Double positionAngleRange(Double pa)
GaussianConvert()
Default constructor.
void setCoordinateSystem(const CoordinateSystem &cSys)
(Re)set the coordinate system
void setWorldAxes(const Vector< uInt > &worldAxes)
Re(set) the world axes.
String errorMessage() const
Recover error messages from the conversion functions.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Interconvert pixel and world coordinates.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42