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

CrackContourCirculator< IMAGEITERATOR > Class Template Reference

Circulator that walks around a given region. More...

#include <vigra/contourcirculator.hxx>

Public Types

typedef forward_circulator_tag iterator_category
 
typedef Point2D const * pointer
 
typedef Point2D const & reference
 
typedef Point2D value_type
 

Public Member Functions

 CrackContourCirculator (IMAGEITERATOR const &in_the_region, vigra::FourNeighborCode::Direction dir=vigra::FourNeighborCode::West)
 
Diff2D const & diff () const
 
bool operator!= (CrackContourCirculator const &o) const
 
reference operator* () const
 
CrackContourCirculatoroperator++ ()
 
CrackContourCirculator operator++ (int)
 
pointer operator-> () const
 
bool operator== (CrackContourCirculator const &o) const
 
IMAGEITERATOR outerPixel () const
 
reference pos () const
 

Detailed Description

template<class IMAGEITERATOR>
class vigra::CrackContourCirculator< IMAGEITERATOR >

Circulator that walks around a given region.

The circulator follows the crack contour of a given region. Here, a region is an 8-connected component of pixels with the same value, such as the regions in a label image. The crack contour is located between the inside and outside pixels, that is "on the crack" between the region and the background. Thus, the circulator moves from pixel corner to pixel corner. By definition, the first corner (where the circulator was initialized) gets the coordinate (0,0), and calls to *circulator return the distance of the current corner to the initial one.

The circulator can be used to calculate the area of a region (in pixels):

// start with a pixel within the region, whose left neighbor is outside
// (see CrackContourCirculator constructor)
ImageIterator region_anchor = ...;
int area = 0;
// calculate area from following the crack contour of the region
do
{
area += crack.diff().x * crack.pos().y -
crack.diff().y * crack.pos().x;
}
while(++crack != crackend);
area /= 2;
std::cout << "Area of region " << *region_anchor << ": " << area << std::endl;
Circulator that walks around a given region.
Definition contourcirculator.hxx:94
Standard 2D random access iterator for images that store the data in a linear array.
Definition imageiterator.hxx:851

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

Member Typedef Documentation

◆ value_type

template<class IMAGEITERATOR >
Point2D value_type

the circulator's value type

◆ reference

template<class IMAGEITERATOR >
Point2D const& reference

the circulator's reference type (return type of *circ)

◆ pointer

template<class IMAGEITERATOR >
Point2D const* pointer

the circulator's pointer type (return type of operator->)

◆ iterator_category

template<class IMAGEITERATOR >
forward_circulator_tag iterator_category

the circulator tag

Constructor & Destructor Documentation

◆ CrackContourCirculator()

template<class IMAGEITERATOR >
CrackContourCirculator ( IMAGEITERATOR const & in_the_region,
vigra::FourNeighborCode::Direction dir = vigra::FourNeighborCode::West )

Initialize the circulator for a given region.

The image iterator in_the_region must refer to a boundary pixel of the region to be analysed. The direction code dir must point to a pixel outside the region (the default assumes that the pixel left of the given region pixel belongs to the background). The first corner of the crack contour is the corner to the right of this direction (i.e. the north west corner of the region pixel, if the direction was West).

Member Function Documentation

◆ operator++() [1/2]

template<class IMAGEITERATOR >
CrackContourCirculator & operator++ ( )

Move to the next crack corner of the contour (pre-increment).

◆ operator++() [2/2]

template<class IMAGEITERATOR >
CrackContourCirculator operator++ ( int )

Move to the next crack corner of the contour (post-increment).

◆ operator==()

template<class IMAGEITERATOR >
bool operator== ( CrackContourCirculator< IMAGEITERATOR > const & o) const

equality

◆ operator!=()

template<class IMAGEITERATOR >
bool operator!= ( CrackContourCirculator< IMAGEITERATOR > const & o) const

inequality

◆ pos()

template<class IMAGEITERATOR >
reference pos ( ) const

Get the coordinate of the current corner (relative to the first corner).

◆ operator*()

template<class IMAGEITERATOR >
reference operator* ( ) const

Equivalent to pos()

◆ operator->()

template<class IMAGEITERATOR >
pointer operator-> ( ) const

Access member of the current coordinate.

◆ outerPixel()

template<class IMAGEITERATOR >
IMAGEITERATOR outerPixel ( ) const

Access pixel to the right of the crack edge (outside of the region bounded by the crack contour we walk on). Note that after operator++, the iterator can still point to the same pixel (looking from another direction now).

◆ diff()

template<class IMAGEITERATOR >
Diff2D const & diff ( ) const

Get the offset from the current corner of the contour to the next one.


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.2