Isis 3 Programmer Reference
Statistics.h
1#ifndef Statistics_h
2#define Statistics_h
8/* SPDX-License-Identifier: CC0-1.0 */
9
10#include <QObject>
11#include <QString>
12
13#include "Constants.h"
14#include "PvlGroup.h"
15#include "SpecialPixel.h"
16
17class QDataStream;
18class QUuid;
19class QXmlStreamWriter;
20class QXmlStreamReader;
21
22namespace Isis {
23 class Project;// ??? does xml stuff need project???
93 class Statistics : public QObject {
94 Q_OBJECT
95 public:
96 Statistics(QObject *parent = 0);
97 Statistics(QXmlStreamReader *xmlReader, QObject *parent = 0);
98 void readStatistics(QXmlStreamReader *xmlReader);
99 Statistics(const PvlGroup &inStats, QObject *parent = 0);
100 // TODO: does xml read/write stuff need Project input???
101 Statistics(const Statistics &other);
102 virtual ~Statistics();
103 Statistics &operator=(const Statistics &other);
104
105 void Reset();
106
107 void AddData(const double *data, const unsigned int count);
108 void AddData(const double data);
109
110 void RemoveData(const double *data, const unsigned int count);
111 void RemoveData(const double data);
112
113 void SetValidRange(const double minimum = Isis::ValidMinimum,
114 const double maximum = Isis::ValidMaximum);
115
116 double ValidMinimum() const;
117 double ValidMaximum() const;
118 bool InRange(const double value);
119 bool AboveRange(const double value);
120 bool BelowRange(const double value);
121
122 double Average() const;
123 double StandardDeviation() const;
124 double Variance() const;
125 double Sum() const;
126 double SumSquare() const;
127 double Rms() const;
128
129 double Minimum() const;
130 double Maximum() const;
131 double ChebyshevMinimum(const double percent = 99.5) const;
132 double ChebyshevMaximum(const double percent = 99.5) const;
133 double BestMinimum(const double percent = 99.5) const;
134 double BestMaximum(const double percent = 99.5) const;
135 double ZScore(const double value) const;
136
137 BigInt TotalPixels() const;
138 BigInt ValidPixels() const;
139 BigInt OverRangePixels() const;
140 BigInt UnderRangePixels() const;
141 BigInt NullPixels() const;
142 BigInt LisPixels() const;
143 BigInt LrsPixels() const;
144 BigInt HisPixels() const;
145 BigInt HrsPixels() const;
146 BigInt OutOfRangePixels() const;
147 bool RemovedData() const;
148
149 PvlGroup toPvl(QString name = "Statistics") const;
150
151 void save(QXmlStreamWriter &stream, const Project *project) const;
152 // TODO: does xml stuff need project???
153
154 QDataStream &write(QDataStream &stream) const;
155 QDataStream &read(QDataStream &stream);
156
157 private:
158
159 void fromPvl(const PvlGroup &inStats);
160
161// QUuid *m_id; /**< A unique ID for this object (useful for others to reference
162// this object when saving to disk).*/
163 double m_sum;
164 double m_sumsum;
166 double m_minimum;
167 double m_maximum;
181 };
182
183 // operators to read/write Statistics to/from binary data
184 QDataStream &operator<<(QDataStream &stream, const Statistics &statistics);
185 QDataStream &operator>>(QDataStream &stream, Statistics &statistics);
186
187} // end namespace isis
188
189#endif
The main project for ipce.
Definition Project.h:287
Contains multiple PvlContainers.
Definition PvlGroup.h:41
This class is used to accumulate statistics on double arrays.
Definition Statistics.h:93
BigInt m_hisPixels
Count of high instrument representation pixels processed.
Definition Statistics.h:176
BigInt NullPixels() const
Returns the total number of NULL pixels encountered.
double m_sum
The sum accumulator, i.e. the sum of added data values.
Definition Statistics.h:163
BigInt OverRangePixels() const
Returns the total number of pixels over the valid range encountered.
bool m_removedData
Indicates the RemoveData method was called which implies m_minimum and m_maximum are invalid.
Definition Statistics.h:179
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...
BigInt m_validPixels
Count of valid pixels (non-special) processed.
Definition Statistics.h:171
double Sum() const
Returns the sum of all the data.
BigInt UnderRangePixels() const
Returns the total number of pixels under the valid range encountered.
double Average() const
Computes and returns the average.
BigInt LisPixels() const
Returns the total number of low instrument saturation (LIS) pixels encountered.
virtual ~Statistics()
Destroys the IsisStats object.
double Minimum() const
Returns the absolute minimum double found in all data passed through the AddData method.
BigInt HrsPixels() const
Returns the total number of high representation saturation (HRS) pixels encountered.
BigInt HisPixels() const
Returns the total number of high instrument saturation (HIS) pixels encountered.
double m_validMinimum
Minimum valid pixel value.
Definition Statistics.h:168
double BestMinimum(const double percent=99.5) const
This method returns the better of the absolute minimum or the Chebyshev minimum.
BigInt m_lisPixels
Count of low representation saturation pixels processed.
Definition Statistics.h:174
BigInt OutOfRangePixels() const
Returns the total number of pixels outside of the valid range encountered.
BigInt m_nullPixels
Count of null pixels processed.
Definition Statistics.h:172
BigInt ValidPixels() const
Returns the total number of valid pixels processed.
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...
double ZScore(const double value) const
This method returns the better of the z-score of the given value.
BigInt m_totalPixels
Count of total pixels processed.
Definition Statistics.h:170
BigInt m_lrsPixels
Count of low instrument saturation pixels processed.
Definition Statistics.h:173
double SumSquare() const
Returns the sum of all the squared data.
BigInt TotalPixels() const
Returns the total number of pixels processed (valid and invalid).
QDataStream & write(QDataStream &stream) const
Order saved must match the offsets in the static compoundH5DataType() method.
PvlGroup toPvl(QString name="Statistics") const
Serialize statistics as a pvl group.
double m_minimum
Minimum double value encountered.
Definition Statistics.h:166
double m_maximum
Maximum double value encountered.
Definition Statistics.h:167
double m_validMaximum
Maximum valid pixel value.
Definition Statistics.h:169
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
double Rms() const
Computes and returns the rms.
double BestMaximum(const double percent=99.5) const
This method returns the better of the absolute maximum or the Chebyshev maximum.
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
BigInt LrsPixels() const
Returns the total number of low representation saturation (LRS) pixels encountered.
void fromPvl(const PvlGroup &inStats)
Unserializes a Statistics object from a pvl group.
void RemoveData(const double *data, const unsigned int count)
Remove an array of doubles from the accumulators and counters.
double StandardDeviation() const
Computes and returns the standard deviation.
double Variance() const
Computes and returns the variance.
BigInt m_underRangePixels
Count of pixels less than the valid range.
Definition Statistics.h:177
BigInt m_hrsPixels
Count of high instrument saturation pixels processed.
Definition Statistics.h:175
BigInt m_overRangePixels
Count of pixels greater than the valid range.
Definition Statistics.h:178
Statistics(QObject *parent=0)
Constructs an IsisStats object with accumulators and counters set to zero.
void Reset()
Reset all accumulators and counters to zero.
double m_sumsum
The sum-squared accumulator, i.e.
Definition Statistics.h:164
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
const double ValidMaximum
The maximum valid double value for Isis pixels.
long long int BigInt
Big int.
Definition Constants.h:49
const double ValidMinimum
The minimum valid double value for Isis pixels.
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.