ImageStatistics.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef IMAGES_IMAGESTATISTICS_H
00029 #define IMAGES_IMAGESTATISTICS_H
00030
00031
00032
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/casa/BasicSL/String.h>
00035 #include <casacore/casa/Utilities/DataType.h>
00036 #include <casacore/casa/Logging/LogIO.h>
00037 #include <casacore/lattices/LatticeMath/LatticeStatistics.h>
00038 #include <casacore/scimath/Mathematics/NumericTraits.h>
00039 #include <casacore/casa/iosstrfwd.h>
00040
00041 namespace casacore {
00042
00043
00044 template <class T> class ImageInterface;
00045 class IPosition;
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 template <class T> class ImageStatistics : public LatticeStatistics<T>
00100 {
00101 public:
00102
00103
00104
00105
00106
00107 ImageStatistics (const ImageInterface<T>& image,
00108 LogIO& os,
00109 Bool showProgress=True,
00110 Bool forceDisk=False);
00111
00112
00113
00114
00115
00116
00117 ImageStatistics (const ImageInterface<T>& image,
00118 Bool showProgress=True,
00119 Bool forceDisk=False);
00120
00121
00122
00123 ImageStatistics(const ImageStatistics<T> &other);
00124
00125
00126 virtual ~ImageStatistics ();
00127
00128
00129
00130
00131 ImageStatistics<T> &operator=(const ImageStatistics<T> &other);
00132
00133
00134
00135 Bool setNewImage (const ImageInterface<T>& image);
00136
00137 void setPrecision(Int precision);
00138
00139 void setBlc(const IPosition& blc);
00140
00141 IPosition getBlc() const;
00142
00143 Int getPrecision() const;
00144
00145
00146 void showRobust(const Bool show);
00147
00148 inline void recordMessages(const Bool rm) { _recordMessages = rm; }
00149
00150 inline vector<String> getMessages() { return _messages; }
00151
00152 inline void clearMessages() { _messages.resize(0); }
00153
00154 void setListStats(Bool b) { _listStats = b; }
00155 protected:
00156
00157 typedef typename NumericTraits<T>::PrecisionType AccumType;
00158
00159 virtual Bool _canDoFlux() const;
00160
00161
00162
00163 private:
00164
00165
00166 LogIO os_p;
00167 const ImageInterface<T>* pInImage_p;
00168 IPosition blc_;
00169 Int precision_;
00170 Bool _showRobust, _recordMessages, _listStats;
00171 mutable vector<String> _messages;
00172
00173
00174
00175
00176
00177 virtual void getLabels(String& higherOrder, String& xAxis, const IPosition& dPos) const;
00178
00179
00180
00181 virtual Bool _getBeamArea(
00182 Array<Double>& beamArea, String& msg
00183 ) const;
00184
00185
00186 virtual void listMinMax (ostringstream& osMin,
00187 ostringstream& osMax,
00188 Int oWidth, DataType type);
00189
00190
00191 virtual Bool listStats (Bool hasBeam, const IPosition& dPos,
00192 const Matrix<AccumType>& ord);
00193
00194 virtual void displayStats(
00195 AccumType nPts, AccumType sum, AccumType median,
00196 AccumType medAbsDevMed, AccumType quartile,
00197 AccumType sumSq, AccumType mean, AccumType var,
00198 AccumType rms, AccumType sigma, AccumType dMin,
00199 AccumType dMax, AccumType q1, AccumType q3
00200 );
00201
00202
00203
00204
00205 Quantum<AccumType> _flux(
00206 Bool& isFluxDensity, AccumType sum, Double beamAreaInPixels
00207 ) const;
00208
00209 Bool _computeFlux(
00210 Array<AccumType>& flux, const Array<AccumType>& npts,
00211 const Array<AccumType>& sum
00212 );
00213
00214 Bool _computeFlux(
00215 Quantum<AccumType>& flux, AccumType sum, const IPosition& pos,
00216 Bool posInLattice
00217 );
00218
00219 protected:
00220 using LatticeStatistics<T>::locInLattice;
00221 using LatticeStatistics<T>::setStream;
00222 using LatticeStatistics<T>::error_p;
00223 using LatticeStatistics<T>::goodParameterStatus_p;
00224 using LatticeStatistics<T>::haveLogger_p;
00225 using LatticeStatistics<T>::displayAxes_p;
00226 using LatticeStatistics<T>::cursorAxes_p;
00227 using LatticeStatistics<T>::doRobust_p;
00228 using LatticeStatistics<T>::doList_p;
00229 using LatticeStatistics<T>::fixedMinMax_p;
00230 using LatticeStatistics<T>::minPos_p;
00231 using LatticeStatistics<T>::maxPos_p;
00232 using LatticeStatistics<T>::blcParent_p;
00233 public:
00234 using LatticeStatistics<T>::NPTS;
00235 using LatticeStatistics<T>::SUM;
00236 using LatticeStatistics<T>::FLUX;
00237 using LatticeStatistics<T>::MEAN;
00238 using LatticeStatistics<T>::MEDIAN;
00239 using LatticeStatistics<T>::RMS;
00240 using LatticeStatistics<T>::SIGMA;
00241 using LatticeStatistics<T>::MIN;
00242 using LatticeStatistics<T>::MAX;
00243 };
00244
00245
00246 #ifdef AIPS_CXX11
00247 extern template class ImageStatistics<Float>;
00248 #endif
00249
00250
00251 }
00252
00253 #ifndef CASACORE_NO_AUTO_TEMPLATES
00254 #include <casacore/images/Images/ImageStatistics.tcc>
00255 #endif //# CASACORE_NO_AUTO_TEMPLATES
00256 #endif
00257