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

ArrayOfRegionStatistics< RegionStatistics, LabelType > Class Template Reference

Calculate statistics for all regions of a labeled image. More...

#include <vigra/inspectimage.hxx>

Inherits get_extra_passes< RegionStatistics >.

Public Types

typedef LabelType argument_type
 
typedef RegionArray::const_iterator const_iterator
 
typedef RegionStatistics constconst_reference
 
typedef RegionStatistics::argument_type first_argument_type
 
typedef RegionArray::iterator iterator
 
typedef RegionStatisticsreference
 
typedef RegionStatistics::result_type result_type
 
typedef LabelType second_argument_type
 
typedef RegionStatistics value_type
 

Public Member Functions

 ArrayOfRegionStatistics ()
 
 ArrayOfRegionStatistics (unsigned int max_region_label)
 
iterator begin ()
 
const_iterator begin () const
 
void calc_sync ()
 
iterator end ()
 
const_iterator end () const
 
unsigned int maxRegionLabel () const
 
void merge (argument_type label1, argument_type label2)
 
result_type operator() (argument_type label) const
 
void operator() (first_argument_type const &v, second_argument_type label)
 
reference operator[] (argument_type label)
 
const_reference operator[] (argument_type label) const
 
void reset ()
 
void resize (unsigned int max_region_label)
 
unsigned int size () const
 

Detailed Description

template<class RegionStatistics, class LabelType = int>
class vigra::ArrayOfRegionStatistics< RegionStatistics, LabelType >

Calculate statistics for all regions of a labeled image.

This Functor encapsulates an array of statistics functors, one for each label, and selects the one to be updated according to the pixel's label.

Traits defined:

FunctorTraits::isBinaryAnalyser and FunctorTraits::isUnaryFunctor are true (VigraTrueType)

Usage:

#include <vigra/inspectimage.hxx>
Namespace: vigra

int max_label;
...
// init functor as an array of 'max_label' FindMinMax-Functors
vigra::ArrayOfRegionStatistics<vigra::FindMinMax<vigra::BImage::PixelType> >
minmax(max_label);
vigra::inspectTwoImages(srcImageRange(img), srcImage(labels), minmax);
for(int i=0; i<= max_label; ++i)
{
cout << "Max gray level of region " << i << ": "
<< minmax.region[i].max << endl;
}
// init functor as an array of 'max_label' FindAverage-Functors
average(max_label);
vigra::inspectTwoImages(srcImageRange(img), srcImage(labels), average);
// write back the average of each region into the original image
vigra::transformImage(srcImageRange(labels), destImage(img), average);
Class for a single RGB value.
Definition rgbvalue.hxx:128
void transformImage(...)
Apply unary point transformation to each pixel.
void inspectTwoImages(...)
Apply read-only functor to every pixel of both images.

Required Interface:

RegionStatistics::argument_type a;
RegionStatistics::result_type r;
region(a); // update statistics
r = region(); // return statistics

Member Typedef Documentation

◆ first_argument_type

template<class RegionStatistics , class LabelType = int>
typedef RegionStatistics::argument_type first_argument_type

argument type of the contained statistics object becomes first argument of the analyser

◆ second_argument_type

template<class RegionStatistics , class LabelType = int>
typedef LabelType second_argument_type

label type is used to determine the region to be updated

◆ argument_type

template<class RegionStatistics , class LabelType = int>
typedef LabelType argument_type

label type is also used to determine the region to be returned by the 1 argument operator()

◆ result_type

template<class RegionStatistics , class LabelType = int>
typedef RegionStatistics::result_type result_type

result type of the contained statistics object becomes result type of the analyser

◆ value_type

the value type of the array: the contained statistics object. Note: this definition was different in older VIGRA versions. The old definition was wrong.

◆ reference

the array's reference type

◆ const_reference

the array's const reference type

◆ iterator

template<class RegionStatistics , class LabelType = int>
typedef RegionArray::iterator iterator

type to iterate over the statistics array

◆ const_iterator

template<class RegionStatistics , class LabelType = int>
typedef RegionArray::const_iterator const_iterator

type to iterate over a const statistics array

Constructor & Destructor Documentation

◆ ArrayOfRegionStatistics() [1/2]

template<class RegionStatistics , class LabelType = int>
ArrayOfRegionStatistics ( )

init array of RegionStatistics with default size 0.

◆ ArrayOfRegionStatistics() [2/2]

template<class RegionStatistics , class LabelType = int>
ArrayOfRegionStatistics ( unsigned int  max_region_label)

init array of RegionStatistics with index domain 0...max_region_label.

Member Function Documentation

◆ resize()

template<class RegionStatistics , class LabelType = int>
void resize ( unsigned int  max_region_label)

resize array to new index domain 0...max_region_label. All bin are re-initialized.

◆ reset()

template<class RegionStatistics , class LabelType = int>
void reset ( )

reset the contained functors to their initial state.

◆ operator()() [1/2]

template<class RegionStatistics , class LabelType = int>
void operator() ( first_argument_type const v,
second_argument_type  label 
)

update regions statistics for region label. The label type is converted to unsigned int.

◆ merge()

template<class RegionStatistics , class LabelType = int>
void merge ( argument_type  label1,
argument_type  label2 
)

merge second region into first

◆ maxRegionLabel()

template<class RegionStatistics , class LabelType = int>
unsigned int maxRegionLabel ( ) const

ask for maximal index (label) allowed

◆ size()

template<class RegionStatistics , class LabelType = int>
unsigned int size ( ) const

ask for array size (i.e. maxRegionLabel() + 1)

◆ operator()() [2/2]

template<class RegionStatistics , class LabelType = int>
result_type operator() ( argument_type  label) const

access the statistics for a region via its label. The label type is converted to unsigned int.

◆ operator[]() [1/2]

template<class RegionStatistics , class LabelType = int>
const_reference operator[] ( argument_type  label) const

read the statistics functor for a region via its label

◆ operator[]() [2/2]

template<class RegionStatistics , class LabelType = int>
reference operator[] ( argument_type  label)

access the statistics functor for a region via its label

◆ begin() [1/2]

template<class RegionStatistics , class LabelType = int>
iterator begin ( )

iterator to the begin of the region array

◆ begin() [2/2]

template<class RegionStatistics , class LabelType = int>
const_iterator begin ( ) const

const iterator to the begin of the region array

◆ end() [1/2]

template<class RegionStatistics , class LabelType = int>
iterator end ( )

iterator to the end of the region array

◆ end() [2/2]

template<class RegionStatistics , class LabelType = int>
const_iterator end ( ) const

const iterator to the end of the region array

◆ calc_sync()

template<class RegionStatistics , class LabelType = int>
void calc_sync ( )

prepare next pass for multi-pass RegionStatistics types


The documentation for this class was generated from the following file:

© 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.12.1