Isis 3 Programmer Reference
StandardDeviationOperator.cpp
2 #include "Chip.h"
3 #include "Statistics.h"
4 
5 namespace Isis {
14  Statistics stats;
15  stats.SetValidRange(mdMinDN, mdMaxDN);
16  for(int i = 0; i < chip.Samples(); i++) {
17  double pixels[chip.Lines()];
18  int n = 0;
19  for(int j = 0; j < chip.Lines(); j++) {
20  if(!IsSpecial(chip.GetValue(i + 1, j + 1))) {
21  pixels[n] = chip.GetValue(i + 1, j + 1);
22  n++;
23  }
24  }
25  stats.AddData(pixels, n);
26  }
27 
28  return stats.StandardDeviation();
29  }
30 }
31 
32 extern "C" Isis::InterestOperator *StandardDeviationOperatorPlugin(Isis::Pvl &pPvl) {
33  return new Isis::StandardDeviationOperator(pPvl);
34 }
35 
double StandardDeviation() const
Computes and returns the standard deviation.
Definition: Statistics.cpp:325
double mdMaxDN
Standard Option MaxDN.
A small chip of data used for pattern matching.
Definition: Chip.h:102
Interest Operator class.
This class is used to accumulate statistics on double arrays.
Definition: Statistics.h:107
virtual double Interest(Chip &chip)
This method returns the amount of interest for the given chip.
int Lines() const
Definition: Chip.h:122
Standard deviation interest operator.
bool IsSpecial(const double d)
Returns if the input pixel is special.
Definition: SpecialPixel.h:212
Container for cube-like labels.
Definition: Pvl.h:135
double mdMinDN
Standard Option MinDN.
int Samples() const
Definition: Chip.h:115
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
double GetValue(int sample, int line)
Loads a Chip with a value.
Definition: Chip.h:161
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters.
Definition: Statistics.cpp:154