[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
![]() |
NeighborhoodCirculator [Image Iterator Adapters] |
![]() |
Circulator that walks around a given location in a given image. More...
#include <vigra/pixelneighborhood.hxx>
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 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): NeighborhoodCirculator<BImage::traverser, EightNeighborCode> circulator(ix), end(circulator); do { analysisFunc(*circulator, ...); // do sth. with current neighbor } while(++circulator != end); // compare with start/end circulator } }
typedef IMAGEITERATOR base_type |
type of the underlying image iterator
Reimplemented in RestrictedNeighborhoodCirculator.
the circulator's difference type (argument type of circ[diff]
)
Reimplemented in RestrictedNeighborhoodCirculator.
typedef NEIGHBORCODE::Direction Direction |
type of the direction code
Reimplemented in RestrictedNeighborhoodCirculator.
typedef reference index_reference |
the circulator's index reference type (return type of circ[n]
)
Reimplemented in RestrictedNeighborhoodCirculator.
the circulator tag (random_access_circulator_tag)
Reimplemented in RestrictedNeighborhoodCirculator.
typedef NEIGHBORCODE NeighborCode |
type of the used neighbor code
Reimplemented in RestrictedNeighborhoodCirculator.
typedef IMAGEITERATOR::pointer pointer |
the circulator's pointer type (return type of operator->
)
Reimplemented in RestrictedNeighborhoodCirculator.
typedef IMAGEITERATOR::reference reference |
the circulator's reference type (return type of *circ
)
Reimplemented in RestrictedNeighborhoodCirculator.
typedef IMAGEITERATOR::value_type value_type |
the circulator's value type
Reimplemented in RestrictedNeighborhoodCirculator.
NeighborhoodCirculator | ( | IMAGEITERATOR const & | center = IMAGEITERATOR() , |
|
Direction | d = NEIGHBOROFFSETCIRCULATOR::InitialDirection | |||
) |
Construct circulator with given center
pixel, pointing to the neighbor at the given direction d
.
base_type const& base | ( | ) | const |
Get the base iterator for the current neighbor.
Reimplemented in RestrictedNeighborhoodCirculator.
base_type center | ( | ) | const |
Get the base iterator for the center of the circulator.
Reimplemented in RestrictedNeighborhoodCirculator.
Diff2D const& diff | ( | ) | const |
Get the difference vector (Diff2D) from the center to the current neighbor.
Reimplemented in RestrictedNeighborhoodCirculator.
Direction direction | ( | ) | const |
Get the current direction.
Reimplemented in RestrictedNeighborhoodCirculator.
unsigned int directionBit | ( | ) | const |
Get the current direction bit.
Reimplemented in RestrictedNeighborhoodCirculator.
bool isDiagonal | ( | ) | const |
Is the current neighbor a diagonal neighbor?
Reimplemented in RestrictedNeighborhoodCirculator.
NeighborhoodCirculator& moveCenterToNeighbor | ( | ) |
Move the center in the current direction. The current neighbor becomes the new center, the direction does not change.
bool operator!= | ( | NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE > const & | rhs | ) | const |
inequality
reference operator* | ( | ) | const |
dereference
Reimplemented in RestrictedNeighborhoodCirculator.
NeighborhoodCirculator operator+ | ( | difference_type | d | ) | const |
addition
NeighborhoodCirculator operator++ | ( | int | ) |
pre-decrement
Reimplemented in RestrictedNeighborhoodCirculator.
NeighborhoodCirculator& operator++ | ( | ) |
pre-increment
Reimplemented in RestrictedNeighborhoodCirculator.
NeighborhoodCirculator& operator+= | ( | difference_type | d | ) |
add-assignment
difference_type operator- | ( | NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE > const & | rhs | ) | const |
subtraction
NeighborhoodCirculator operator- | ( | difference_type | d | ) | const |
subtraction
NeighborhoodCirculator operator-- | ( | int | ) |
post-decrement
Reimplemented in RestrictedNeighborhoodCirculator.
NeighborhoodCirculator& operator-- | ( | ) |
post-increment
Reimplemented in RestrictedNeighborhoodCirculator.
NeighborhoodCirculator& operator-= | ( | difference_type | d | ) |
subtract-assignment
pointer operator-> | ( | ) | const |
member access
Reimplemented in RestrictedNeighborhoodCirculator.
bool operator== | ( | NeighborhoodCirculator< IMAGEITERATOR, NEIGHBORCODE > const & | rhs | ) | const |
equality
index_reference operator[] | ( | difference_type | d | ) | const |
index
NeighborhoodCirculator& swapCenterNeighbor | ( | ) |
Exchange the center with the current neighbor. Equivalent to circ.moveCenterToNeighbor().turnRound()
(but shorter and more efficient).
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.
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.
NeighborhoodCirculator& turnRound | ( | ) |
Move to the opposite direction of the current direction. This is equivalent to four_circulator += 2
and eight_circulator += 4
respectively.
NeighborhoodCirculator& turnTo | ( | Direction | d | ) |
Move to the given direction.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|