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

NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE > Class Template Reference

Circulator that walks around a given location in a given image. More...

#include <vigra/pixelneighborhood.hxx>

Inheritance diagram for NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE >:
RestrictedNeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE >

Public Types

typedef IMAGEITERATOR base_type
 
typedef NEIGHBOROFFSETCIRCULATOR::difference_type difference_type
 
typedef NEIGHBORCODE::Direction Direction
 
typedef reference index_reference
 
typedef NEIGHBOROFFSETCIRCULATOR::iterator_category iterator_category
 
typedef NEIGHBORCODE NeighborCode
 
typedef IMAGEITERATOR::pointer pointer
 
typedef IMAGEITERATOR::reference reference
 
typedef IMAGEITERATOR::value_type value_type
 

Public Member Functions

base_type constbase () const
 
base_type center () const
 
NEIGHBOROFFSETCIRCULATOR::value_type constdiff () const
 
Direction direction () const
 
unsigned int directionBit () const
 
bool isDiagonal () const
 
NeighborhoodCirculatormoveCenterToNeighbor ()
 
 NeighborhoodCirculator (IMAGEITERATOR const &aCenter=IMAGEITERATOR(), Direction d=NEIGHBOROFFSETCIRCULATOR::InitialDirection)
 
bool operator!= (NeighborhoodCirculator const &rhs) const
 
reference operator* () const
 
NeighborhoodCirculator operator+ (difference_type d) const
 
NeighborhoodCirculatoroperator++ ()
 
NeighborhoodCirculator operator++ (int)
 
NeighborhoodCirculatoroperator+= (difference_type d)
 
NeighborhoodCirculator operator- (difference_type d) const
 
difference_type operator- (NeighborhoodCirculator const &rhs) const
 
NeighborhoodCirculatoroperator-- ()
 
NeighborhoodCirculator operator-- (int)
 
NeighborhoodCirculatoroperator-= (difference_type d)
 
pointer operator-> () const
 
bool operator== (NeighborhoodCirculator const &rhs) const
 
index_reference operator[] (difference_type d) const
 
NeighborhoodCirculatorswapCenterNeighbor ()
 
NeighborhoodCirculatorturnLeft ()
 
NeighborhoodCirculatorturnRight ()
 
NeighborhoodCirculatorturnRound ()
 
NeighborhoodCirculatorturnTo (Direction d)
 

Detailed Description

template<class IMAGEITERATOR, class NEIGHBORCODE>
class vigra::NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE >

Circulator that walks around a given location in a given image.

The template parameters define the kind of neighborhood used and the underlying image. The access functions return the value of the current neighbor pixel. Use center() to access the center pixel of the neighborhood. The center can be changed by calling moveCenterToNeighbor() or swapCenterNeighbor(). Note that this circulator cannot be used when the center is at the image border. You must then use vigra::RestrictedNeighborhoodCirculator

Usage:

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

BImage::traverser upperleft(...), lowerright(...);
int width = lowerright.x - upperleft.x;
int height = lowerright.y - upperleft.y;
++upperleft.y; // avoid image border
for(int y=1; y<height-1; ++y, ++upperleft.y)
{
BImage::traverser ix = upperleft + Diff2D(1,0);
for(int x=1; x<width-1; ++x, ++ix.x)
{
// analyse all neighbors of a pixel (use FourNeighborCode
// instead of EightNeighborCode for 4-neighborhood):
end(circulator);
do
{
analysisFunc(*circulator, ...); // do sth. with current neighbor
}
while(++circulator != end); // compare with start/end circulator
}
}
Two dimensional difference vector.
Definition diff2d.hxx:186
Class for a single RGB value.
Definition rgbvalue.hxx:128

Member Typedef Documentation

◆ base_type

template<class IMAGEITERATOR , class NEIGHBORCODE >
typedef IMAGEITERATOR base_type

type of the underlying image iterator

◆ NeighborCode

template<class IMAGEITERATOR , class NEIGHBORCODE >
typedef NEIGHBORCODE NeighborCode

type of the used neighbor code

◆ value_type

template<class IMAGEITERATOR , class NEIGHBORCODE >
typedef IMAGEITERATOR::value_type value_type

the circulator's value type

◆ Direction

template<class IMAGEITERATOR , class NEIGHBORCODE >
typedef NEIGHBORCODE::Direction Direction

