Go to the documentation of this file.
9 #ifndef OPENVDB_TOOLS_STATISTICS_HAS_BEEN_INCLUDED
10 #define OPENVDB_TOOLS_STATISTICS_HAS_BEEN_INCLUDED
32 template<
typename IterT>
33 inline math::Histogram
34 histogram(
const IterT& iter,
double minVal,
double maxVal,
35 size_t numBins = 10,
bool threaded =
true);
43 template<
typename IterT>
45 extrema(
const IterT& iter,
bool threaded =
true);
53 template<
typename IterT>
55 statistics(
const IterT& iter,
bool threaded =
true);
86 template<
typename IterT,
typename ValueOp>
88 extrema(
const IterT& iter,
const ValueOp& op,
bool threaded);
119 template<
typename IterT,
typename ValueOp>
121 statistics(
const IterT& iter,
const ValueOp& op,
bool threaded);
186 template<
typename OperatorT,
typename IterT>
188 opStatistics(
const IterT& iter,
const OperatorT& op = OperatorT(),
bool threaded =
true);
191 template<
typename OperatorT,
typename IterT>
193 opExtrema(
const IterT& iter,
const OperatorT& op = OperatorT(),
bool threaded =
true);
198 namespace stats_internal {
203 template<
typename IterT,
typename AuxT =
void>
208 template<
typename TreeT,
typename ValueIterT>
209 struct IterTraits<tree::TreeValueIteratorBase<TreeT, ValueIterT> > {
220 static inline double get(
const T& val) {
return double(val); }
225 static inline double get(
const T& val) {
return val.length(); }
232 template<
typename IterT,
typename StatsT>
238 inline void operator()(
const IterT& iter, StatsT& stats)
const {
239 if (iter.isVoxelValue()) stats.add(ImplT::get(*iter));
240 else stats.add(ImplT::get(*iter), iter.getVoxelCount());
246 template<
typename IterT,
typename ValueOp,
typename StatsT>
252 inline void operator()(
const IterT& iter) { getValue(iter, stats); }
264 template<
typename IterT,
typename ValueOp>
267 HistOp(
const ValueOp& op,
double vmin,
double vmax,
size_t bins):
268 hist(vmin, vmax, bins), getValue(op)
272 inline void operator()(
const IterT& iter) { getValue(iter, hist); }
285 template<
typename IterT,
typename OpT,
typename StatsT>
288 using TreeT =
typename IterT::TreeT;
289 using ValueT =
typename TreeT::ValueType;
297 template<
typename TreeT>
303 MathOp(
const IterT& iter,
const OpT& op):
304 mAcc(*THROW_IF_NULL(iter.getTree())), mOp(op)
310 if (it.isVoxelValue()) {
312 mStats.add(mOp.result(mAcc, it.getCoord()));
321 int &x = xyz.
x(), &y = xyz.
y(), &z = xyz.
z();
322 for (x = bbox.
min().
x(); x <= bbox.
max().
x(); ++x) {
323 for (y = bbox.
min().
y(); y <= bbox.
max().
y(); ++y) {
324 for (z = bbox.
min().
z(); z <= bbox.
max().
z(); ++z) {
325 mStats.add(mOp.result(mAcc, it.getCoord()));
339 template<
typename IterT>
341 histogram(
const IterT& iter,
double vmin,
double vmax,
size_t numBins,
bool threaded)
350 template<
typename IterT>
355 return extrema(iter, valOp, threaded);
358 template<
typename IterT>
366 template<
typename IterT,
typename ValueOp>
368 extrema(
const IterT& iter,
const ValueOp& valOp,
bool threaded)
375 template<
typename IterT,
typename ValueOp>
377 statistics(
const IterT& iter,
const ValueOp& valOp,
bool threaded)
385 template<
typename OperatorT,
typename IterT>
387 opExtrema(
const IterT& iter,
const OperatorT& op,
bool threaded)
394 template<
typename OperatorT,
typename IterT>
407 #endif // OPENVDB_TOOLS_STATISTICS_HAS_BEEN_INCLUDED
This class computes statistics (minimum value, maximum value, mean, variance and standard deviation) ...
Definition: Stats.h:183
This class computes the minimum and maximum values of a population of floating-point values.
Definition: Stats.h:93
Int32 y() const
Definition: Coord.h:132
Int32 x() const
Definition: Coord.h:131
This class computes a histogram, with a fixed interval width, of a population of floating-point value...
Definition: Stats.h:280
Classes to compute statistics and histograms.
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:26
Int32 z() const
Definition: Coord.h:133
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:146
const Coord & max() const
Definition: Coord.h:322
const Coord & min() const
Definition: Coord.h:321
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:94
Definition: Exceptions.h:65
typename ValueIterT::NonConstValueType ValueT
Definition: TreeIterator.h:622
Definition: Exceptions.h:13
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:82