Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/GaussianConvert_8h_source.html
Дата изменения: Unknown
Дата индексирования: Mon Feb 14 21:55:51 2011
Кодировка:
casacore: coordinates/Coordinates/GaussianConvert.h Source File

GaussianConvert.h

Go to the documentation of this file.
00001 //# GaussianConvert.h: Class to convert units of Gaussians from pixel to world 
00002 //# Copyright (C) 1997,1998,1999,2000
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: GaussianConvert.h 20299 2008-04-03 05:56:44Z gervandiepen $
00027 
00028 #ifndef COORDINATES_GAUSSIANCONVERT_H
00029 #define COORDINATES_GAUSSIANCONVERT_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <casa/Arrays/Vector.h>
00034 #include <coordinates/Coordinates/CoordinateSystem.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 template<class T> class Quantum;
00039 
00040 
00041 // <summary>
00042 // Converts Gaussian parameters between pixel and world
00043 // </summary>
00044 
00045 // <use visibility=export>
00046 
00047 // <reviewed reviewer="" date="" tests="">
00048 // </reviewed>
00049 
00050 // <prerequisite>
00051 //   <li> <linkto class=CoordinateSystem>CoordinateSystem</linkto>
00052 // </prerequisite>
00053 
00054 // <synopsis> 
00055 // Converts Gaussian parameters between world and pixel. 
00056 // In the pixel coordinate system ([0,0] in center of image)
00057 // the position angle is positive +y to -x. This is consistent
00058 // with Gaussian2D.  In the world coordinate system the pa
00059 // is positive N through E
00060 // </synopsis> 
00061 
00062 // <example>
00063 // <srcblock>
00064 // </srcblock>
00065 // </example>
00066 
00067 // <todo asof="1998/12/11">
00068 //  <li> Position angle signs require more thinking in aips++
00069 // </todo>
00070 
00071 class GaussianConvert
00072 {
00073 public:
00074 
00075     // Default constructor
00076     GaussianConvert ();
00077 
00078     // Constructor.  You specify which world axes (must be length 2)
00079     // of the coordinate system are the relevant ones for
00080     // your gaussian (x then y)
00081     GaussianConvert (const CoordinateSystem& cSys, 
00082                      const Vector<uInt>& worldAxes);
00083 
00084     // Destructor
00085    ~GaussianConvert ();
00086 
00087     // Copy constructor.  Uses copy semantics.
00088     GaussianConvert(const GaussianConvert& other);
00089  
00090     // Assignment operator. Uses copy semantics.
00091     GaussianConvert& operator=(const GaussianConvert& other);
00092 
00093     // (Re)set the coordinate system 
00094     void setCoordinateSystem (const CoordinateSystem& cSys);
00095 
00096     // Re(set) the world axes 
00097     void setWorldAxes (const Vector<uInt>& worldAxes);
00098 
00099     // Convert Gaussian parameters from pixels to world.  Returns
00100     // False if it fails with an error message recoverable with
00101     // function errorMessage.  If you set the units of the output
00102     // axis quanta they will be honoured, otherwise they will come out
00103     // in the axis units of the coordinate system.  For the output position angle,
00104     // if the output units are not set, the units of the input position angle
00105     // will be used.
00106     Bool toWorld(Quantum<Double>& majorAxisOut, Quantum<Double>& minorAxisOut,
00107                  Quantum<Double>& positionAngleOut, Double majorAxisIn,
00108                  Double minorAxisIn, const Quantum<Double>& positionAngleIn);
00109 
00110     // Convert Gaussian parameters from world to pixel.  Returns
00111     // False if it fails with an error message recoverable with
00112     // function errorMessage. For the output position angle,
00113     // if the output units are not set, the units of the input position angle
00114     // will be used.
00115     Bool toPixel(Double& majorAxisOut, Double& minorAxisOut,
00116                  Quantum<Double>& positionAngleOut, const Quantum<Double>& majorAxisIn,
00117                  const Quantum<Double>& minorAxisIn, const Quantum<Double>& positionAngleIn);
00118 
00119     // Convert location
00120     // <group>
00121     Bool toPixel(Vector<Double>& pixel,
00122                  const Vector<Quantum<Double> >& world);
00123     Bool toWorld(Vector<Quantum<Double> >& world,
00124                  const Vector<Double>& pixel);
00125     // </group>
00126 
00127     // Deconvolve the parameters of a source Gaussian from a beam Gaussian 
00128     // to give a model Gaussian.  The return is True if the model appears
00129     // to be a point source and the output model will be set to
00130     // the parameters of the beam.  If the units of the model are not given,
00131     // they will be set to the units of the source.
00132     static Bool deconvolve(Quantum<Double>& majorAxisModel, 
00133                            Quantum<Double>& minorAxisModel,
00134                            Quantum<Double>& positionAngleModel, 
00135                            const Quantum<Double>& majorAxisSource,
00136                            const Quantum<Double>& minorAxisSource,
00137                            const Quantum<Double>& positionAngleSource,
00138                            const Quantum<Double>& majorAxisBeam,
00139                            const Quantum<Double>& minorAxisBeam,
00140                            const Quantum<Double>& positionAngleBeam);
00141 
00142     // Recover error messages from the conversion functions
00143     String errorMessage() const {return itsErrorMessage;}
00144 
00145 
00146 private:
00147 
00148    CoordinateSystem itsCSys;
00149    Vector<uInt> itsWorldAxes;
00150    String itsErrorMessage;
00151    Bool itsValid;
00152 
00153    void convertAxes (Double& minorAxisOut, Double& majorAxisOut,
00154                      Quantum<Double>& positionAngleOut,
00155                      Double minorAxisIn, Double majorAxisIn,
00156                      const Quantum<Double>& positionAngleIn,
00157                      const CoordinateSystem& cSys,
00158                      String dir);
00159 
00160    void checkCoordinateSystem();
00161 
00162    void checkWorldAxes();
00163 
00164    Double positionAngleRange(Double pa);
00165 
00166 };
00167 
00168 
00169 } //# NAMESPACE CASA - END
00170 
00171 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines