Isis 3.0
Back | Home
Statistics.h
Go to the documentation of this file.
1 #ifndef Statistics_h
2 #define Statistics_h
3 
23 #include <QObject>
24 #include <QString>
25 
26 #include <H5Cpp.h>
27 #include <hdf5_hl.h>
28 #include <hdf5.h>
29 
30 #include "Constants.h"
31 #include "PvlGroup.h"
32 #include "SpecialPixel.h"
33 #include "XmlStackedHandler.h"
34 
35 class QDataStream;
36 class QUuid;
37 class QXmlStreamWriter;
38 
39 namespace Isis {
40  class Project;// ??? does xml stuff need project???
41  class XmlStackedHandlerReader;
109  class Statistics : public QObject {
110  Q_OBJECT
111  public:
112  Statistics(QObject *parent = 0);
113  Statistics(Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);
114  Statistics(const PvlGroup &inStats, QObject *parent = 0);
115  // TODO: does xml read/write stuff need Project input???
116  Statistics(const Statistics &other);
117  virtual ~Statistics();
118  Statistics &operator=(const Statistics &other);
119 
120  void Reset();
121 
122  void AddData(const double *data, const unsigned int count);
123  void AddData(const double data);
124 
125  void RemoveData(const double *data, const unsigned int count);
126  void RemoveData(const double data);
127 
128  void SetValidRange(const double minimum = Isis::ValidMinimum,
129  const double maximum = Isis::ValidMaximum);
130 
131  double ValidMinimum() const;
132  double ValidMaximum() const;
133  bool InRange(const double value);
134  bool AboveRange(const double value);
135  bool BelowRange(const double value);
136 
137  double Average() const;
138  double StandardDeviation() const;
139  double Variance() const;
140  double Sum() const;
141  double SumSquare() const;
142  double Rms() const;
143 
144  double Minimum() const;
145  double Maximum() const;
146  double ChebyshevMinimum(const double percent = 99.5) const;
147  double ChebyshevMaximum(const double percent = 99.5) const;
148  double BestMinimum(const double percent = 99.5) const;
149  double BestMaximum(const double percent = 99.5) const;
150  double ZScore(const double value) const;
151 
152  BigInt TotalPixels() const;
153  BigInt ValidPixels() const;
154  BigInt OverRangePixels() const;
155  BigInt UnderRangePixels() const;
156  BigInt NullPixels() const;
157  BigInt LisPixels() const;
158  BigInt LrsPixels() const;
159  BigInt HisPixels() const;
160  BigInt HrsPixels() const;
161  BigInt OutOfRangePixels() const;
162  bool RemovedData() const;
163 
164  PvlGroup toPvl(QString name = "Statistics") const;
165 
166  void save(QXmlStreamWriter &stream, const Project *project) const;
167  // TODO: does xml stuff need project???
168 
169  QDataStream &write(QDataStream &stream) const;
170  QDataStream &read(QDataStream &stream);
171 
172  static H5::CompType compoundH5DataType();
173 
174  private:
175 
176  void fromPvl(const PvlGroup &inStats);
177 
184  class XmlHandler : public XmlStackedHandler {
185  public:
186  XmlHandler(Statistics *statistics, Project *project);
187  // TODO: does xml stuff need project???
188  ~XmlHandler();
189 
190  virtual bool startElement(const QString &namespaceURI, const QString &localName,
191  const QString &qName, const QXmlAttributes &atts);
192  virtual bool characters(const QString &ch);
193  virtual bool endElement(const QString &namespaceURI, const QString &localName,
194  const QString &qName);
195 
196  private:
197  Q_DISABLE_COPY(XmlHandler);
198 
199  Statistics *m_xmlHandlerStatistics;
200  Project *m_xmlHandlerProject;
201  // TODO: does xml stuff need project???
202  QString m_xmlHandlerCharacters;
203  };
204 
205 // QUuid *m_id; /**< A unique ID for this object (useful for others to reference
206 // this object when saving to disk).*/
207  double m_sum;
208  double m_sumsum;
210  double m_minimum;
211  double m_maximum;
212  double m_validMinimum;
213  double m_validMaximum;
214  BigInt m_totalPixels;
215  BigInt m_validPixels;
216  BigInt m_nullPixels;
217  BigInt m_lrsPixels;
218  BigInt m_lisPixels;
219  BigInt m_hrsPixels;
220  BigInt m_hisPixels;
221  BigInt m_underRangePixels;
222  BigInt m_overRangePixels;
223  bool m_removedData;
225  };
226 
227  // operators to read/write Statistics to/from binary data
228  QDataStream &operator<<(QDataStream &stream, const Statistics &statistics);
229  QDataStream &operator>>(QDataStream &stream, Statistics &statistics);
230 
231 } // end namespace isis
232 
233 #endif
234 
long long int BigInt
Definition: Constants.h:63
BigInt LisPixels() const
Returns the total number of low instrument saturation (LIS) pixels encountered.
Definition: Statistics.cpp:493
double ChebyshevMaximum(const double percent=99.5) const
This method returns a maximum such that X percent of the data will fall with K standard deviations of...
Definition: Statistics.cpp:589
void RemoveData(const double *data, const unsigned int count)
Remove an array of doubles from the accumulators and counters.
Definition: Statistics.cpp:223
The main project for cnetsuite.
Definition: Project.h:105
QDataStream & write(QDataStream &stream) const
Order saved must match the offsets in the static compoundH5DataType() method.
Definition: Statistics.cpp:865
BigInt NullPixels() const
Returns the total number of NULL pixels encountered.
Definition: Statistics.cpp:482
static H5::CompType compoundH5DataType()
H5 compound data type uses the offesets from the QDataStream returned by the write(QDataStream &amp;strea...
Definition: Statistics.cpp:952
const double ValidMinimum
The minimum valid double value for Isis pixels.
Definition: SpecialPixel.h:101
double Minimum() const
Returns the absolute minimum double found in all data passed through the AddData method.
Definition: Statistics.cpp:399
bool InRange(const double value)
Definition: Statistics.cpp:296
double BestMaximum(const double percent=99.5) const
This method returns the better of the absolute maximum or the Chebyshev maximum.
Definition: Statistics.cpp:638
double Rms() const
Computes and returns the rms.
Definition: Statistics.cpp:382
BigInt HisPixels() const
Returns the total number of high instrument saturation (HIS) pixels encountered.
Definition: Statistics.cpp:515
PvlGroup toPvl(QString name="Statistics") const
Serialize statistics as a pvl group.
Definition: Statistics.cpp:704
bool AboveRange(const double value)
Definition: Statistics.cpp:301
double Variance() const
Computes and returns the variance.
Definition: Statistics.cpp:345
double ValidMaximum() const
Definition: Statistics.cpp:291
double StandardDeviation() const
Computes and returns the standard deviation.
Definition: Statistics.cpp:329
double Sum() const
Returns the sum of all the data.
Definition: Statistics.cpp:358
QDataStream & read(QDataStream &stream)
Definition: Statistics.cpp:888
double ZScore(const double value) const
This method returns the better of the z-score of the given value.
Definition: Statistics.cpp:658
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:109
double ValidMinimum() const
Definition: Statistics.cpp:286
Statistics & operator=(const Statistics &other)
Definition: Statistics.cpp:100
BigInt HrsPixels() const
Returns the total number of high representation saturation (HRS) pixels encountered.
Definition: Statistics.cpp:526
BigInt TotalPixels() const
Returns the total number of pixels processed (valid and invalid).
Definition: Statistics.cpp:437
BigInt ValidPixels() const
Returns the total number of valid pixels processed.
Definition: Statistics.cpp:450
void save(QXmlStreamWriter &stream, const Project *project) const
Definition: Statistics.cpp:735
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
double Average() const
Computes and returns the average.
Definition: Statistics.cpp:317
void Reset()
Reset all accumulators and counters to zero.
Definition: Statistics.cpp:130
BigInt LrsPixels() const
Returns the total number of low representation saturation (LRS) pixels encountered.
Definition: Statistics.cpp:504
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
Definition: CSVReader.cpp:463
void SetValidRange(const double minimum=Isis::ValidMinimum, const double maximum=Isis::ValidMaximum)
Definition: Statistics.cpp:272
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:47
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
Definition: Statistics.cpp:420
BigInt OutOfRangePixels() const
Returns the total number of pixels outside of the valid range encountered.
Definition: Statistics.cpp:537
Statistics(QObject *parent=0)
Constructs an IsisStats object with accumulators and counters set to zero.
Definition: Statistics.cpp:45
BigInt UnderRangePixels() const
Returns the total number of pixels under the valid range encountered.
Definition: Statistics.cpp:472
double SumSquare() const
Returns the sum of all the squared data.
Definition: Statistics.cpp:368
const double ValidMaximum
The maximum valid double value for Isis pixels.
Definition: SpecialPixel.h:136
double ChebyshevMinimum(const double percent=99.5) const
This method returns a minimum such that X percent of the data will fall with K standard deviations of...
Definition: Statistics.cpp:562
bool BelowRange(const double value)
Definition: Statistics.cpp:306
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:158
double BestMinimum(const double percent=99.5) const
This method returns the better of the absolute minimum or the Chebyshev minimum.
Definition: Statistics.cpp:615
his enables stack-based XML parsing of XML files.
Definition: XmlStackedHandlerReader.h:26
bool RemovedData() const
Definition: Statistics.cpp:542
virtual ~Statistics()
Destroys the IsisStats object.
Definition: Statistics.cpp:94
BigInt OverRangePixels() const
Returns the total number of pixels over the valid range encountered.
Definition: Statistics.cpp:461

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:29:30