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

details NeighborCode Class Reference VIGRA

Encapsulation of direction management for 4-neighborhood. More...

#include "vigra/pixelneighborhood.hxx"


Public Types

enum  Direction {
  Error = -1, East = 0, North, West,
  South, DirectionCount
}

Static Public Methods

Diff2D const & diff (Direction code)
Diff2D const & diff (int code)
Diff2D const & relativeDiff (Direction fromCode, Direction toCode)
Diff2D const & relativeDiff (int fromCode, int toCode)
int dX (Direction code)
int dY (Direction code)
int dX (int code)
int dY (int code)
Direction code (Diff2D const &diff)
bool isDiagonal (Direction)
Diff2D const & right ()
Diff2D const & top ()
Diff2D const & left ()
Diff2D const & bottom ()
Diff2D const & east ()
Diff2D const & north ()
Diff2D const & west ()
Diff2D const & south ()


Detailed Description


Encapsulation of direction management for 4-neighborhood.

This helper class allows the transformation between Freeman chain codes (East = 0, North = 1 etc.) and the corresponding Diff2D instances and back.

You can either use the chain codes by explicit qualification:

    // the following three lines are equivalent
    FourNeighborhood::NeighborCode::Direction d = FourNeighborhood::NeighborCode::East;
    FourNeighborCode::Direction d = FourNeighborCode::East;
    FourNeighborhood::Direction d = FourNeighborhood::East;

or you can fix 4-neighborhood by importing the entire namespace in your function:

    using namespace FourNeighborhood;

    Direction d = East;

If you want to pass 4-neighborhood codes as a template parameter, use the class FourNeighborhood::NeighborCode.

#include "vigra/pixelneighborhood.hxx"
Namespace: vigra::FourNeighborhood


Member Enumeration Documentation


enum Direction

 

Freeman direction codes for 4-neighborhood. East = 0, North = 1 etc. DirectionCount may be used for portable loop termination conditions.

Enumeration values:
Error   
East   
North   
West   
South   
DirectionCount   


Member Function Documentation


Diff2D const& bottom   [inline, static]

 

Offset to the bottom neighbor


Direction code Diff2D const &    diff [inline, static]

 

Transform Diff2D offset into corresponding direction code. The code Direction::Error will be returned if diff is not in the 4-neighborhood.


Diff2D const& diff int    code [inline, static]

 

Equivalent to diff(static_cast<Direction>(code)). (note: there is no bounds checking on the code you pass.)


Diff2D const& diff Direction    code [inline, static]

 

Transform direction code into corresponding Diff2D offset. (note: there is no bounds checking on the code you pass.)


int dX int    code [inline, static]

 

X-component of diff()


int dX Direction    code [inline, static]

 

X-component of diff()


int dY int    code [inline, static]

 

Y-component of diff()


int dY Direction    code [inline, static]

 

Y-component of diff()


Diff2D const& east   [inline, static]

 

Offset to the east neighbor


bool isDiagonal Direction    [inline, static]

 

Check whether a code refers to a diagonal direction. Useful if you want to abstract the differences between 4- and 8-neighborhood. Always false for 4-neighborhood.


Diff2D const& left   [inline, static]

 

Offset to the left neighbor


Diff2D const& north   [inline, static]

 

Offset to the north neighbor


Diff2D const& relativeDiff int    fromCode,
int    toCode
[inline, static]

 

Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)). (note: there is no bounds checking on the code you pass.)


Diff2D const& relativeDiff Direction    fromCode,
Direction    toCode
[inline, static]

 

Get the relative offset from one neighbor to the other. For example, relativeDiff(East, West) == Diff2D(-2,0). (note: there is no bounds checking on the code you pass.)


Diff2D const& right   [inline, static]

 

Offset to the right neighbor


Diff2D const& south   [inline, static]

 

Offset to the south neighbor


Diff2D const& top   [inline, static]

 

Offset to the top neighbor


Diff2D const& west   [inline, static]

 

Offset to the west neighbor


The documentation for this class was generated from the following file:

© Ullrich Köthe (koethe@informatik.uni-hamburg.de)
Cognitive Systems Group, University of Hamburg, Germany

html generated using doxygen and Python
VIGRA 1.3.2 (27 Jan 2005)