Isis 3 Programmer Reference
StandardDeviationOperator.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "StandardDeviationOperator.h"
8#include "Chip.h"
9#include "Statistics.h"
10
11namespace Isis {
20 Statistics stats;
21 stats.SetValidRange(mdMinDN, mdMaxDN);
22 for(int i = 0; i < chip.Samples(); i++) {
23 double pixels[chip.Lines()];
24 int n = 0;
25 for(int j = 0; j < chip.Lines(); j++) {
26 if(!IsSpecial(chip.GetValue(i + 1, j + 1))) {
27 pixels[n] = chip.GetValue(i + 1, j + 1);
28 n++;
29 }
30 }
31 stats.AddData(pixels, n);
32 }
33
34 return stats.StandardDeviation();
35 }
36}
37
38extern "C" Isis::InterestOperator *StandardDeviationOperatorPlugin(Isis::Pvl &pPvl) {
39 return new Isis::StandardDeviationOperator(pPvl);
40}
41
A small chip of data used for pattern matching.
Definition Chip.h:86
double GetValue(int sample, int line)
Loads a Chip with a value.
Definition Chip.h:145
int Samples() const
Definition Chip.h:99
int Lines() const
Definition Chip.h:106
double mdMinDN
Standard Option MinDN.
double mdMaxDN
Standard Option MaxDN.
Interest Operator class.
Container for cube-like labels.
Definition Pvl.h:119
Standard deviation interest operator.
virtual double Interest(Chip &chip)
This method returns the amount of interest for the given chip.
This class is used to accumulate statistics on double arrays.
Definition Statistics.h:94
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
bool IsSpecial(const double d)
Returns if the input pixel is special.