type of the direction code

◆ reference

template<class IMAGEITERATOR , class NEIGHBORCODE >
typedef IMAGEITERATOR::reference reference

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

◆ index_reference

template<class IMAGEITERATOR , class NEIGHBORCODE >
typedef reference index_reference

the circulator's index reference type (return type of circ[n])

◆ pointer

template<class IMAGEITERATOR , class NEIGHBORCODE >
typedef IMAGEITERATOR::pointer pointer

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

◆ difference_type

the circulator's difference type (argument type of circ[diff])

◆ iterator_category

the circulator tag (random_access_circulator_tag)

Constructor & Destructor Documentation

◆ NeighborhoodCirculator()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator ( IMAGEITERATOR const aCenter = IMAGEITERATOR(),
Direction  d = NEIGHBOROFFSETCIRCULATOR::InitialDirection 
)

Construct circulator with given center pixel, pointing to the neighbor at the given direction d.

Member Function Documentation

◆ operator++() [1/2]

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & operator++ ( )

pre-increment

◆ operator++() [2/2]

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator operator++ ( int  )

post-increment

◆ operator--() [1/2]

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & operator-- ( )

pre-decrement

◆ operator--() [2/2]

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator operator-- ( int  )

post-decrement

◆ operator+=()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & operator+= ( difference_type  d)

add-assignment

◆ operator-=()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & operator-= ( difference_type  d)

subtract-assignment

◆ operator+()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator operator+ ( difference_type  d) const

addition

◆ operator-() [1/2]

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator operator- ( difference_type  d) const

subtraction

◆ turnRight()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & turnRight ( )

Move to the direction that is 'right' relative to the current direction. This is equivalent to four_circulator– and eight_circulator -= 2 respectively.

◆ turnLeft()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & turnLeft ( )

Move to the direction that is 'left' relative to the current direction. This is equivalent to four_circulator++ and eight_circulator += 2 respectively.

◆ turnRound()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & turnRound ( )

Move to the opposite direction of the current direction. This is equivalent to four_circulator += 2 and eight_circulator += 4 respectively.

◆ turnTo()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & turnTo ( Direction  d)

Move to the given direction.

◆ moveCenterToNeighbor()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & moveCenterToNeighbor ( )

Move the center in the current direction. The current neighbor becomes the new center, the direction does not change.

◆ swapCenterNeighbor()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NeighborhoodCirculator & swapCenterNeighbor ( )

Exchange the center with the current neighbor. Equivalent to circ.moveCenterToNeighbor().turnRound() (but shorter and more efficient).

◆ operator==()

template<class IMAGEITERATOR , class NEIGHBORCODE >
bool operator== ( NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE > const rhs) const

equality

◆ operator!=()

template<class IMAGEITERATOR , class NEIGHBORCODE >
bool operator!= ( NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE > const rhs) const

inequality

◆ operator-() [2/2]

template<class IMAGEITERATOR , class NEIGHBORCODE >
difference_type operator- ( NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE > const rhs) const

subtraction

◆ operator*()

template<class IMAGEITERATOR , class NEIGHBORCODE >
reference operator* ( ) const

dereference

◆ operator[]()

template<class IMAGEITERATOR , class NEIGHBORCODE >
index_reference operator[] ( difference_type  d) const

index

◆ operator->()

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

member access

◆ base()

template<class IMAGEITERATOR , class NEIGHBORCODE >
base_type const & base ( ) const

Get the base iterator for the current neighbor.

◆ center()

template<class IMAGEITERATOR , class NEIGHBORCODE >
base_type center ( ) const

Get the base iterator for the center of the circulator.

◆ direction()

template<class IMAGEITERATOR , class NEIGHBORCODE >
Direction direction ( ) const

Get the current direction.

◆ directionBit()

template<class IMAGEITERATOR , class NEIGHBORCODE >
unsigned int directionBit ( ) const

Get the current direction bit.

◆ diff()

template<class IMAGEITERATOR , class NEIGHBORCODE >
NEIGHBOROFFSETCIRCULATOR::value_type const & diff ( ) const

Get the difference vector (Diff2D) from the center to the current neighbor.

◆ isDiagonal()

template<class IMAGEITERATOR , class NEIGHBORCODE >
bool isDiagonal ( ) const

Is the current neighbor a diagonal neighbor?


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