vigra - CrackContourCirculator< IMAGEITERATOR > Class Template Reference

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

| CrackContourCirculator< IMAGEITERATOR > Class Template Reference Image Iterator Adapters |

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
CrackContourCirculator & | operator++ ()
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
CrackContourCirculator<ImageIterator> crack(region_anchor);
CrackContourCirculator<ImageIterator> crackend(crack);
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;

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

## Member Typedef Documentation

typedef Point2D value_type

the circulator's value type

typedef Point2D const& reference

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

typedef Point2D const* pointer

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

typedef forward_circulator_tag iterator_category

the circulator tag

## Constructor & Destructor Documentation

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

CrackContourCirculator& operator++ | ( |  | ) |

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

CrackContourCirculator operator++ | ( | int |  | ) |

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

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

equality

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

inequality

reference pos | ( |  | ) | const

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

reference operator* | ( |  | ) | const

Equivalent to pos()

pointer operator-> | ( |  | ) | const

Access member of the current coordinate.

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

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:

- vigra/contourcirculator.hxx

© 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.0 (Thu Mar 17 2016)