00001 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2003 00002 //# Associated Universities, Inc. Washington DC, USA. 00003 //# 00004 //# This library is free software; you can redistribute it and/or modify it 00005 //# under the terms of the GNU Library General Public License as published by 00006 //# the Free Software Foundation; either version 2 of the License, or (at your 00007 //# option) any later version. 00008 //# 00009 //# This library is distributed in the hope that it will be useful, but WITHOUT 00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 //# License for more details. 00013 //# 00014 //# You should have received a copy of the GNU Library General Public License 00015 //# along with this library; if not, write to the Free Software Foundation, 00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00017 //# 00018 //# Correspondence concerning AIPS++ should be addressed as follows: 00019 //# Internet email: aips2-request@nrao.edu. 00020 //# Postal address: AIPS++ Project Office 00021 //# National Radio Astronomy Observatory 00022 //# 520 Edgemont Road 00023 //# Charlottesville, VA 22903-2475 USA 00024 //# 00025 //# $Id: HostInfoDarwin.h 21521 2014-12-10 08:06:42Z gervandiepen $ 00026 00027 #ifndef SCIMATH_GAUSSIANBEAM_H 00028 #define SCIMATH_GAUSSIANBEAM_H 00029 00030 #include <casacore/casa/aips.h> 00031 #include <casacore/casa/Quanta/Quantum.h> 00032 00033 namespace casacore { 00034 00035 // <summary> 00036 // Represents a Gaussian restoring beam associated with an image. 00037 // </summary> 00038 00039 // <use visibility=export> 00040 00041 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00042 // </reviewed> 00043 00044 // <prerequisite> 00045 // </prerequisite> 00046 00047 // <etymology> 00048 // A Gaussian Beam. 00049 // </etymology> 00050 00051 // <synopsis> 00052 // This class represents a Gaussian restoring beam associated with 00053 // a deconvolved image. 00054 // </synopsis> 00055 // 00056 // <example> 00057 00058 // </example> 00059 00060 00061 // <motivation> 00062 // Restoring beams are used many places in image analysis tasks. 00063 // </motivation> 00064 00065 // <todo> 00066 // </todo> 00067 00068 class GaussianBeam { 00069 public: 00070 00071 static const GaussianBeam NULL_BEAM; 00072 00073 // create a beam with all quantities zero (a null beam). 00074 GaussianBeam(); 00075 00076 00077 // Construct a beam from a set of Quantities. If minor > major 00078 // an exception is thrown. If any units are not angular, an 00079 // exception is thrown 00080 GaussianBeam( 00081 const Quantity& major, const Quantity& minor, 00082 const Quantity& pa 00083 ); 00084 00085 // Construct a beam from a 3-Vector of Quantities representing 00086 // the major axis, the minor axis and the position angle (in that order). 00087 // If parms[1] > parms[0] (minor axis > major axis), 00088 // an exception is thrown. If any units are not angular, an 00089 // exception is thrown 00090 GaussianBeam( 00091 const Vector<Quantity>& parms 00092 ); 00093 00094 GaussianBeam(const GaussianBeam& other); 00095 00096 ~GaussianBeam(); 00097 00098 GaussianBeam& operator=(const GaussianBeam& other); 00099 00100 Bool operator==(const GaussianBeam& other) const; 00101 00102 Bool operator!=(const GaussianBeam& other) const; 00103 00104 // returns the major axis in the same units as it had at construction 00105 const Quantity& getMajor() const; 00106 00107 // returns the value portion of the major axis in the specified units 00108 Double getMajor(const Unit& u) const; 00109 00110 // returns the minor axis in the same units as it had at construction 00111 const Quantity& getMinor() const; 00112 00113 // returns the value portion of the minor axis in the specified units 00114 Double getMinor(const Unit& u) const; 00115 00116 // returns the position angle's value as it was at construction, 00117 // unless <src>unwrap</src> is True, in which case the value of the angle 00118 // returned will be between -90 and 90 degrees (but with unit the same 00119 // as it had when this object was constructed). 00120 Quantity getPA(const Bool unwrap=True) const; 00121 00122 // returns the value portion of the position angle in the specified units 00123 Double getPA(const Unit& u, const Bool unwrap=True) const; 00124 00125 // returns the beam area in the specified <src>unit</src>, which much conform to 00126 // solid angle units. 00127 Double getArea(const Unit& unit) const; 00128 00129 // is this object a null beam (ie is either its major and/or minor axis zero)? 00130 Bool isNull() const; 00131 00132 // returns GassianBeam. 00133 static const String& className(); 00134 00135 Record toRecord() const; 00136 00137 void setMajorMinor(const Quantity& majAx, const Quantity& minAx); 00138 00139 void setPA(const Quantity& pa); 00140 00141 static GaussianBeam fromRecord(const Record& rec); 00142 00143 // convert this object to a three-Vector of (major FWHM, minor FWHM, and pa). 00144 // If <src>unwrap</src> is True, the returned pa will fall between -90 and +90 00145 // degrees. 00146 Vector<Quantity> toVector(const Bool unwrap=True) const; 00147 00148 // convert stored Quantities to the specified units 00149 void convert(const String& majUnit, const String& minUnit, 00150 const String& paUnit); 00151 00152 protected: 00153 Quantity _major, _minor, _pa; 00154 00155 }; 00156 00157 00158 00159 ostream &operator<<(ostream &os, const GaussianBeam& beam); 00160 00161 LogIO &operator<<(LogIO &os, const GaussianBeam& beam); 00162 00163 Bool near(const GaussianBeam& left, const GaussianBeam& other, 00164 const Double relWidthTol, const Quantity& absPaTol); 00165 00166 } //# end namespace 00167 00168 #endif 00169