#include <cmath>
#include <iostream>
#include <limits>
#include <memory>
typedef math::Statistics ImgStat;
typedef math::MaskedVector<float> MaskedVectorF;
template <typename Image>
void printStats(Image &img, math::StatisticsControl const &sctrl) {
img,
sctrl);
}
int const wid = 1024;
MaskedImageF mimg(img.getDimensions());
MaskedVectorF mv(wid * wid);
for (int j = 0; j != img.getHeight(); ++j) {
int k = 0;
MaskedImageF::x_iterator mip = mimg.row_begin(j);
for (ImageF::x_iterator ip = img.row_begin(j); ip != img.row_end(j); ++ip) {
double xLorentz = xUniform;
if (static_cast<double>(
std::rand()) / RAND_MAX < 0.01) {
xLorentz = NAN;
}
*ip = xLorentz;
v.push_back(xLorentz);
++k;
++mip;
}
}
int j = 0;
for (MaskedVectorF::iterator mvp = mv.begin(); mvp != mv.end(); ++mvp) {
++j;
}
math::StatisticsControl sctrl;
sctrl.setNumIter(3);
sctrl.setNumSigmaClip(5.0);
sctrl.setAndMask(0x1);
sctrl.setNanSafe(true);
printStats(img, sctrl);
printStats(mimg, sctrl);
printStats(v, sctrl);
printStats(mv, sctrl);
printStats(*vF, sctrl);
sctrl.setWeighted(true);
sctrl.setAndMask(0x0);
printStats(mimg, sctrl);
return 0;
}