GLIMSView Source Code Documentation

Histogram Class Reference
[Interactive Image Histogram]

#include <histogram.h>

List of all members.


Detailed Description

The Histogram class is designed to provide an efficient data type independent routine for calculating the histogram of an array and allow easy access to it with the use of class Hash, which is a basic val cnt mapping.

History:
2002-10-09 Dan Mingus - created/modified

Definition at line 68 of file histogram.h.


Public Member Functions

 Histogram ()
template<class DType>
void calcHist (DType *data, int len)
 This function calculates the histogram for the given dataset.
vector< HashgetHist ()
 Get the histogram that was calculated with calcHist.
double getMin ()
 Get the minimum value of the calculated dataset.
double getMax ()
 Get the maximum value of the calculated dataset.
int getLen ()
 Get the length of the calculated dataset.
int getMaxCnt ()
 Get the maximum count in the histogram.

Private Member Functions

void insert (double val)
 Add a new value to the histogram.
Hashfind (double val)
 Find a Hash with "val" value.
HashfindGt (double val)
 Find the first Hash with mVal greater than val.

Private Attributes

int mLen
int mMaxCnt
double mMin
double mMax
vector< HashmHist

Constructor & Destructor Documentation

Histogram::Histogram (  )  [inline]

Definition at line 179 of file histogram.h.

References mLen, mMax, mMaxCnt, and mMin.


Member Function Documentation

void Histogram::insert ( double  val  )  [inline, private]

Add a new value to the histogram.

find( double val ) would be called first to make sure the value is not allready present.

Definition at line 82 of file histogram.h.

References findGt(), and mHist.

Referenced by calcHist().

Here is the call graph for this function:

Hash* Histogram::find ( double  val  )  [inline, private]

Find a Hash with "val" value.

Non-linear search.

Definition at line 90 of file histogram.h.

References mHist.

Referenced by calcHist().

Hash* Histogram::findGt ( double  val  )  [inline, private]

Find the first Hash with mVal greater than val.

Non-linear search.

Definition at line 135 of file histogram.h.

References mHist.

Referenced by insert().

template<class DType>
void Histogram::calcHist ( DType *  data,
int  len 
) [inline]

This function calculates the histogram for the given dataset.

The dataset should be a numeric array. This will loop through every value in the dataset and store it's count in a Hash. When the routine ends, the member hash will be an array of value count mappings, or the histogram of this dataset.

Definition at line 194 of file histogram.h.

References find(), Hash::incCnt(), insert(), mHist, mLen, mMax, mMaxCnt, and mMin.

Referenced by HistogramSet::setData().

Here is the call graph for this function:

vector<Hash> Histogram::getHist (  )  [inline]

Get the histogram that was calculated with calcHist.

Definition at line 229 of file histogram.h.

References mHist.

Referenced by HistogramDlg::createDataPnts().

double Histogram::getMin (  )  [inline]

Get the minimum value of the calculated dataset.

Definition at line 237 of file histogram.h.

References mMin.

Referenced by HistogramDlg::alertUser(), HistogramDlg::createDataPnts(), and HistogramDlg::paintEvent().

double Histogram::getMax (  )  [inline]

Get the maximum value of the calculated dataset.

Definition at line 245 of file histogram.h.

References mMax.

Referenced by HistogramDlg::alertUser(), HistogramDlg::createDataPnts(), and HistogramDlg::paintEvent().

int Histogram::getLen (  )  [inline]

Get the length of the calculated dataset.

Deprecated:
This function may be useless.

Definition at line 255 of file histogram.h.

References mLen.

int Histogram::getMaxCnt (  )  [inline]

Get the maximum count in the histogram.

Definition at line 263 of file histogram.h.

References mMaxCnt.

Referenced by HistogramDlg::createDataPnts().


Member Data Documentation

int Histogram::mLen [private]

Definition at line 70 of file histogram.h.

Referenced by calcHist(), getLen(), and Histogram().

int Histogram::mMaxCnt [private]

Definition at line 71 of file histogram.h.

Referenced by calcHist(), getMaxCnt(), and Histogram().

double Histogram::mMin [private]

Definition at line 72 of file histogram.h.

Referenced by calcHist(), getMin(), and Histogram().

double Histogram::mMax [private]

Definition at line 73 of file histogram.h.

Referenced by calcHist(), getMax(), and Histogram().

vector<Hash> Histogram::mHist [private]

Definition at line 75 of file histogram.h.

Referenced by calcHist(), find(), findGt(), getHist(), and insert().


The documentation for this class was generated from the following file:

Home | Search | Disclaimers & Privacy | Contact Us
GLIMSView Maintainer: dsoltesz@usgs.gov