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

details NeighborCode Class Reference VIGRA

Encapsulation of direction management for the 8-neighborhood. More...

#include "vigra/pixelneighborhood.hxx"


Public Types

enum  Direction {
  Error = -1, East = 0, NorthEast, North,
  NorthWest, West, SouthWest, South,
  SouthEast, 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 (FourNeighborhood::Direction d)
Direction code (Diff2D const &diff)
bool isDiagonal (Direction code)
Diff2D const & right ()
Diff2D const & topRight ()
Diff2D const & top ()
Diff2D const & topLeft ()
Diff2D const & left ()
Diff2D const & bottomLeft ()
Diff2D const & bottom ()
Diff2D const & bottomRight ()
Diff2D const & east ()
Diff2D const & northEast ()
Diff2D const & north ()
Diff2D const & northWest ()
Diff2D const & west ()
Diff2D const & southWest ()
Diff2D const & south ()
Diff2D const & southEast ()


Detailed Description


Encapsulation of direction management for the 8-neighborhood.

This helper class allows the transformation between Freeman chain codes (East = 0, NorthEast = 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
    EightNeighborhood::NeighborCode::Direction d = EightNeighborhood::NeighborCode::East;
    EightNeighborCode::Direction d               = EightNeighborCode::East;
    EightNeighborhood::Direction d               = EightNeighborhood::East;

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

    using namespace EightNeighborhood;

    Direction d = East;

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

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


Member Enumeration Documentation


enum Direction

 

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

Enumeration values:
Error   
East   
NorthEast   
North   
NorthWest   
West   
SouthWest   
South   
SouthEast   
DirectionCount   


Member Function Documentation


Diff2D const& bottom   [inline, static]

 

Offset to the bottom neighbor


Diff2D const& bottomLeft   [inline, static]

 

Offset to the bottomLeft neighbor


Diff2D const& bottomRight   [inline, static]

 

Offset to the bottomRight 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 8-neighborhood.


Direction code FourNeighborhood::Direction    d [inline, static]

 

Transform 4-neighborhood code into 8-neighborhood code.


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    code [inline, static]

 

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


Diff2D const& left   [inline, static]

 

Offset to the left neighbor


Diff2D const& north   [inline, static]

 

Offset to the north neighbor


Diff2D const& northEast   [inline, static]

 

Offset to the northEast neighbor


Diff2D const& northWest   [inline, static]

 

Offset to the northWest 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& southEast   [inline, static]

 

Offset to the southEast neighbor


Diff2D const& southWest   [inline, static]

 

Offset to the southWest neighbor


Diff2D const& top   [inline, static]

 

Offset to the top neighbor


Diff2D const& topLeft   [inline, static]

 

Offset to the topLeft neighbor


Diff2D const& topRight   [inline, static]

 

Offset to the topRight 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)