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

details ArrayOfRegionStatistics< RegionStatistics, LabelType > Class Template Reference VIGRA

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 const & const_reference
 
typedef
RegionStatistics::argument_type 
first_argument_type
 
typedef RegionArray::iterator iterator
 
typedef RegionStatistics & reference
 
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)
 
void operator() (first_argument_type const &v, second_argument_type label)
 
result_type operator() (argument_type label) const
 
const_reference operator[] (argument_type label) const
 
reference operator[] (argument_type label)
 
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);

Required Interface:

RegionStatistics region;
RegionStatistics::argument_type a;
RegionStatistics::result_type r;
region(a); // update statistics
r = region(); // return statistics
Examples:
voronoi.cxx, and watershed.cxx.

Member Typedef Documentation

typedef RegionStatistics::argument_type first_argument_type

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

typedef LabelType second_argument_type

label type is used to determine the region to be updated

typedef LabelType argument_type

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

typedef RegionStatistics::result_type result_type

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

typedef RegionStatistics 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.

typedef RegionStatistics& reference

the array's reference type

typedef RegionStatistics const& const_reference

the array's const reference type

typedef RegionArray::iterator iterator

type to iterate over the statistics array

typedef RegionArray::const_iterator const_iterator

type to iterate over a const statistics array

Constructor & Destructor Documentation

init array of RegionStatistics with default size 0.

ArrayOfRegionStatistics ( unsigned int  max_region_label)

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

Member Function Documentation

void resize ( unsigned int  max_region_label)

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

void reset ( )

reset the contained functors to their initial state.

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.

void merge ( argument_type  label1,
argument_type  label2 
)

merge second region into first

unsigned int maxRegionLabel ( ) const

ask for maximal index (label) allowed

unsigned int size ( ) const

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

result_type operator() ( argument_type  label) const

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

const_reference operator[] ( argument_type  label) const

read the statistics functor for a region via its label

reference operator[] ( argument_type  label)

access the statistics functor for a region via its label

iterator begin ( )

iterator to the begin of the region array

const_iterator begin ( ) const

const iterator to the begin of the region array

iterator end ( )

iterator to the end of the region array

const_iterator end ( ) const

const iterator to the end of the region array

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.11.1 (Fri May 19 2017)