USGS

Isis 3.0 Object Programmers' Reference

Home

Histogram.h

Go to the documentation of this file.
00001 
00023 #ifndef Histogram_h
00024 #define Histogram_h
00025 
00026 #include "Cube.h"
00027 #include "Constants.h"
00028 #include "IException.h"
00029 #include "Progress.h"
00030 #include "SpecialPixel.h"
00031 #include "Statistics.h"
00032 
00033 namespace Isis {
00034   class ControlNet;
00035   class ControlMeasure;
00072   class Histogram : public Statistics {
00073     public:
00074       Histogram(double minimum, double maximum,
00075                 int bins = 1024);
00076       Histogram(Cube &cube, int statsBand, Progress *progress = NULL,
00077                 double startSample = 1.0, double startLine = 1.0,
00078                 double endSample = Null, double endLine = Null, int bins = 0,
00079                 bool addCubeData = false);
00080 
00081       //constuctors that use ControlNetworks to build histograms of ControlMeasure data 
00082       Histogram(ControlNet &net, double(ControlMeasure::*statFunc)() const, int bins);
00083       Histogram(ControlNet &net, double(ControlMeasure::*statFunc)() const, double binWidth);
00084 
00085       ~Histogram();
00086 
00087       void SetBins(const int bins);
00088 
00089       void Reset();
00090       void AddData(const double *data, const unsigned int count);
00091       void AddData(const double data);
00092       void RemoveData(const double *data, const unsigned int count);
00093 
00094       double Median() const;
00095       double Mode() const;
00096       double Percent(const double percent) const;
00097       double Skew() const;
00098 
00099       BigInt BinCount(const int index) const;
00100       void BinRange(const int index, double &low, double &high) const;
00101       double BinMiddle(const int index) const;
00102       double BinSize() const;
00103       int Bins() const;
00104       BigInt MaxBinCount() const;
00105 
00106       double BinRangeStart() const {
00107         return p_binRangeStart;
00108       }
00109       double BinRangeEnd() const {
00110         return p_binRangeEnd;
00111       }
00112       void SetBinRange(double binStart, double binEnd);
00113 
00114     private:
00115       void InitializeFromCube(Cube &cube, int statsBand, Progress *progress,
00116           int nbins = 0, double startSample = Null, double startLine = Null,
00117           double endSample = Null, double endLine = Null);
00118 
00119       void addMeasureDataFromNet(ControlNet &net, double(ControlMeasure::*statFunc)() const);
00120       void rangesFromNet(ControlNet &net, double(ControlMeasure::*statFunc)() const);
00121 
00123       std::vector<BigInt> p_bins;
00124       double p_binRangeStart, p_binRangeEnd;
00125   };
00126 };
00127 
00128 #endif