Util.h

Go to the documentation of this file.
00001 //# Copyright (C) 2005
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 #ifndef UTIL_H_
00026 #define UTIL_H_
00027 
00028 #include <QString>
00029 #include <casa/Arrays/Vector.h>
00030 #include <display/Display/DisplayCoordinateSystem.h>
00031 #include <imageanalysis/ImageAnalysis/PixelValueManipulatorData.h>
00032 #include <imageanalysis/ImageAnalysis/ImageCollapserData.h>
00033 
00034 class QWidget;
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038         template <class T> class ImageInterface;
00039         class ImageRegion;
00040 
00041         class Util {
00042 
00043 
00044         public:
00045                 static const QString ORGANIZATION;
00046                 static const QString APPLICATION;
00047                 static void showUserMessage( QString& msg, QWidget* parent);
00048                 static double degMinSecToRadians( int degrees, int mins, float secs );
00049                 static double hrMinSecToRadians( int hours, int mins, float secs );
00050                 static QString toHTML( const QString& baseStr );
00051                 static int getCenter( const Vector<Double>& values, Double& mean );
00052                 static void getRa(double radians, int& raHour, int& raMin, double& raSec);
00053                 static void getDec(double radians, int& decDeg, int& decMin, double& decSec);
00054                 static void minMax( double& min, double& max, const Vector<Double>& values );
00055                 static QString toDegreeString( int hrs, int mins, double secs );
00056                 static QString toDecString( int hrs, int mins, double secs );
00057                 static void appendSign( double rad, QString& degreeString );
00058                 static QList<QString> getTitleCaseVariations( QString source );
00059                 static QString toTitleCase( QString word );
00060                 static String mainImageName( String path );
00061 
00065                 static QString stripBrackets( QString unitStr );
00066 
00071                 static QString stripFont( QString unitStr );
00072 
00073                 //Support for tabular axes that are frequency.  Returns -1 if there
00074                 //is no tabular index in the image in frequency units.
00075                 static int getTabularFrequencyAxisIndex(SHARED_PTR<const ImageInterface<Float> > img);
00076 
00077                 static Record getRegionRecord( String shape, const DisplayCoordinateSystem& cSys,
00078                                         const Vector<Double>& x, const Vector<Double>& y);
00079 
00080                 static std::pair<Vector<Float>,Vector<Float> > getProfile(SHARED_PTR<const casa::ImageInterface<Float> >& imagePtr,
00081                                 const Vector<Double>& x, const Vector<Double>& y, const String& shape,
00082                                 int tabularAxis, ImageCollapserData::AggregateType, String unit,
00083                                 const String& coordinateType,
00084                                 const Quantity *const restFreq=0, const String& frame="");
00093                 static Record getEllipticalRegion3D( const DisplayCoordinateSystem& cSys,
00094                                                 const Vector<Double>& x, const Vector<Double>& y,
00095                                                 int channelMin, int channelMax, int spectralAxisNumber);
00096 
00106                 static Record getPolygonalRegion3D( const DisplayCoordinateSystem& cSys,
00107                                                 const Vector<Double>& x, const Vector<Double>& y,
00108                                                 int channelMin, int channelMax, int spectralAxisNumber);
00109 
00117                 static ImageRegion* getEllipsoid(const DisplayCoordinateSystem& cSys,
00118                                                         const Vector<Double>& x, const Vector<Double>& y);
00126                 static ImageRegion* getPolygon(const DisplayCoordinateSystem& cSys,
00127                                         const Vector<Double>& x, const Vector<Double>& y);
00128 
00133                 static bool arrayEquals( const Vector<Double>& a, const Vector<Double>& b );
00134         private:
00135                 Util();
00136                 virtual ~Util();
00137                 static double toRadians( double degrees );
00138                 static double toDecimalDegrees( int hrs, int mins, float seconds );
00139                 static Record make3DRegion( const DisplayCoordinateSystem& cSys, ImageRegion* shape3D,
00140                                         int channelMin, int channelMax, int spectralAxisNumber );
00141 
00142                 static const double PI;
00143                 static const double TIME_CONV;
00144                 static const double RAD_DEGREE_CONVERSION;
00145 
00146         };
00147 }
00148 #endif /* UTIL_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1