Isis 3 Programmer Reference
Statistics.cpp
Go to the documentation of this file.
1 
20 #include "Statistics.h"
21 
22 #include <QDataStream>
23 #include <QDebug>
24 #include <QString>
25 #include <QUuid>
26 #include <QXmlStreamWriter>
27 
28 #include <float.h>
29 
30 #include "IException.h"
31 #include "IString.h"
32 #include "Project.h"
33 #include "PvlGroup.h"
34 #include "PvlKeyword.h"
35 #include "XmlStackedHandlerReader.h"
36 
37 using namespace std;
38 
39 namespace Isis {
41  Statistics::Statistics(QObject *parent) : QObject(parent) {
42 // m_id = NULL;
43 // m_id = new QUuid(QUuid::createUuid());
44  SetValidRange();
45  Reset(); // initialize
46  }
47 
48 
49  Statistics::Statistics(Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent) { // TODO: does xml stuff need project???
50 // m_id = NULL;
51  SetValidRange();
52  Reset(); // initialize
53  xmlReader->pushContentHandler(new XmlHandler(this, project)); // TODO: does xml stuff need project???
54  }
55 
61  Statistics::Statistics(const PvlGroup &inStats, QObject *parent) {
62  SetValidRange();
63  Reset();
64  fromPvl(inStats);
65  }
66 
67 
69  : m_sum(other.m_sum),
70  m_sumsum(other.m_sumsum),
71  m_minimum(other.m_minimum),
72  m_maximum(other.m_maximum),
73  m_validMinimum(other.m_validMinimum),
74  m_validMaximum(other.m_validMaximum),
75  m_totalPixels(other.m_totalPixels),
76  m_validPixels(other.m_validPixels),
77  m_nullPixels(other.m_nullPixels),
78  m_lrsPixels(other.m_lrsPixels),
79  m_lisPixels(other.m_lisPixels),
80  m_hrsPixels(other.m_hrsPixels),
81  m_hisPixels(other.m_hisPixels),
82  m_underRangePixels(other.m_underRangePixels),
83  m_overRangePixels(other.m_overRangePixels),
84  m_removedData(other.m_removedData) {
85  }
86  // : m_id(new QUuid(other.m_id->toString())),
87 
88 
91 // delete m_id;
92 // m_id = NULL;
93  }
94 
95 
96  Statistics &Statistics::operator=(const Statistics &other) {
97 
98  if (&other != this) {
99 // delete m_id;
100 // m_id = NULL;
101 // m_id = new QUuid(other.m_id->toString());
102 
103  m_sum = other.m_sum;
104  m_sumsum = other.m_sumsum;
105  m_minimum = other.m_minimum;
106  m_maximum = other.m_maximum;
111  m_nullPixels = other.m_nullPixels;
112  m_lrsPixels = other.m_lrsPixels;
113  m_lisPixels = other.m_lisPixels;
114  m_hrsPixels = other.m_hrsPixels;
115  m_hisPixels = other.m_hisPixels;
119  }
120  return *this;
121 
122  }
123 
124 
127  m_sum = 0.0;
128  m_sumsum = 0.0;
129  m_minimum = DBL_MAX;
130  m_maximum = -DBL_MAX;
131  m_totalPixels = 0;
132  m_validPixels = 00;
133  m_nullPixels = 0;
134  m_lisPixels = 0;
135  m_lrsPixels = 0;
136  m_hrsPixels = 0;
137  m_hisPixels = 0;
138  m_overRangePixels = 0;
139  m_underRangePixels = 0;
140  m_removedData = false;
141  }
142 
143 
154  void Statistics::AddData(const double *data, const unsigned int count) {
155  for(unsigned int i = 0; i < count; i++) {
156  double value = data[i];
157  AddData(value);
158  }
159  }
160 
161 
171  void Statistics::AddData(const double data) {
172  m_totalPixels++;
173 
174  if (Isis::IsNullPixel(data)) {
175  m_nullPixels++;
176  }
177  else if (Isis::IsHisPixel(data)) {
178  m_hisPixels++;
179  }
180  else if (Isis::IsHrsPixel(data)) {
181  m_hrsPixels++;
182  }
183  else if (Isis::IsLisPixel(data)) {
184  m_lisPixels++;
185  }
186  else if (Isis::IsLrsPixel(data)) {
187  m_lrsPixels++;
188  }
189  else if (AboveRange(data)) {
191  }
192  else if (BelowRange(data)) {
194  }
195  else { // if (Isis::IsValidPixel(data) && InRange(data)) {
196  m_sum += data;
197  m_sumsum += data * data;
198  if (data < m_minimum) m_minimum = data;
199  if (data > m_maximum) m_maximum = data;
200  m_validPixels++;
201  }
202 
203  }
204 
205 
219  void Statistics::RemoveData(const double *data, const unsigned int count) {
220 
221  for(unsigned int i = 0; i < count; i++) {
222  double value = data[i];
223  RemoveData(value);
224  }
225 
226  }
227 
228 
229  void Statistics::RemoveData(const double data) {
230  m_removedData = true;
231  m_totalPixels--;
232 
233  if (Isis::IsNullPixel(data)) {
234  m_nullPixels--;
235  }
236  else if (Isis::IsHisPixel(data)) {
237  m_hisPixels--;
238  }
239  else if (Isis::IsHrsPixel(data)) {
240  m_hrsPixels--;
241  }
242  else if (Isis::IsLisPixel(data)) {
243  m_lisPixels--;
244  }
245  else if (Isis::IsLrsPixel(data)) {
246  m_lrsPixels--;
247  }
248  else if (AboveRange(data)) {
250  }
251  else if (BelowRange(data)) {
253  }
254  else { // if (IsValidPixel(data) && InRange(data)) {
255  m_sum -= data;
256  m_sumsum -= data * data;
257  m_validPixels--;
258  }
259 
260  if (m_totalPixels < 0) {
261  QString msg = "You are removing non-existant data in [Statistics::RemoveData]";
262  throw IException(IException::Programmer, msg, _FILEINFO_);
263  }
264  // what happens to saved off min/max???
265  }
266 
267 
268  void Statistics::SetValidRange(const double minimum, const double maximum) {
269  m_validMinimum = minimum;
270  m_validMaximum = maximum;
271 
273  // get the min and max DN values in the chosen range
274  QString msg = "Invalid Range: Minimum [" + toString(minimum)
275  + "] must be less than the Maximum [" + toString(maximum) + "].";
276  throw IException(IException::Programmer, msg, _FILEINFO_);
277  }
278  //??? throw exception if data has already been added???
279  }
280 
281 
282  double Statistics::ValidMinimum() const {
283  return m_validMinimum;
284  }
285 
286 
287  double Statistics::ValidMaximum() const {
288  return m_validMaximum;
289  }
290 
291 
292  bool Statistics::InRange(const double value) {
293  return (!BelowRange(value) && !AboveRange(value));
294  }
295 
296 
297  bool Statistics::AboveRange(const double value) {
298  return (value > m_validMaximum);
299  }
300 
301 
302  bool Statistics::BelowRange(const double value) {
303  return (value < m_validMinimum);
304  }
305 
306 
313  double Statistics::Average() const {
314  if (m_validPixels < 1) return Isis::NULL8;
315  return m_sum / m_validPixels;
316  }
317 
318 
326  if (m_validPixels <= 1) return Isis::NULL8;
327  return sqrt(Variance());
328  }
329 
330 
341  double Statistics::Variance() const {
342  if (m_validPixels <= 1) return Isis::NULL8;
343  double temp = m_validPixels * m_sumsum - m_sum * m_sum;
344  if (temp < 0.0) temp = 0.0; // This should happen unless roundoff occurs
345  return temp / ((m_validPixels - 1.0) * m_validPixels);
346  }
347 
348 
354  double Statistics::Sum() const {
355  return m_sum;
356  }
357 
358 
364  double Statistics::SumSquare() const {
365  return m_sumsum;
366  }
367 
368 
378  double Statistics::Rms() const {
379  if (m_validPixels < 1) return Isis::NULL8;
380  double temp = m_sumsum / m_validPixels;
381  if (temp < 0.0) temp = 0.0;
382  return sqrt(temp);
383  }
384 
385 
395  double Statistics::Minimum() const {
396  if (m_removedData) {
397  QString msg = "Minimum is invalid since you removed data";
399  }
400 
401  if (m_validPixels < 1) return Isis::NULL8;
402  return m_minimum;
403  }
404 
405 
416  double Statistics::Maximum() const {
417  if (m_removedData) {
418  QString msg = "Maximum is invalid since you removed data";
420  }
421 
422  if (m_validPixels < 1) return Isis::NULL8;
423  return m_maximum;
424  }
425 
426 
434  return m_totalPixels;
435  }
436 
437 
447  return m_validPixels;
448  }
449 
450 
458  return m_overRangePixels;
459  }
460 
461 
469  return m_underRangePixels;
470  }
471 
472 
479  return m_nullPixels;
480  }
481 
482 
490  return m_lisPixels;
491  }
492 
493 
501  return m_lrsPixels;
502  }
503 
504 
512  return m_hisPixels;
513  }
514 
515 
523  return m_hrsPixels;
524  }
525 
526 
535  }
536 
537 
538  bool Statistics::RemovedData() const {
539  return m_removedData;
540  }
541 
542 
558  double Statistics::ChebyshevMinimum(const double percent) const {
559  if ((percent <= 0.0) || (percent >= 100.0)) {
560  QString msg = "Invalid value for percent";
562  }
563 
564  if (m_validPixels < 1) return Isis::NULL8;
565  double k = sqrt(1.0 / (1.0 - percent / 100.0));
566  return Average() - k * StandardDeviation();
567  }
568 
569 
585  double Statistics::ChebyshevMaximum(const double percent) const {
586  if ((percent <= 0.0) || (percent >= 100.0)) {
587  QString msg = "Invalid value for percent";
589  }
590 
591  if (m_validPixels < 1) return Isis::NULL8;
592  double k = sqrt(1.0 / (1.0 - percent / 100.0));
593  return Average() + k * StandardDeviation();
594  }
595 
596 
611  double Statistics::BestMinimum(const double percent) const {
612  if (m_validPixels < 1) return Isis::NULL8;
613  double min = ChebyshevMinimum(percent);
614  if (Minimum() > min) min = Minimum();
615  return min;
616  }
617 
618 
634  double Statistics::BestMaximum(const double percent) const {
635  if (m_validPixels < 1) return Isis::NULL8;
636  double max = ChebyshevMaximum(percent);
637  if (Maximum() < max) max = Maximum();
638  return max;
639  }
640 
641 
654  double Statistics::ZScore(const double value) const {
655  if (StandardDeviation() == 0) {
656  if (value == Maximum()) return 0;
657  else {
658  QString msg = "Undefined Z-score. Standard deviation is zero and the input value["
659  + toString(value) + "] is out of range [" + toString(Maximum()) + "].";
661  }
662  }
663  return (value - Average()) / StandardDeviation();
664  }
665 
666 
672  void Statistics::fromPvl(const PvlGroup &inStats) {
673  Reset();
674  m_sum = inStats["Sum"];
675  m_sumsum = inStats["SumSquare"];
676  m_minimum = inStats["Minimum"];
677  m_maximum = inStats["Maximum"];
678  m_validMinimum = inStats["ValidMinimum"];
679  m_validMaximum = inStats["ValidMaximum"];
680  m_totalPixels = inStats["TotalPixels"];
681  m_validPixels = inStats["ValidPixels"];
682  m_nullPixels = inStats["NullPixels"];
683  m_lrsPixels = inStats["LrsPixels"];
684  m_lisPixels = inStats["LisPixels"];
685  m_hrsPixels = inStats["HrsPixels"];
686  m_hisPixels = inStats["HisPixels"];
687  m_underRangePixels = inStats["UnderValidMinimumPixels"];
688  m_overRangePixels = inStats["OverValidMaximumPixels"];
689  m_removedData = false; //< Is this the correct state?
690  }
691 
692 
700  PvlGroup Statistics::toPvl(QString name) const {
701  if (name.isEmpty()) {
702  name = "Statistics";
703  }
704  // Construct a label with the results
705  PvlGroup results(name);
706  results += PvlKeyword("Sum", toString(Sum()));
707  results += PvlKeyword("SumSquare", toString(SumSquare()));
708  results += PvlKeyword("Minimum", toString(Minimum()));
709  results += PvlKeyword("Maximum", toString(Maximum()));
710  results += PvlKeyword("ValidMinimum", toString(ValidMinimum()));
711  results += PvlKeyword("ValidMaximum", toString(ValidMaximum()));
712  if (ValidPixels() != 0) {
713  results += PvlKeyword("Average", toString(Average()));
714  results += PvlKeyword("StandardDeviation", toString(StandardDeviation()));
715  results += PvlKeyword("Variance", toString(Variance()));
716  }
717  results += PvlKeyword("TotalPixels", toString(TotalPixels()));
718  results += PvlKeyword("ValidPixels", toString(ValidPixels()));
719  results += PvlKeyword("OverValidMaximumPixels", toString(OverRangePixels()));
720  results += PvlKeyword("UnderValidMinimumPixels", toString(UnderRangePixels()));
721  results += PvlKeyword("NullPixels", toString(NullPixels()));
722  results += PvlKeyword("LisPixels", toString(LisPixels()));
723  results += PvlKeyword("LrsPixels", toString(LrsPixels()));
724  results += PvlKeyword("HisPixels", toString(HisPixels()));
725  results += PvlKeyword("HrsPixels", toString(HrsPixels()));
726 
727  return results;
728  }
729 
730 
731  void Statistics::save(QXmlStreamWriter &stream, const Project *project) const { // TODO: does xml stuff need project???
732 
733  stream.writeStartElement("statistics");
734 // stream.writeTextElement("id", m_id->toString());
735 
736  stream.writeTextElement("sum", toString(m_sum));
737  stream.writeTextElement("sumSquares", toString(m_sumsum));
738 
739  stream.writeStartElement("range");
740  stream.writeTextElement("minimum", toString(m_minimum));
741  stream.writeTextElement("maximum", toString(m_maximum));
742  stream.writeTextElement("validMinimum", toString(m_validMinimum));
743  stream.writeTextElement("validMaximum", toString(m_validMaximum));
744  stream.writeEndElement(); // end range
745 
746  stream.writeStartElement("pixelCounts");
747  stream.writeTextElement("totalPixels", toString(m_totalPixels));
748  stream.writeTextElement("validPixels", toString(m_validPixels));
749  stream.writeTextElement("nullPixels", toString(m_nullPixels));
750  stream.writeTextElement("lisPixels", toString(m_lisPixels));
751  stream.writeTextElement("lrsPixels", toString(m_lrsPixels));
752  stream.writeTextElement("hisPixels", toString(m_hisPixels));
753  stream.writeTextElement("hrsPixels", toString(m_hrsPixels));
754  stream.writeTextElement("underRangePixels", toString(m_underRangePixels));
755  stream.writeTextElement("overRangePixels", toString(m_overRangePixels));
756  stream.writeEndElement(); // end pixelCounts
757 
758  stream.writeTextElement("removedData", toString(m_removedData));
759  stream.writeEndElement(); // end statistics
760 
761  }
762 
763 
764  Statistics::XmlHandler::XmlHandler(Statistics *statistics, Project *project) { // TODO: does xml stuff need project???
765  m_xmlHandlerStatistics = statistics;
766  m_xmlHandlerProject = project; // TODO: does xml stuff need project???
767  m_xmlHandlerCharacters = "";
768  }
769 
770 
771  Statistics::XmlHandler::~XmlHandler() {
772  // do not delete this pointer... we don't own it, do we??? passed into StatCumProbDistDynCalc constructor as pointer
773  // delete m_xmlHandlerProject; // TODO: does xml stuff need project???
774  m_xmlHandlerProject = NULL;
775  }
776 
777 
778  bool Statistics::XmlHandler::startElement(const QString &namespaceURI,
779  const QString &localName,
780  const QString &qName,
781  const QXmlAttributes &atts) {
782  m_xmlHandlerCharacters = "";
783  if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
784  // no element attibutes to evaluate
785  }
786  return true;
787  }
788 
789 
790  bool Statistics::XmlHandler::characters(const QString &ch) {
791  m_xmlHandlerCharacters += ch;
792  return XmlStackedHandler::characters(ch);
793  }
794 
795 
796  bool Statistics::XmlHandler::endElement(const QString &namespaceURI, const QString &localName,
797  const QString &qName) {
798  if (!m_xmlHandlerCharacters.isEmpty()) {
799  if (localName == "id") {
800 // m_xmlHandlerStatistics->m_id = NULL;
801 // m_xmlHandlerStatistics->m_id = new QUuid(m_xmlHandlerCharacters);
802  }
803  if (localName == "sum") {
804  m_xmlHandlerStatistics->m_sum = toDouble(m_xmlHandlerCharacters);
805  }
806  if (localName == "sumSquares") {
807  m_xmlHandlerStatistics->m_sumsum = toDouble(m_xmlHandlerCharacters);
808  }
809  if (localName == "minimum") {
810  m_xmlHandlerStatistics->m_minimum = toDouble(m_xmlHandlerCharacters);
811  }
812  if (localName == "maximum") {
813  m_xmlHandlerStatistics->m_maximum = toDouble(m_xmlHandlerCharacters);
814  }
815  if (localName == "validMinimum") {
816  m_xmlHandlerStatistics->m_validMinimum = toDouble(m_xmlHandlerCharacters);
817  }
818  if (localName == "validMaximum") {
819  m_xmlHandlerStatistics->m_validMaximum = toDouble(m_xmlHandlerCharacters);
820  }
821  if (localName == "totalPixels") {
822  m_xmlHandlerStatistics->m_totalPixels = toBigInt(m_xmlHandlerCharacters);
823  }
824  if (localName == "validPixels") {
825  m_xmlHandlerStatistics->m_validPixels = toBigInt(m_xmlHandlerCharacters);
826  }
827  if (localName == "nullPixels") {
828  m_xmlHandlerStatistics->m_nullPixels = toBigInt(m_xmlHandlerCharacters);
829  }
830  if (localName == "lisPixels") {
831  m_xmlHandlerStatistics->m_lisPixels = toBigInt(m_xmlHandlerCharacters);
832  }
833  if (localName == "lrsPixels") {
834  m_xmlHandlerStatistics->m_lrsPixels = toBigInt(m_xmlHandlerCharacters);
835  }
836  if (localName == "hisPixels") {
837  m_xmlHandlerStatistics->m_hisPixels = toBigInt(m_xmlHandlerCharacters);
838  }
839  if (localName == "hrsPixels") {
840  m_xmlHandlerStatistics->m_hrsPixels = toBigInt(m_xmlHandlerCharacters);
841  }
842  if (localName == "underRangePixels") {
843  m_xmlHandlerStatistics->m_underRangePixels = toBigInt(m_xmlHandlerCharacters);
844  }
845  if (localName == "overRangePixels") {
846  m_xmlHandlerStatistics->m_overRangePixels = toBigInt(m_xmlHandlerCharacters);
847  }
848  if (localName == "removedData") {
849  m_xmlHandlerStatistics->m_removedData = toBool(m_xmlHandlerCharacters);
850  }
851  m_xmlHandlerCharacters = "";
852  }
853  return XmlStackedHandler::endElement(namespaceURI, localName, qName);
854  }
855 
856 
861  QDataStream &Statistics::write(QDataStream &stream) const {
862  stream.setByteOrder(QDataStream::LittleEndian);
863  stream << m_sum
864  << m_sumsum
865  << m_minimum
866  << m_maximum
867  << m_validMinimum
868  << m_validMaximum
869  << (qint64)m_totalPixels
870  << (qint64)m_validPixels
871  << (qint64)m_nullPixels
872  << (qint64)m_lrsPixels
873  << (qint64)m_lisPixels
874  << (qint64)m_hrsPixels
875  << (qint64)m_hisPixels
876  << (qint64)m_underRangePixels
877  << (qint64)m_overRangePixels
878  << (qint32)m_removedData;
879  return stream;
880 // stream << m_id->toString()
881  }
882 
883 
884  QDataStream &Statistics::read(QDataStream &stream) {
885 
886 // QString id;
887  qint64 totalPixels, validPixels, nullPixels, lrsPixels, lisPixels,
888  hrsPixels, hisPixels, underRangePixels, overRangePixels;
889  qint32 removedData;
890 
891  stream.setByteOrder(QDataStream::LittleEndian);
892 // stream >> id
893  stream >> m_sum
894  >> m_sumsum
895  >> m_minimum
896  >> m_maximum
897  >> m_validMinimum
898  >> m_validMaximum
899  >> totalPixels
900  >> validPixels
901  >> nullPixels
902  >> lrsPixels
903  >> lisPixels
904  >> hrsPixels
905  >> hisPixels
906  >> underRangePixels
907  >> overRangePixels
908  >> removedData;
909 
910 // delete m_id;
911 // m_id = NULL;
912 // m_id = new QUuid(id);
913 
914  m_totalPixels = (BigInt)totalPixels;
915  m_validPixels = (BigInt)validPixels;
916  m_nullPixels = (BigInt)nullPixels;
917  m_lrsPixels = (BigInt)lrsPixels;
918  m_lisPixels = (BigInt)lisPixels;
919  m_hrsPixels = (BigInt)hrsPixels;
920  m_hisPixels = (BigInt)hisPixels;
921  m_underRangePixels = (BigInt)underRangePixels;
922  m_overRangePixels = (BigInt)overRangePixels;
923  m_removedData = (bool)removedData;
924 
925  return stream;
926  }
927 
928 
929  QDataStream &operator<<(QDataStream &stream, const Statistics &statistics) {
930  return statistics.write(stream);
931  }
932 
933 
934  QDataStream &operator>>(QDataStream &stream, Statistics &statistics) {
935  return statistics.read(stream);
936  }
937 
938 } // end namespace isis
long long int BigInt
Big int.
Definition: Constants.h:65
bool IsLisPixel(const double d)
Returns if the input pixel is low instrument saturation.
Definition: SpecialPixel.h:310
void RemoveData(const double *data, const unsigned int count)
Remove an array of doubles from the accumulators and counters.
Definition: Statistics.cpp:219
BigInt m_nullPixels
Count of null pixels processed.
Definition: Statistics.h:212
The main project for ipce.
Definition: Project.h:289
double Sum() const
Returns the sum of all the data.
Definition: Statistics.cpp:354
bool IsLrsPixel(const double d)
Returns if the input pixel is low representation saturation.
Definition: SpecialPixel.h:322
double StandardDeviation() const
Computes and returns the standard deviation.
Definition: Statistics.cpp:325
double Minimum() const
Returns the absolute minimum double found in all data passed through the AddData method.
Definition: Statistics.cpp:395
double SumSquare() const
Returns the sum of all the squared data.
Definition: Statistics.cpp:364
double BestMaximum(const double percent=99.5) const
This method returns the better of the absolute maximum or the Chebyshev maximum.
Definition: Statistics.cpp:634
BigInt m_lisPixels
Count of low representation saturation pixels processed.
Definition: Statistics.h:214
Namespace for the standard library.
BigInt HrsPixels() const
Returns the total number of high representation saturation (HRS) pixels encountered.
Definition: Statistics.cpp:522
void fromPvl(const PvlGroup &inStats)
Unserializes a Statistics object from a pvl group.
Definition: Statistics.cpp:672
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
BigInt ValidPixels() const
Returns the total number of valid pixels processed.
Definition: Statistics.cpp:446
BigInt toBigInt(const QString &string)
Global function to convert from a string to a "big" integer.
Definition: IString.cpp:130
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
bool IsHisPixel(const double d)
Returns if the input pixel is high instrument saturation.
Definition: SpecialPixel.h:298
BigInt HisPixels() const
Returns the total number of high instrument saturation (HIS) pixels encountered.
Definition: Statistics.cpp:511
bool IsHrsPixel(const double d)
Returns if the input pixel is high representation saturation.
Definition: SpecialPixel.h:286
BigInt NullPixels() const
Returns the total number of NULL pixels encountered.
Definition: Statistics.cpp:478
BigInt OverRangePixels() const
Returns the total number of pixels over the valid range encountered.
Definition: Statistics.cpp:457
double m_sum
The sum accumulator, i.e. the sum of added data values.
Definition: Statistics.h:203
BigInt TotalPixels() const
Returns the total number of pixels processed (valid and invalid).
Definition: Statistics.cpp:433
double Maximum() const
Returns the absolute maximum double found in all data passed through the AddData method.
Definition: Statistics.cpp:416
BigInt m_hrsPixels
Count of high instrument saturation pixels processed.
Definition: Statistics.h:215
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:107
QDataStream & write(QDataStream &stream) const
Order saved must match the offsets in the static compoundH5DataType() method.
Definition: Statistics.cpp:861
double BestMinimum(const double percent=99.5) const
This method returns the better of the absolute minimum or the Chebyshev minimum.
Definition: Statistics.cpp:611
BigInt OutOfRangePixels() const
Returns the total number of pixels outside of the valid range encountered.
Definition: Statistics.cpp:533
PvlGroup toPvl(QString name="Statistics") const
Serialize statistics as a pvl group.
Definition: Statistics.cpp:700
BigInt LisPixels() const
Returns the total number of low instrument saturation (LIS) pixels encountered.
Definition: Statistics.cpp:489
BigInt m_validPixels
Count of valid pixels (non-special) processed.
Definition: Statistics.h:211
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
void Reset()
Reset all accumulators and counters to zero.
Definition: Statistics.cpp:126
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
Definition: CSVReader.cpp:463
A single keyword-value pair.
Definition: PvlKeyword.h:98
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
double m_sumsum
The sum-squared accumulator, i.e.
Definition: Statistics.h:204
double Variance() const
Computes and returns the variance.
Definition: Statistics.cpp:341
double m_minimum
Minimum double value encountered.
Definition: Statistics.h:206
BigInt UnderRangePixels() const
Returns the total number of pixels under the valid range encountered.
Definition: Statistics.cpp:468
Statistics(QObject *parent=0)
Constructs an IsisStats object with accumulators and counters set to zero.
Definition: Statistics.cpp:41
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:585
double Rms() const
Computes and returns the rms.
Definition: Statistics.cpp:378
bool m_removedData
Indicates the RemoveData method was called which implies m_minimum and m_maximum are invalid...
Definition: Statistics.h:219
BigInt LrsPixels() const
Returns the total number of low representation saturation (LRS) pixels encountered.
Definition: Statistics.cpp:500
BigInt m_overRangePixels
Count of pixels greater than the valid range.
Definition: Statistics.h:218
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition: IString.cpp:53
double m_maximum
Maximum double value encountered.
Definition: Statistics.h:207
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:558
Isis exception class.
Definition: IException.h:107
BigInt m_totalPixels
Count of total pixels processed.
Definition: Statistics.h:210
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
bool IsNullPixel(const double d)
Returns if the input pixel is null.
Definition: SpecialPixel.h:250
double m_validMaximum
Maximum valid pixel value.
Definition: Statistics.h:209
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
double ZScore(const double value) const
This method returns the better of the z-score of the given value.
Definition: Statistics.cpp:654
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:154
BigInt m_hisPixels
Count of high instrument representation pixels processed.
Definition: Statistics.h:216
double m_validMinimum
Minimum valid pixel value.
Definition: Statistics.h:208
BigInt m_lrsPixels
Count of low instrument saturation pixels processed.
Definition: Statistics.h:213
double Average() const
Computes and returns the average.
Definition: Statistics.cpp:313
Manage a stack of content handlers for reading XML files.
virtual ~Statistics()
Destroys the IsisStats object.
Definition: Statistics.cpp:90
BigInt m_underRangePixels
Count of pixels less than the valid range.
Definition: Statistics.h:217