USGS

Isis 3.0 Object Programmers' Reference

Home

Statistics.h
Go to the documentation of this file.
1 #ifndef Statistics_h
2 #define Statistics_h
3 
23 #include <QObject>
24 
25 #include <H5Cpp.h>
26 #include <hdf5_hl.h>
27 #include <hdf5.h>
28 
29 #include "Constants.h"
30 #include "SpecialPixel.h"
31 #include "XmlStackedHandler.h"
32 
33 class QDataStream;
34 class QUuid;
35 class QXmlStreamWriter;
36 
37 namespace Isis {
38  class Project;// ??? does xml stuff need project???
39  class XmlStackedHandlerReader;
104  class Statistics : public QObject {
105  Q_OBJECT
106  public:
107  Statistics(QObject *parent = 0);
108  Statistics(Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);
109  // TODO: does xml read/write stuff need Project input???
110  Statistics(const Statistics &other);
111  virtual ~Statistics();
112  Statistics &operator=(const Statistics &other);
113 
114  void Reset();
115 
116  void AddData(const double *data, const unsigned int count);
117  void AddData(const double data);
118 
119  void RemoveData(const double *data, const unsigned int count);
120  void RemoveData(const double data);
121 
122  void SetValidRange(const double minimum = Isis::ValidMinimum,
123  const double maximum = Isis::ValidMaximum);
124 
125  double ValidMinimum() const;
126  double ValidMaximum() const;
127  bool InRange(const double value);
128  bool AboveRange(const double value);
129  bool BelowRange(const double value);
130 
131  double Average() const;
132  double StandardDeviation() const;
133  double Variance() const;
134  double Sum() const;
135  double SumSquare() const;
136  double Rms() const;
137 
138  double Minimum() const;
139  double Maximum() const;
140  double ChebyshevMinimum(const double percent = 99.5) const;
141  double ChebyshevMaximum(const double percent = 99.5) const;
142  double BestMinimum(const double percent = 99.5) const;
143  double BestMaximum(const double percent = 99.5) const;
144  double ZScore(const double value) const;
145 
146  BigInt TotalPixels() const;
147  BigInt ValidPixels() const;
148  BigInt OverRangePixels() const;
149  BigInt UnderRangePixels() const;
150  BigInt NullPixels() const;
151  BigInt LisPixels() const;
152  BigInt LrsPixels() const;
153  BigInt HisPixels() const;
154  BigInt HrsPixels() const;
155  BigInt OutOfRangePixels() const;
156  bool RemovedData() const;
157 
158  void save(QXmlStreamWriter &stream, const Project *project) const;
159  // TODO: does xml stuff need project???
160 
161  QDataStream &write(QDataStream &stream) const;
162  QDataStream &read(QDataStream &stream);
163 
164  static H5::CompType compoundH5DataType();
165 
166  private:
173  class XmlHandler : public XmlStackedHandler {
174  public:
175  XmlHandler(Statistics *statistics, Project *project);
176  // TODO: does xml stuff need project???
177  ~XmlHandler();
178 
179  virtual bool startElement(const QString &namespaceURI, const QString &localName,
180  const QString &qName, const QXmlAttributes &atts);
181  virtual bool characters(const QString &ch);
182  virtual bool endElement(const QString &namespaceURI, const QString &localName,
183  const QString &qName);
184 
185  private:
186  Q_DISABLE_COPY(XmlHandler);
187 
188  Statistics *m_xmlHandlerStatistics;
189  Project *m_xmlHandlerProject;
190  // TODO: does xml stuff need project???
191  QString m_xmlHandlerCharacters;
192  };
193 
194 // QUuid *m_id; /**< A unique ID for this object (useful for others to reference
195 // this object when saving to disk).*/
196  double m_sum;
197  double m_sumsum;
199  double m_minimum;
200  double m_maximum;
201  double m_validMinimum;
202  double m_validMaximum;
203  BigInt m_totalPixels;
204  BigInt m_validPixels;
205  BigInt m_nullPixels;
206  BigInt m_lrsPixels;
207  BigInt m_lisPixels;
208  BigInt m_hrsPixels;
209  BigInt m_hisPixels;
214  };
215 
216  // operators to read/write Statistics to/from binary data
217  QDataStream &operator<<(QDataStream &stream, const Statistics &statistics);
218  QDataStream &operator>>(QDataStream &stream, Statistics &statistics);
219 
220 } // end namespace isis
221 
222 #endif
223