iRoCS Toolbox  1.1.0
Public Types | Public Member Functions
atb::Neighborhood< Dim > Class Template Reference

The Neighborhood class specifies local pixel/voxel neighborhoods. More...

#include "libArrayToolbox/Neighborhood.hh"

Collaboration diagram for atb::Neighborhood< Dim >:

Public Types

typedef NeighborSet::const_iterator const_iterator
 
typedef std::set< blitz::TinyVector< BlitzIndexT, Dim >, TinyVectorLessThan< BlitzIndexT, Dim > > NeighborSet
 
enum  Type { Simple, Complex, User }
 Neighborhood.hh "libArrayToolbox/Neighborhood.hh". More...
 

Public Member Functions

 Neighborhood (Type nhoodType=Simple)
 Default constructor. More...
 
 Neighborhood (NeighborSet const &neighbors)
 Creation of a user-defined neighborhood with the given neighbors. More...
 
 Neighborhood (std::vector< blitz::TinyVector< BlitzIndexT, Dim > > const &neighbors)
 Creation of a user-defined neighborhood with the given neighbors. More...
 
 Neighborhood (Neighborhood< Dim > const &nhood)
 Copy constructor. More...
 
 ~Neighborhood ()
 Destructor. More...
 
const_iterator begin () const
 Get an iterator to the beginning of the Neighborhood. More...
 
void clear ()
 Remove all neighbors from this Neighborhood. More...
 
const_iterator end () const
 Get an iterator one element past the end of this Neighborhood. More...
 
void erase (blitz::TinyVector< BlitzIndexT, Dim > const &neighbor)
 Erase the given neighbor from the Neighborhood. More...
 
void insert (blitz::TinyVector< BlitzIndexT, Dim > const &neighbor)
 Insert a new neighbor into this Neighborhood. More...
 
NeighborSet const & neighbors () const
 Get read-only access to the neighbor set. More...
 
Neighborhood< Dim > & operator= (Neighborhood< Dim > const &nhood)
 Copy assignment operator. More...
 
void setNeighbors (NeighborSet const &nhood)
 Set the neighbors within this Neighborhood to the ones provided. More...
 
void setNeighbors (std::vector< blitz::TinyVector< BlitzIndexT, Dim > > const &nhood)
 Set the neighbors within this Neighborhood to the ones provided. More...
 
size_t size () const
 Get the number of neighbors this Neighborhood contains. More...
 
Type type () const
 Get the type of this Neighborhood. More...
 

Detailed Description

template<int Dim>
class atb::Neighborhood< Dim >

The Neighborhood class specifies local pixel/voxel neighborhoods.

These neighborhoods are needed in different local filter operations or algorithms that operate on local neighborhoods, like i.e. the Dijkstra algorithm. A neighborhood specifies a stencil containing neighbor locations relative to the central pixel, so e.g. a 2D 4-neighborhood consists of the points $(-1,0), (1, 0), (0, -1), (0, 1)$.

See also
Dijkstra

Definition at line 92 of file Neighborhood.hh.

Member Typedef Documentation

◆ NeighborSet

template<int Dim>
typedef std::set< blitz::TinyVector<BlitzIndexT,Dim>, TinyVectorLessThan<BlitzIndexT,Dim> > atb::Neighborhood< Dim >::NeighborSet

Definition at line 119 of file Neighborhood.hh.

◆ const_iterator

template<int Dim>
typedef NeighborSet::const_iterator atb::Neighborhood< Dim >::const_iterator

Definition at line 121 of file Neighborhood.hh.

Member Enumeration Documentation

◆ Type

template<int Dim>
enum atb::Neighborhood::Type

Neighborhood.hh "libArrayToolbox/Neighborhood.hh".

The Type enum contains the different Neighborhood type names.

  • Simple Only pixels connected by faces of dimension Dim - 1 are included into the neighborhood (i.e. 2D = 4-neighborhood, 3D = 6-neighborhood)
  • Complex All voxels that touch the central pixel in at least one point are included in the neighborhood (i.e. 2D = 8-neighborhood, 3D = 26-neighborhood)
  • User All other neighborhoods are user defined neighborhoods. This is the case for all neighborhoods created using the constructor taking point vectors, if the points are set using the setNeighbors function or if the neighborhood is altered using clear, push_back or erase.
Enumerator
Simple 
Complex 
User 

Definition at line 115 of file Neighborhood.hh.

Constructor & Destructor Documentation

◆ Neighborhood() [1/4]

