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

details NeighborCode Class Reference VIGRA

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

#include <vigra/pixelneighborhood.hxx>

Inheritance diagram for NeighborCode:
NeighborOffsetCirculator< EightNeighborCode >

Public Types

enum  Direction {
  Error = -1, East = 0, NorthEast, North,
  NorthWest, West, SouthWest, South,
  SouthEast, DirectionCount, CausalFirst = NorthEast, CausalLast = West,
  AntiCausalFirst = SouthWest, AntiCausalLast = East
}
 

Static Public Member Functions

static const Diff2Dbottom ()
 
static const Diff2DbottomLeft ()
 
static const Diff2DbottomRight ()
 
static Direction code (Diff2D const &diff)
 
static Direction code (FourNeighborhood::Direction d)
 
static const Diff2Ddiff (Direction code)
 
static const Diff2Ddiff (int code)
 
static int dX (Direction code)
 
static int dX (int code)
 
static int dY (Direction code)
 
static int dY (int code)
 
static const Diff2Deast ()
 
static bool isDiagonal (Direction code)
 
static const Diff2Dleft ()
 
static unsigned int nearBorderDirectionCount (AtImageBorder b)
 
static Direction nearBorderDirections (AtImageBorder b, int index)
 
static const Diff2Dnorth ()
 
static const Diff2DnorthEast ()
 
static const Diff2DnorthWest ()
 
static const Diff2DrelativeDiff (Direction fromCode, Direction toCode)
 
static const Diff2DrelativeDiff (int fromCode, int toCode)
 
static const Diff2Dright ()
 
static const Diff2Dsouth ()
 
static const Diff2DsouthEast ()
 
static const Diff2DsouthWest ()
 
static const Diff2Dtop ()
 
static const Diff2DtopLeft ()
 
static const Diff2DtopRight ()
 
static const Diff2Dwest ()
 

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:

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

using namespace EightNeighborhood;

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

◆ Direction

enum Direction

Freeman direction codes for the 8-neighborhood. East = 0, North = 1 etc. DirectionCount may be used for portable loop termination conditions. CausalFirst and CausalLast are the first and last (inclusive) neighbors in the causal neighborhood, i.e. in the set of neighbors that have already been visited when the image is traversed in scan order. AntiCausalFirst and AntiCausalLast are the opposite.

Enumerator
Error 

 

East 

 

NorthEast 

 

North 

 

NorthWest 

 

West 

 

SouthWest 

 

South 

 

SouthEast 

 

DirectionCount 

 

CausalFirst 

 

CausalLast 

 

AntiCausalFirst 

 

AntiCausalLast 

 

Member Function Documentation

◆ nearBorderDirectionCount()

static unsigned int nearBorderDirectionCount ( AtImageBorder  b)
static

The number of valid neighbors if the current center is at the image border.

◆ nearBorderDirections()

static Direction nearBorderDirections ( AtImageBorder  b,
int  index 
)
static

The valid direction codes when the center is at the image border. index must be in the range 0...nearBorderDirectionCount(b)-1.

◆ diff() [1/2]

static const Diff2D& diff ( Direction  code)
static

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

◆ diff() [2/2]

static const Diff2D& diff ( int  code)
static

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

◆ relativeDiff() [1/2]

static const Diff2D& relativeDiff ( Direction  fromCode,
Direction  toCode 
)
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.)

◆ relativeDiff() [2/2]

static const Diff2D& relativeDiff ( int  fromCode,
int  toCode 
)
static

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

◆ dX() [1/2]

static int dX ( Direction  code)
static

X-component of diff()

◆ dY() [1/2]

static int dY ( Direction  code)
static

Y-component of diff()

◆ dX() [2/2]

static int dX ( int  code)
static

X-component of diff()

◆ dY() [2/2]

static int dY ( int  code)
static

Y-component of diff()

◆ code() [1/2]

static Direction code ( FourNeighborhood::Direction  d)
static

Transform 4-neighborhood code into 8-neighborhood code.

◆ code() [2/2]

static Direction code ( Diff2D const &  diff)
static

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

◆ isDiagonal()

static bool isDiagonal ( Direction  code)
static

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

◆ right()

static const Diff2D& right ( )
static

Offset to the right neighbor

◆ topRight()

static const Diff2D& topRight ( )
static

Offset to the topRight neighbor

◆ top()

static const Diff2D& top ( )
static

Offset to the top neighbor

◆ topLeft()

static const Diff2D& topLeft ( )
static

Offset to the topLeft neighbor

◆ left()

static const Diff2D& left ( )
static

Offset to the left neighbor

◆ bottomLeft()

static const Diff2D& bottomLeft ( )
static

Offset to the bottomLeft neighbor

◆ bottom()

static const Diff2D& bottom ( )
static

Offset to the bottom neighbor

◆ bottomRight()

static const Diff2D& bottomRight ( )
static

Offset to the bottomRight neighbor

◆ east()

static const Diff2D& east ( )
static

Offset to the east neighbor

◆ northEast()

static const Diff2D& northEast ( )
static

Offset to the northEast neighbor

◆ north()

static const Diff2D& north ( )
static

Offset to the north neighbor

◆ northWest()

static const Diff2D& northWest ( )
static

Offset to the northWest neighbor

◆ west()

static const Diff2D& west ( )
static

Offset to the west neighbor

◆ southWest()

static const Diff2D& southWest ( )
static

Offset to the southWest neighbor

◆ south()

static const Diff2D& south ( )
static

Offset to the south neighbor

◆ southEast()

static const Diff2D& southEast ( )
static

Offset to the southEast neighbor


The documentation for this class was generated from the following file:
vigra::EightNeighborhood::NeighborCode::Direction
Direction
Definition: pixelneighborhood.hxx:434
vigra::EightNeighborhood::NeighborCode::East
&#160;
Definition: pixelneighborhood.hxx:436
vigra::EightNeighborhood::East
static const Direction East
Definition: pixelneighborhood.hxx:609
vigra::EightNeighborhood::Direction
NeighborCode::Direction Direction
Definition: pixelneighborhood.hxx:607

© 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.1