[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]
![]() |
ArrayOfRegionStatistics Class Template Reference | ![]() |
---|
Calculate statistics for all regions of a labeled image. More...
#include "vigra/inspectimage.hxx"
Public Types | |
typedef RegionStatistics::argument_type | first_argument_type |
typedef LabelType | second_argument_type |
typedef LabelType | argument_type |
typedef RegionStatistics::result_type | result_type |
typedef RegionStatistics | value_type |
typedef RegionStatistics & | reference |
typedef RegionStatistics const & | const_reference |
typedef RegionArray::iterator | iterator |
typedef RegionArray::const_iterator | const_iterator |
Public Methods | |
ArrayOfRegionStatistics () | |
ArrayOfRegionStatistics (unsigned int max_region_label) | |
void | resize (unsigned int max_region_label) |
void | reset () |
void | operator() (first_argument_type const &v, second_argument_type label) |
void | merge (argument_type label1, argument_type label2) |
unsigned int | maxRegionLabel () const |
unsigned int | size () const |
result_type | operator() (argument_type label) const |
const_reference | operator[] (argument_type label) const |
reference | operator[] (argument_type label) |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
Detailed Description |
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:
Usage:
#include "vigra/inspectimage.hxx"
Required Interface:
voronoi.cxx, and watershed.cxx.
label type is also used to determine the region to be returned by the 1 argument operator()
type to iterate over a const statistics array
the array's const reference type
argument type of the contained statistics object becomes first argument of the analyser
type to iterate over the statistics array
the array's reference type
result type of the contained statistics object becomes result type of the analyser
label type is used to determine the region to be updated
the value type of the array: the contained statistics object. Note: this definition was different in older VIGRA versions. The old definition was wrong.
init array of RegionStatistics with default size 0.
init array of RegionStatistics with index domain 0...max_region_label.
const iterator to the begin of the region array
iterator to the begin of the region array
const iterator to the end of the region array
iterator to the end of the region array
ask for maximal index (label) allowed
merge second region into first
access the statistics for a region via its label. The label type is converted to
update regions statistics for region
access the statistics functor for a region via its label
read the statistics functor for a region via its label
reset the contained functors to their initial state.
resize array to new index domain 0...max_region_label. All bin are re-initialized.
ask for array size (i.e. maxRegionLabel() + 1)
© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
html generated using doxygen and Python
FunctorTraits::isBinaryAnalyser
and FunctorTraits::isUnaryFunctor
are true (VigraTrueType
)
Namespace: vigra
vigra::BImage img;
vigra::IImage labels;
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 lavel of region " << i << ": "
<< minmax.region[i].max << endl;
}
// init functor as an array of 'max_label' FindAverage-Functors
vigra::ArrayOfRegionStatistics<vigra::FindAverage<vigra::BImage::PixelType> >
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);
RegionStatistics region;
RegionStatistics::argument_type a;
RegionStatistics::result_type r;
region(a); // update statistics
r = region(); // return statistics
Member Typedef Documentation
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
Constructor & Destructor Documentation
ArrayOfRegionStatistics
(
)
[inline]
ArrayOfRegionStatistics
(
unsigned int
max_region_label
)
[inline]
Member Function Documentation
const_iterator begin
(
)
const
[inline]
iterator begin
(
)
[inline]
const_iterator end
(
)
const
[inline]
iterator end
(
)
[inline]
unsigned int maxRegionLabel
(
)
const
[inline]
void merge
(
argument_type
label1,
argument_type
label2
)
[inline]
result_type operator()
(
argument_type
label
)
const
[inline]
unsigned int
.
void operator()
(
first_argument_type const &
v,
second_argument_type
label
)
[inline]
label
. The label type is converted to unsigned int
.
reference operator[]
(
argument_type
label
)
[inline]
const_reference operator[]
(
argument_type
label
)
const
[inline]
void reset
(
)
[inline]
void resize
(
unsigned int
max_region_label
)
[inline]
unsigned int size
(
)
const
[inline]
The documentation for this class was generated from the following file:
Cognitive Systems Group,
University of Hamburg, Germany
VIGRA 1.3.3 (18 Aug 2005)