Isis Developer Reference
|
Container for boxcar statistics. More...
#include <QuickFilter.h>
Public Member Functions | |
QuickFilter (const int ns, const int width, const int height) | |
Constructs a QuickFilter object with accumulators and counters set to zero. | |
~QuickFilter () | |
Destroys the QuickFilter object. | |
double | Average (const int index) |
Computes and returns the boxcar average at pixel index (zero based). | |
double | Variance (const int index) |
Computes and returns the boxcar variance at pixel index (zero based). | |
int | Count (const int index) |
Computes and returns the number of valid pixels in the boxcar at pixel index (zero based). | |
int | Width () const |
Returns the width of the boxcar. | |
int | HalfWidth () const |
Returns the half the width of the boxcar rounded down because the boxcar size is odd. | |
int | Height () const |
Returns the height of the boxcar. | |
int | HalfHeight () const |
Returns the half the height of the boxcar rounded down because the boxcar size is odd. | |
int | Samples () const |
Returns the number of samples in a line. | |
double | Low () const |
Returns the lowest pixel value included in filtering computations. | |
double | High () const |
Returns the highest pixel value included in filtering computations. | |
int | MinimumPixels () const |
Returns the minimum number of pixels which need to be valid inside the boxcar. | |
void | AddLine (const double *buf) |
Add an array of doubles to the accumulators and counters. | |
void | RemoveLine (const double *buf) |
Remove an array of doubles from the accumulators and counters. | |
void | Reset () |
Reset all accumulators and counters to zero. | |
void | SetMinMax (const double minimum, const double maximum) |
This method is used to set the minimum/maximum valid values. | |
void | SetMinimumPixels (const int minimumValid) |
This method is used to set the minimum number of valid pixels in the boxcar. | |
Container for boxcar statistics.
This class is used to compute statisics for NxM boxcars, where N and M are positive odd integers. In general, this object will be loaded by another derived class such as FilterLoader or FilterProcess. The programmer can then use the methods in this class to compute statistics such as the boxcar average, variance, and number of valid pixels in the boxcar.
If you would like to see QuickFilter being used in implementation, see FilterLoader or FilterProcess
Isis::QuickFilter::QuickFilter | ( | const int | ns, |
const int | width, | ||
const int | height ) |
Constructs a QuickFilter object with accumulators and counters set to zero.
Because this is a line based filtering object, the number of samples and the boxcar size must be given to the constructor.
ns | Number of samples in the cube |
width | Width of the boxcar (must be odd) |
height | Height of the boxcar (must be odd) |
Isis::IException::Programmer |
References _FILEINFO_, Isis::IException::Programmer, and Reset().
Isis::QuickFilter::~QuickFilter | ( | ) |
Destroys the QuickFilter object.
void Isis::QuickFilter::AddLine | ( | const double * | buf | ) |
Add an array of doubles to the accumulators and counters.
This method must be invoked enough times to satisfy the height requirements of the boxcar. Note, however this is not strictly enforced. The method will check to make sure you have not added beyond the height of the boxcar. Therefore, you must remove a line before adding a new one.
buf | Array of doubles to add |
Isis::iException::Programmer |
References _FILEINFO_, Isis::IsValidPixel(), and Isis::IException::Programmer.
Referenced by Isis::ProcessByQuickFilter::StartProcess().
double Isis::QuickFilter::Average | ( | const int | index | ) |
Computes and returns the boxcar average at pixel index (zero based).
No error checks are done for out of array bounds conditions. If there are not enough valid pixels in the boxcar then Isis::NULL8 is returned. The routine works the fastest when sequentially accessing the averages (e.g., index = 0,1,2,...).
index | Zero based sample position |
References Isis::NULL8.
int Isis::QuickFilter::Count | ( | const int | index | ) |
Computes and returns the number of valid pixels in the boxcar at pixel index (zero based).
No error checks are done for out of array bounds conditions. The routine works the fastest when sequentially accessing the counts (e.g., index = 0,1,2,...).
index | Zero based sample position |
int Isis::QuickFilter::HalfHeight | ( | ) | const |
Returns the half the height of the boxcar rounded down because the boxcar size is odd.
Referenced by Isis::ProcessByQuickFilter::StartProcess().
int Isis::QuickFilter::HalfWidth | ( | ) | const |
Returns the half the width of the boxcar rounded down because the boxcar size is odd.
int Isis::QuickFilter::Height | ( | ) | const |
Returns the height of the boxcar.
double Isis::QuickFilter::High | ( | ) | const |
Returns the highest pixel value included in filtering computations.
double Isis::QuickFilter::Low | ( | ) | const |
Returns the lowest pixel value included in filtering computations.
int Isis::QuickFilter::MinimumPixels | ( | ) | const |
Returns the minimum number of pixels which need to be valid inside the boxcar.
If there are not enough valid pixels then invoking Average and Variance methods will result in a NULL output.
void Isis::QuickFilter::RemoveLine | ( | const double * | buf | ) |
Remove an array of doubles from the accumulators and counters.
buf | Pointer to array of doubles to remove |
References Isis::IsValidPixel().
Referenced by Isis::ProcessByQuickFilter::StartProcess().
void Isis::QuickFilter::Reset | ( | ) |
Reset all accumulators and counters to zero.
Referenced by QuickFilter(), and Isis::ProcessByQuickFilter::StartProcess().
int Isis::QuickFilter::Samples | ( | ) | const |
Returns the number of samples in a line.
void Isis::QuickFilter::SetMinimumPixels | ( | const int | pixels | ) |
This method is used to set the minimum number of valid pixels in the boxcar.
If the minimum requirement can not be satisfied then the Average and Variance methods will return Isis:NULL8. The default value is zero.
pixels | Number of minimum valid pixels for statistically computations to occur |
Isis::iException::Programmer |
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by Isis::ProcessByQuickFilter::StartProcess().
void Isis::QuickFilter::SetMinMax | ( | const double | minimum, |
const double | maximum ) |
This method is used to set the minimum/maximum valid values.
Pixels are only considered valid (usable when computing Average and Variance) if they are not special (NULL, LIS, etc) and if they fall within the range of minimum and maximum inclusive. You should only invoke this method once after the object has been constructed. Further invocations will cause unpredictable results. If this method is never called then the defaults are DBL_MIN and DBL_MAX, respectively.
minimum | Minimum valid pixel |
maximum | Maximum valid pixel |
Isis::iException::Programmer |
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by Isis::ProcessByQuickFilter::StartProcess().
double Isis::QuickFilter::Variance | ( | const int | index | ) |
Computes and returns the boxcar variance at pixel index (zero based).
No error checks are done for out of array bounds conditions. If there are not enough valid pixels in the boxcar then Isis::NULL8 is returned. The routine works the fastest when sequentially accessing the variances (e.g., index = 0,1,2,...).
index | Zero based sample position |
References Isis::NULL8.
int Isis::QuickFilter::Width | ( | ) | const |
Returns the width of the boxcar.