iRoCS Toolbox
1.1.0
|
The Neighborhood class specifies local pixel/voxel neighborhoods. More...
#include "libArrayToolbox/Neighborhood.hh"
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... | |
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 .
Definition at line 92 of file Neighborhood.hh.
typedef std::set< blitz::TinyVector<BlitzIndexT,Dim>, TinyVectorLessThan<BlitzIndexT,Dim> > atb::Neighborhood< Dim >::NeighborSet |
Definition at line 119 of file Neighborhood.hh.
typedef NeighborSet::const_iterator atb::Neighborhood< Dim >::const_iterator |
Definition at line 121 of file Neighborhood.hh.
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.
atb::Neighborhood< Dim >::Neighborhood | ( | Type | nhoodType = Simple | ) |
Default constructor.
nhoodType | The type of the neighborhood to create. If you pass User an empty Neighborhood is created. |
atb::Neighborhood< Dim >::Neighborhood | ( | NeighborSet const & | neighbors | ) |
Creation of a user-defined neighborhood with the given neighbors.
neighbors | The 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. |
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.
neighbors | The 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. |
atb::Neighborhood< Dim >::Neighborhood | ( | Neighborhood< Dim > const & | nhood | ) |
Copy constructor.
nhood | The Neighborhood to copy. |
atb::Neighborhood< Dim >::~Neighborhood | ( | ) |
Destructor.
Neighborhood<Dim>& atb::Neighborhood< Dim >::operator= | ( | Neighborhood< Dim > const & | nhood | ) |
Copy assignment operator.
Sets the neighborhood to the neighborhood given.
nhood | The neighborhood to copy. |
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.
size_t atb::Neighborhood< Dim >::size | ( | ) | const |
Get the number of neighbors this Neighborhood contains.
NeighborSet const& atb::Neighborhood< Dim >::neighbors | ( | ) | const |
Get read-only access to the neighbor set.
void atb::Neighborhood< Dim >::clear | ( | ) |
Remove all neighbors from this Neighborhood.
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.
neighbor | The neighbor position to insert. |
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.
neighbor | The neighbor position to remove. |
void atb::Neighborhood< Dim >::setNeighbors | ( | NeighborSet const & | nhood | ) |
Set the neighbors within this Neighborhood to the ones provided.
nhood | The neighbor position vector. |
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.
nhood | The neighbor position vector. |
const_iterator atb::Neighborhood< Dim >::begin | ( | ) | const |
Get an iterator to the beginning of the Neighborhood.
const_iterator atb::Neighborhood< Dim >::end | ( | ) | const |
Get an iterator one element past the end of this Neighborhood.