[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| vigra::acc Namespace Reference |

Efficient computation of object statistics. More...

## Classes
class | AbsPowerSum
| Basic statistic. AbsPowerSum<N> = . More...
class | AccumulatorChain
| Create an accumulator chain containing the selected statistics and their dependencies. More...
class | AccumulatorChainArray
| Create an array of accumulator chains containing the selected per-region and global statistics and their dependencies. More...
class | ArgMaxWeight
| Basic statistic. Data where weight assumes its maximal value. More...
class | ArgMinWeight
| Basic statistic. Data value where weight assumes its minimal value. More...
class | AutoRangeHistogram
| Histogram where range mapping bounds are defined by minimum and maximum of data. More...
class | Central
| Modifier. Substract mean before computing statistic. More...
class | Central< PowerSum< 2 > >
| Spezialization: works in pass 1, operator+=() supported (merging supported). More...
class | Central< PowerSum< 3 > >
| Specialization: works in pass 2, operator+=() supported (merging supported). More...
class | Central< PowerSum< 4 > >
| Specialization: works in pass 2, operator+=() supported (merging supported). More...
class | CentralMoment
| Alias. CentralMoment<N>. More...
class | ConvexHull
| Compute the convex hull of a region. More...
class | ConvexHullFeatures
| Compute object features related to the convex hull. More...
class | Coord
| Modifier. Compute statistic from pixel coordinates rather than from pixel values. More...
class | CoordinateSystem
| Basic statistic. Identity matrix of appropriate size. More...
class | DataArg
| Specifies index of data in CoupledHandle. More...
class | DivideByCount
| Modifier. Divide statistic by Count: DivideByCount<TAG> = TAG / Count . More...
class | DivideUnbiased
| Modifier. Divide statistics by Count-1: DivideUnbiased<TAG> = TAG / (Count-1) More...
class | DynamicAccumulatorChain
| Create a dynamic accumulator chain containing the selected statistics and their dependencies. More...
class | DynamicAccumulatorChainArray
| Create an array of dynamic accumulator chains containing the selected per-region and global statistics and their dependencies. More...
class | FirstSeen
| Basic statistic. First data value seen of the object. More...
class | FlatScatterMatrix
| Basic statistic. Flattened uppter-triangular part of scatter matrix. More...
class | Global
| Modifier. Compute statistic globally rather than per region. More...
class | GlobalRangeHistogram
| Like AutoRangeHistogram, but use global min/max rather than region min/max. More...
class | IntegerHistogram
| Histogram where data values are equal to bin indices. More...
class | Kurtosis
| Basic statistic. Kurtosis. More...
class | LabelArg
| Specifies index of labels in CoupledHandle. More...
class | Maximum
| Basic statistic. Maximum value. More...
class | Minimum
| Basic statistic. Minimum value. More...
class | Moment
| Alias. Moment<N>. More...
class | PowerSum
| Basic statistic. PowerSum<N> = . More...
class | Principal
| Modifier. Project onto PCA eigenvectors. More...
class | Principal< CoordinateSystem >
| Specialization (covariance eigenvectors): works in pass 1, operator+=() supported (merging). More...
class | Principal< PowerSum< 2 > >
| Specialization (covariance eigenvalues): works in pass 1, operator+=() supported (merging). More...
class | Range
| Return both the minimum and maximum in `std::pair`. More...
class | RegionCircularity
| Compute the circularity of a 2D region. More...
class | RegionContour
| Compute the contour of a 2D region. More...
class | RegionEccentricity
| Compute the eccentricity of a 2D region in terms of its prinipal radii. More...
class | RegionPerimeter
| Compute the perimeter of a 2D region. More...
class | RootDivideByCount
| Modifier. RootDivideByCount<TAG> = sqrt( TAG/Count ) More...
class | RootDivideUnbiased
| Modifier. RootDivideUnbiased<TAG> = sqrt( TAG / (Count-1) ) More...
class | ScatterMatrixEigensystem
struct | Select
| Wrapper for MakeTypeList that additionally performs tag standardization. More...
class | Skewness
| Basic statistic. Skewness. More...
class | StandAloneAccumulatorChain
| Create an accumulator chain that works independently of a MultiArray. More...
class | StandAloneDataFreeAccumulatorChain
| Create an accumulator chain that works independently of a MultiArray. More...
class | StandardQuantiles
| Compute (0%, 10%, 25%, 50%, 75%, 90%, 100%) quantiles from given histogram. More...
class | UnbiasedKurtosis
| Basic statistic. Unbiased Kurtosis. More...
class | UnbiasedSkewness
| Basic statistic. Unbiased Skewness. More...
class | UserRangeHistogram
| Histogram where user provides bounds for linear range mapping from values to indices. More...
class | WeightArg
| Specifies index of data in CoupledHandle. More...
class | Weighted
| Compute weighted version of the statistic. More...

## Typedefs
typedef AbsPowerSum< 1 > | AbsSum
| Alias. Absolute sum.
typedef Weighted< RegionAxes > | AxesOfInertia
| Alias. Axes of inertia.
typedef Coord< Range > | BoundingBox
| Alias. Rectangle enclosing the region, as a `std::pair` of coordinates.
typedef Weighted< RegionCenter > | CenterOfMass
| Alias. Center of mass.
typedef PowerSum< 0 > | Count
| Alias. Count.
typedef DivideByCount < FlatScatterMatrix > | Covariance
| Alias. Covariance.
typedef DivideByCount < ScatterMatrixEigensystem > | CovarianceEigensystem
| Alias. Covariance eigensystem.
typedef DivideByCount< Sum > | Mean
| Alias. Mean.
typedef DivideByCount < SumOfAbsDifferences > | MeanAbsoluteDeviation
| Alias. Mean absolute deviation.
typedef Weighted< Coord < Principal< Variance > > > | MomentsOfInertia
| Alias. Moments of inertia.
typedef Coord< FirstSeen > | RegionAnchor
| Alias. Anchor point (first point of the region seen by scan-order traversal.
typedef Coord< Principal < CoordinateSystem > > | RegionAxes
| Alias. Region axes.
typedef Coord< Mean > | RegionCenter
| Alias. Region center.
typedef Coord< Principal < StdDev > > | RegionRadii
| Alias. Region radii.
typedef RootDivideByCount < SumOfSquares > | RootMeanSquares
| Alias. Root mean square.
typedef SumOfSquaredDifferences | SSD
| Alias. Sum of squared differences.
typedef RootDivideByCount < Central< PowerSum< 2 > > > | StdDev
| Alias. Standard deviation.
typedef PowerSum< 1 > | Sum
| Alias. Sum.
typedef Central< AbsSum > | SumOfAbsDifferences
| Alias. Sum of absolute differences.
typedef Central< PowerSum< 2 > > | SumOfSquaredDifferences
| Alias. Sum of squared differences.
typedef PowerSum< 2 > | SumOfSquares
| Alias. Sum of squares.
typedef DivideUnbiased < FlatScatterMatrix > | UnbiasedCovariance
| Alias. Unbiased covariance.
typedef RootDivideUnbiased < Central< PowerSum< 2 > > > | UnbiasedStdDev
| Alias. Unbiased standard deviation.
typedef DivideUnbiased < Central< PowerSum< 2 > > > | UnbiasedVariance
| Alias. Unbiased variance.
typedef DivideByCount< Central < PowerSum< 2 > > > | Variance
| Alias. Variance.
typedef Weighted< RegionCenter > | WeightedRegionCenter
| Alias. Region center weighted by the region intensity (center of mass).
typedef Weighted< RegionRadii > | WeightedRegionRadii
| Alias. Region radius weighted by region intensity (square root of the moments of inertia).

## Functions
template<class Tag , class A >
void | activate (A &a)
template<... >
void | extractFeatures (...)
template<class TAG , class A >
LookupTag< TAG, A >::result_type | get (A const &a)
template<class TAG , class A >
LookupTag< TAG, A >::result_type | get (A const &a, MultiArrayIndex label)
template<class TAG , class A >
LookupTag< TAG, A >::reference | getAccumulator (A &a)
template<class TAG , class A >
LookupTag< TAG, A >::reference | getAccumulator (A &a, MultiArrayIndex label)
template<class Tag , class A >
bool | isActive (A const &a)

## Detailed Description

Efficient computation of object statistics.

This namespace contains the accumulator classes, fundamental statistics and modifiers. See Feature Accumulators for examples of usage.

## Function Documentation

LookupTag< TAG, A >::reference getAccumulator | ( | A & | a | ) |

Get a reference to the accumulator 'TAG' in the accumulator chain 'a'. This can be useful for example to update a certain accumulator with data, set individual options or get information about a certain accumulator.
Example of use (set options):

vigra::MultiArray<2, double> data(...);
typedef UserRangeHistogram<40> SomeHistogram; //binCount set at compile time
typedef UserRangeHistogram<0> SomeHistogram2; // binCount must be set at run-time
AccumulatorChain<DataType, Select<SomeHistogram, SomeHistogram2> > a;
getAccumulator<SomeHistogram>(a).setMinMax(0.1, 0.9);
getAccumulator<SomeHistogram2>(a).setMinMax(0.0, 1.0);
extractFeatures(data.begin(), data.end(), a);

Example of use (get information):

vigra::MultiArray<2, double> data(...));
AccumulatorChain<double, Select<Mean, Skewness> > a;
std::cout << "passes required for all statistics: " << a.passesRequired() << std::endl; //skewness needs two passes
std::cout << "passes required by Mean: " << getAccumulator<Mean>(a).passesRequired() << std::endl;

See Feature Accumulators for more information about feature computation via accumulators.

LookupTag<TAG, A>::reference vigra::acc::getAccumulator | ( | A & | a,
|  | MultiArrayIndex | label
| ) |  |

Get a reference to the accumulator 'TAG' for region 'label' in the accumulator chain 'a'.

LookupTag<TAG, A>::result_type vigra::acc::get | ( | A const & | a | ) |

Get the result of the accumulator 'TAG' in the accumulator chain 'a'.
Example of use:

vigra::MultiArray<2, double> data(...);
AccumulatorChain<DataType, Select<Variance, Mean, StdDev> > a;
extractFeatures(data.begin(), data.end(), a);
double mean = get<Mean>(a);

See Feature Accumulators for more information about feature computation via accumulators.

LookupTag<TAG, A>::result_type vigra::acc::get | ( | A const & | a,
|  | MultiArrayIndex | label
| ) |  |

Get the result of the accumulator 'TAG' for region 'label' in the accumulator chain 'a'.
Example of use:

vigra::MultiArray<2, double> data(...);
vigra::MultiArray<2, int> labels(...);
typedef vigra::CoupledIteratorType<2, double, int>::type Iterator;
typedef Iterator::value_type Handle;
AccumulatorChainArray<Handle,
Select<DataArg<1>, LabelArg<2>, Mean, Variance> > a;
Iterator start = createCoupledIterator(data, labels);
Iterator end = start.getEndIterator();
extractFeatures(start,end,a);
double mean_of_region_1 = get<Mean>(a,1);
double mean_of_background = get<Mean>(a,0);

See Feature Accumulators for more information about feature computation via accumulators.

void vigra::acc::activate | ( | A & | a | ) |

Activate the dynamic accumulator 'Tag' in the dynamic accumulator chain 'a'. Same as a.activate<Tag>() (see DynamicAccumulatorChain::activate<Tag>() or DynamicAccumulatorChainArray::activate<Tag>()). For run-time activation use DynamicAccumulatorChain::activate(std::string tag) or DynamicAccumulatorChainArray::activate(std::string tag) instead.
See Feature Accumulators for more information about feature computation via accumulators.

bool vigra::acc::isActive | ( | A const & | a | ) |

Check if the dynamic accumulator 'Tag' in the accumulator chain 'a' is active. Same as a.isActive<Tag>() (see DynamicAccumulatorChain::isActive<Tag>() or DynamicAccumulatorChainArray::isActive<Tag>()). At run-time, use DynamicAccumulatorChain::isActive(std::string tag) const or DynamicAccumulatorChainArray::isActive(std::string tag) const instead.
See Feature Accumulators for more information about feature computation via accumulators.

void vigra::acc::extractFeatures | ( |  | ... | ) |

Generic loop to collect statistics from one or several arrays.

This function automatically performs as many passes over the data as necessary for the selected statistics. The basic version of `extractFeatures()` takes an iterator pair and a reference to an accumulator chain:

namespace vigra { namespace acc {
template <class ITERATOR, class ACCUMULATOR>
void extractFeatures(ITERATOR start, ITERATOR end, ACCUMULATOR & a);
}}

The `ITERATOR` can be any STL-conforming forward iterator (including raw pointers and vigra::CoupledScanOrderIterator). The `ACCUMULATOR` must be instantiated with the `ITERATOR`'s `value_type` as its first template argument. For example, to use a raw pointer you write:

AccumulatorChain<double, Select<Mean, Variance> > a;
double * start = ...,
end = ...;
extractFeatures(start, end, a);

Similarly, you can use MultiArray's scan-order iterator:

AccumulatorChain<TinyVector<float, 2>, Select<Mean, Variance> > a;
MultiArray<3, TinyVector<float, 2> > data(...);
extractFeatures(data.begin(), data.end(), a);

An alternative syntax is used when you want to compute weighted or region statistics (or both). Then it is necessary to iterate over several arrays simultaneously. This fact is best conveyed to the accumulator via the helper class vigra::CoupledArrays that is used as the accumulator's first template argument and holds the dimension and value types of the arrays involved. To actually compute the features, you then pass appropriate arrays to the `extractfeatures()` function directly. For example, region statistics can be obtained like this:

MultiArray<3, double> data(...);
MultiArray<3, int> labels(...);
AccumulatorChainArray<CoupledArrays<3, double, int>,
Select<DataArg<1>, LabelArg<2>, // where to look for data and region labels
Mean, Variance> > // what statistics to compute
a;
extractFeatures(data, labels, a);

This form of `extractFeatures()` is supported for up to five arrays (although at most three are currently making sense in practice):

namespace vigra { namespace acc {
template <unsigned int N, class T1, class S1,
class ACCUMULATOR>
void extractFeatures(MultiArrayView<N, T1, S1> const & a1,
ACCUMULATOR & a);
...
template <unsigned int N, class T1, class S1,
class T2, class S2,
class T3, class S3,
class T4, class S4,
class T5, class S5,
class ACCUMULATOR>
void extractFeatures(MultiArrayView<N, T1, S1> const & a1,
MultiArrayView<N, T2, S2> const & a2,
MultiArrayView<N, T3, S3> const & a3,
MultiArrayView<N, T4, S4> const & a4,
MultiArrayView<N, T5, S5> const & a5,
ACCUMULATOR & a);
}}

Of course, the number and types of the arrays specified in `CoupledArrays` must conform to the number and types of the arrays passed to `extractFeatures()`.

See Feature Accumulators for more information about feature computation via accumulators.

Examples:
  graph_agglomerative_clustering.cxx.

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.1 (Fri May 19 2017)