Isis 3.0 Developer's Reference (API) |
Home |
00001 #ifndef Statistics_h 00002 #define Statistics_h 00003 00023 #include <QObject> 00024 00025 #include <H5Cpp.h> 00026 #include <hdf5_hl.h> 00027 #include <hdf5.h> 00028 00029 #include "Constants.h" 00030 #include "SpecialPixel.h" 00031 #include "XmlStackedHandler.h" 00032 00033 class QDataStream; 00034 class QUuid; 00035 class QXmlStreamWriter; 00036 00037 namespace Isis { 00038 class Project;// ??? does xml stuff need project??? 00039 class XmlStackedHandlerReader; 00104 class Statistics : public QObject { 00105 Q_OBJECT 00106 public: 00107 Statistics(QObject *parent = 0); 00108 Statistics(Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent = 0); 00109 // TODO: does xml read/write stuff need Project input??? 00110 Statistics(const Statistics &other); 00111 virtual ~Statistics(); 00112 Statistics &operator=(const Statistics &other); 00113 00114 void Reset(); 00115 00116 void AddData(const double *data, const unsigned int count); 00117 void AddData(const double data); 00118 00119 void RemoveData(const double *data, const unsigned int count); 00120 void RemoveData(const double data); 00121 00122 void SetValidRange(const double minimum = Isis::ValidMinimum, 00123 const double maximum = Isis::ValidMaximum); 00124 00125 double ValidMinimum() const; 00126 double ValidMaximum() const; 00127 bool InRange(const double value); 00128 bool AboveRange(const double value); 00129 bool BelowRange(const double value); 00130 00131 double Average() const; 00132 double StandardDeviation() const; 00133 double Variance() const; 00134 double Sum() const; 00135 double SumSquare() const; 00136 double Rms() const; 00137 00138 double Minimum() const; 00139 double Maximum() const; 00140 double ChebyshevMinimum(const double percent = 99.5) const; 00141 double ChebyshevMaximum(const double percent = 99.5) const; 00142 double BestMinimum(const double percent = 99.5) const; 00143 double BestMaximum(const double percent = 99.5) const; 00144 double ZScore(const double value) const; 00145 00146 BigInt TotalPixels() const; 00147 BigInt ValidPixels() const; 00148 BigInt OverRangePixels() const; 00149 BigInt UnderRangePixels() const; 00150 BigInt NullPixels() const; 00151 BigInt LisPixels() const; 00152 BigInt LrsPixels() const; 00153 BigInt HisPixels() const; 00154 BigInt HrsPixels() const; 00155 BigInt OutOfRangePixels() const; 00156 bool RemovedData() const; 00157 00158 void save(QXmlStreamWriter &stream, const Project *project) const; 00159 // TODO: does xml stuff need project??? 00160 00161 QDataStream &write(QDataStream &stream) const; 00162 QDataStream &read(QDataStream &stream); 00163 00164 static H5::CompType compoundH5DataType(); 00165 00166 private: 00173 class XmlHandler : public XmlStackedHandler { 00174 public: 00175 XmlHandler(Statistics *statistics, Project *project); 00176 // TODO: does xml stuff need project??? 00177 ~XmlHandler(); 00178 00179 virtual bool startElement(const QString &namespaceURI, const QString &localName, 00180 const QString &qName, const QXmlAttributes &atts); 00181 virtual bool characters(const QString &ch); 00182 virtual bool endElement(const QString &namespaceURI, const QString &localName, 00183 const QString &qName); 00184 00185 private: 00186 Q_DISABLE_COPY(XmlHandler); 00187 00188 Statistics *m_xmlHandlerStatistics; 00189 Project *m_xmlHandlerProject; 00190 // TODO: does xml stuff need project??? 00191 QString m_xmlHandlerCharacters; 00192 }; 00193 00194 // QUuid *m_id; /**< A unique ID for this object (useful for others to reference 00195 // this object when saving to disk).*/ 00196 double m_sum; 00197 double m_sumsum; 00199 double m_minimum; 00200 double m_maximum; 00201 double m_validMinimum; 00202 double m_validMaximum; 00203 BigInt m_totalPixels; 00204 BigInt m_validPixels; 00205 BigInt m_nullPixels; 00206 BigInt m_lrsPixels; 00207 BigInt m_lisPixels; 00208 BigInt m_hrsPixels; 00209 BigInt m_hisPixels; 00210 BigInt m_underRangePixels; 00211 BigInt m_overRangePixels; 00212 bool m_removedData; 00214 }; 00215 00216 // operators to read/write Statistics to/from binary data 00217 QDataStream &operator<<(QDataStream &stream, const Statistics &statistics); 00218 QDataStream &operator>>(QDataStream &stream, Statistics &statistics); 00219 00220 } // end namespace isis 00221 00222 #endif 00223