template<int Dim>
atb::Neighborhood< Dim >::Neighborhood ( Type  nhoodType = Simple)

Default constructor.

Parameters
nhoodTypeThe type of the neighborhood to create. If you pass User an empty Neighborhood is created.

◆ Neighborhood() [2/4]

template<int Dim>
atb::Neighborhood< Dim >::Neighborhood ( NeighborSet const &  neighbors)

Creation of a user-defined neighborhood with the given neighbors.

Parameters
neighborsThe positions of the neighbors of the current pixel. They need not be adjacent to the central pixel and they need not describe a compact region.

◆ Neighborhood() [3/4]

template<int Dim>
atb::Neighborhood< Dim >::Neighborhood ( std::vector< blitz::TinyVector< BlitzIndexT, Dim > > const &  neighbors)

Creation of a user-defined neighborhood with the given neighbors.

If neighbors appear multiple times, the duplicates will be removed.

Parameters
neighborsThe positions of the neighbors of the current pixel. They need not be adjacent to the central pixel and they need not describe a compact region.

◆ Neighborhood() [4/4]

template<int Dim>
atb::Neighborhood< Dim >::Neighborhood ( Neighborhood< Dim > const &  nhood)

Copy constructor.

Parameters
nhoodThe Neighborhood to copy.

◆ ~Neighborhood()

template<int Dim>
atb::Neighborhood< Dim >::~Neighborhood ( )

Destructor.

Member Function Documentation

◆ operator=()

template<int Dim>
Neighborhood<Dim>& atb::Neighborhood< Dim >::operator= ( Neighborhood< Dim > const &  nhood)

Copy assignment operator.

Sets the neighborhood to the neighborhood given.

Parameters
nhoodThe neighborhood to copy.
Returns
A reference to this Neighborhood for operator chaining

◆ type()

template<int Dim>
Type atb::Neighborhood< Dim >::type ( ) const

Get the type of this Neighborhood.

Any modification of the Neighborhood after creation will set the NeighborhoodType to User, even if the changes are undone again.

Returns
The NeighborhoodType enum value corresponding to this Neighborhood

◆ size()

template<int Dim>
size_t atb::Neighborhood< Dim >::size ( ) const

Get the number of neighbors this Neighborhood contains.

Returns
The number of neighbors in the Neighborhood

◆ neighbors()

template<int Dim>
NeighborSet const& atb::Neighborhood< Dim >::neighbors ( ) const

Get read-only access to the neighbor set.

Returns
The neighbor set of this Neighborhood.

◆ clear()

template<int Dim>
void atb::Neighborhood< Dim >::clear ( )

Remove all neighbors from this Neighborhood.

◆ insert()

template<int Dim>
void atb::Neighborhood< Dim >::insert ( blitz::TinyVector< BlitzIndexT, Dim > const &  neighbor)

Insert a new neighbor into this Neighborhood.

If the neighbor is already contained in the Neighborhood it won't be changed.

Parameters
neighborThe neighbor position to insert.

◆ erase()

template<int Dim>
void atb::Neighborhood< Dim >::erase ( blitz::TinyVector< BlitzIndexT, Dim > const &  neighbor)

Erase the given neighbor from the Neighborhood.

If the neighbor is not contained in the Neighborhood it is unaltered.

Parameters
neighborThe neighbor position to remove.

◆ setNeighbors() [1/2]

template<int Dim>
void atb::Neighborhood< Dim >::setNeighbors ( NeighborSet const &  nhood)

Set the neighbors within this Neighborhood to the ones provided.

Parameters
nhoodThe neighbor position vector.

◆ setNeighbors() [2/2]

template<int Dim>
void atb::Neighborhood< Dim >::setNeighbors ( std::vector< blitz::TinyVector< BlitzIndexT, Dim > > const &  nhood)

Set the neighbors within this Neighborhood to the ones provided.

If neighbors appear multiple times the duplicates will be removed.

Parameters
nhoodThe neighbor position vector.

◆ begin()

template<int Dim>
const_iterator atb::Neighborhood< Dim >::begin ( ) const

Get an iterator to the beginning of the Neighborhood.

Returns
A NeighborhoodSet iterator pointing to the first neighbor of this Neighborhood

◆ end()

template<int Dim>
const_iterator atb::Neighborhood< Dim >::end ( ) const

Get an iterator one element past the end of this Neighborhood.

Returns
A NeighborhoodSet iterator pointing behind the last neighbor of this Neighborhood

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