Orfeo Toolbox  4.2
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Static Private Member Functions | Private Attributes | List of all members
itk::FlatStructuringElement< VDimension > Class Template Reference

A class to support a variety of flat structuring elements, including versions created by decomposition of lines. More...

#include <itkFlatStructuringElement.h>

+ Inheritance diagram for itk::FlatStructuringElement< VDimension >:
+ Collaboration diagram for itk::FlatStructuringElement< VDimension >:

Classes

struct  StructuringElementFacet
 

Public Types

typedef NeighborhoodAllocator
< bool > 
AllocatorType
 
typedef Superclass::ConstIterator ConstIterator
 
typedef std::vector< LTypeDecompType
 
typedef unsigned int DimensionValueType
 
typedef Superclass::Iterator Iterator
 
typedef Vector< float, VDimension > LType
 
typedef SizeValueType NeighborIndexType
 
typedef Superclass::OffsetType OffsetType
 
typedef Superclass::PixelType PixelType
 
typedef Superclass::RadiusType RadiusType
 
typedef FlatStructuringElement
< VDimension > 
Self
 
typedef Superclass::SizeType SizeType
 
typedef SizeType::SizeValueType SizeValueType
 
typedef
Superclass::SliceIteratorType 
SliceIteratorType
 
typedef Neighborhood< bool,
VDimension > 
Superclass
 

Public Member Functions

 FlatStructuringElement ()
 
virtual ~FlatStructuringElement ()
 
void AddLine (LType l)
 
Iterator Begin ()
 
ConstIterator Begin () const
 
bool CheckParallel (LType NewVec) const
 
void ComputeBufferFromLines ()
 
Iterator End ()
 
ConstIterator End () const
 
template<typename TStructuringElement , typename TRadius >
void GeneratePolygon (TStructuringElement &, TRadius, unsigned)
 
AllocatorTypeGetBufferReference ()
 
const AllocatorTypeGetBufferReference () const
 
NeighborIndexType GetCenterNeighborhoodIndex () const
 
bool GetCenterValue () const
 
bool GetDecomposable () const
 
bool & GetElement (NeighborIndexType i)
 
const DecompTypeGetLines () const
 
virtual NeighborIndexType GetNeighborhoodIndex (const OffsetType &) const
 
OffsetType GetOffset (NeighborIndexType i) const
 
const SizeType GetRadius () const
 
SizeValueType GetRadius (DimensionValueType n) const
 
bool GetRadiusIsParametric () const
 
SizeValueType GetSize (DimensionValueType n) const
 
SizeType GetSize () const
 
std::slice GetSlice (unsigned int) const
 
OffsetValueType GetStride (DimensionValueType axis) const
 
bool operator!= (const Self &other) const
 
bool operator== (const Self &other) const
 
bool & operator[] (NeighborIndexType i)
 
const bool & operator[] (NeighborIndexType i) const
 
bool & operator[] (const OffsetType &o)
 
const bool & operator[] (const OffsetType &o) const
 
void Print (std::ostream &os) const
 
virtual void RadiusIsParametricOff ()
 
virtual void RadiusIsParametricOn ()
 
void SetDecomposable (bool v)
 
void SetRadius (const SizeType &)
 
void SetRadius (const SizeValueType *rad)
 
void SetRadius (const SizeValueType)
 
void SetRadiusIsParametric (bool flag)
 
NeighborIndexType Size () const
 

Static Public Member Functions

static Self Annulus (RadiusType radius, unsigned int thickness=1, bool includeCenter=false, bool radiusIsParametric=false)
 
static Self Ball (RadiusType radius, bool radiusIsParametric=false)
 
static Self Box (RadiusType radius)
 
static Self Cross (RadiusType radius)
 
static Self Polygon (RadiusType radius, unsigned lines)
 

Static Public Attributes

static const unsigned int NeighborhoodDimension = VDimension
 

Protected Member Functions

virtual void Allocate (NeighborIndexType i)
 
virtual void ComputeNeighborhoodOffsetTable ()
 
virtual void ComputeNeighborhoodStrideTable ()
 
void PrintSelf (std::ostream &os, Indent indent) const
 
void SetSize ()
 

Private Types

typedef
StructuringElementFacet
< VDimension > 
FacetType
 
typedef
StructuringElementFacet< 3 > 
FacetType3
 
typedef Vector< float, 2 > LType2
 
typedef Vector< float, 3 > LType3
 

Static Private Member Functions

template<typename TStructuringElement , typename TRadius >
static void GeneratePolygon (TStructuringElement &res, TRadius radius, unsigned lines)
 
static void GeneratePolygon (itk::FlatStructuringElement< 2 > &res, itk::Size< 2 > radius, unsigned lines)
 
static void GeneratePolygon (itk::FlatStructuringElement< 3 > &res, itk::Size< 3 > radius, unsigned lines)
 

Private Attributes

bool m_Decomposable
 
DecompType m_Lines
 
bool m_RadiusIsParametric
 

Detailed Description

template<unsigned int VDimension>
class itk::FlatStructuringElement< VDimension >

A class to support a variety of flat structuring elements, including versions created by decomposition of lines.

FlatStructuringElement provides several static methods, which can be used to create a structuring element with a particular shape, size, etc. Currently, those methods enable the creation of the following structuring elements: ball, box, cross, annulus, or polygon. Polygons are available as fast approximations of balls using line decompositions. Boxes also use line decompositions.

"Flat" refers to binary as opposed to grayscale structuring elements. Flat structuring elements can be used for both binary and grayscale images.

A Neighborhood has an N-dimensional radius. The radius is defined separately for each dimension as the number of pixels that the neighborhood extends outward from the center pixel. For example, a 2D Neighborhood object with a radius of 2x3 has sides of length 5x7. However, in the case of balls and annuli, this definition is slightly different from the parametric definition of those objects. For example, an ellipse of radius 2x3 has a diameter of 4x6, not 5x7. To have a diameter of 5x7, the radius would need to increase by 0.5 in each dimension. Thus, the "radius" of the neighborhood and the "radius" of the object should be distinguished.

To accomplish this, the "ball" and "annulus" structuring elements have an optional flag called "radiusIsParametric" (off by default). Setting this flag to true will use the parametric definition of the object and will generate structuring elements with more accurate areas, which can be especially important when morphological operations are intended to remove or retain objects of particular sizes. When the mode is turned off (default), the radius is the same, but the object diameter is set to (radius*2)+1, which is the size of the neighborhood region. Thus, the original ball and annulus structuring elements have a systematic bias in the radius of +0.5 voxels in each dimension relative to the parametric definition of the radius. Thus, we recommend turning this mode on for more accurate structuring elements, but this mode is turned off by default for backward compatibility.

As an example, a 3D ball of radius 5 should have an area of 523. With this mode turned on, the number of "on" pixels is 515 (error 1.6%), but with it turned off, the area is 739 (error 41%). For a 3D annulus of radius 5 and thickness 2, the area should be 410. With this mode turned on, the area is 392 (error 4.5%), but when turned off it is 560 (error 36%). This same trend holds for balls and annuli of any radius or dimension. For more detailed experiments with this mode, please refer to the results of the test itkFlatStructuringElementTest.cxx or the wiki example.

{Morphology/FlatStructuringElement,Erode a binary image using a flat (box) structuring element} {Morphology/FlatStructuringElementRadiusIsParametric,Generate structuring elements with accurate area}

Definition at line 88 of file itkFlatStructuringElement.h.

Member Typedef Documentation

typedef NeighborhoodAllocator< bool > itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::AllocatorType
inherited

External support for allocator type.

Definition at line 62 of file itkNeighborhood.h.

template<unsigned int VDimension>
typedef Superclass::ConstIterator itk::FlatStructuringElement< VDimension >::ConstIterator

Definition at line 102 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef std::vector< LType > itk::FlatStructuringElement< VDimension >::DecompType

Definition at line 118 of file itkFlatStructuringElement.h.

typedef unsigned int itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::DimensionValueType
inherited

Type used to refer to space dimensions

Definition at line 90 of file itkNeighborhood.h.

template<unsigned int VDimension>
typedef StructuringElementFacet< VDimension > itk::FlatStructuringElement< VDimension >::FacetType
private

Definition at line 218 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef StructuringElementFacet< 3 > itk::FlatStructuringElement< VDimension >::FacetType3
private

Definition at line 228 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Superclass::Iterator itk::FlatStructuringElement< VDimension >::Iterator

Iterator typedef support. Note the naming is intentional, i.e., AllocatorType::iterator and AllocatorType::const_iterator, because the allocator may be a vnl object or other type, which uses this form.

Definition at line 101 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Vector< float, VDimension > itk::FlatStructuringElement< VDimension >::LType

Definition at line 117 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Vector< float, 2 > itk::FlatStructuringElement< VDimension >::LType2
private

Definition at line 225 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Vector< float, 3 > itk::FlatStructuringElement< VDimension >::LType3
private

Definition at line 227 of file itkFlatStructuringElement.h.

typedef SizeValueType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::NeighborIndexType
inherited

Type used to refer to the elements of the pixel list that are part of the neighborhood.

Definition at line 94 of file itkNeighborhood.h.

template<unsigned int VDimension>
typedef Superclass::OffsetType itk::FlatStructuringElement< VDimension >::OffsetType

Definition at line 106 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Superclass::PixelType itk::FlatStructuringElement< VDimension >::PixelType

External support for pixel type.

Definition at line 96 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Superclass::RadiusType itk::FlatStructuringElement< VDimension >::RadiusType

Radius typedef support.

Definition at line 109 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef FlatStructuringElement< VDimension > itk::FlatStructuringElement< VDimension >::Self

Standard class typedefs.

Definition at line 92 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Superclass::SizeType itk::FlatStructuringElement< VDimension >::SizeType

Size and value typedef support.

Definition at line 105 of file itkFlatStructuringElement.h.

typedef SizeType::SizeValueType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::SizeValueType
inherited

Definition at line 78 of file itkNeighborhood.h.

template<unsigned int VDimension>
typedef Superclass::SliceIteratorType itk::FlatStructuringElement< VDimension >::SliceIteratorType

External slice iterator type typedef support.

Definition at line 112 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
typedef Neighborhood< bool, VDimension > itk::FlatStructuringElement< VDimension >::Superclass

Definition at line 93 of file itkFlatStructuringElement.h.

Constructor & Destructor Documentation

template<unsigned int VDimension>
virtual itk::FlatStructuringElement< VDimension >::~FlatStructuringElement ( )
inlinevirtual

Default destructor.

Definition at line 121 of file itkFlatStructuringElement.h.

template<unsigned int VDimension>
itk::FlatStructuringElement< VDimension >::FlatStructuringElement ( )
inline

Member Function Documentation

template<unsigned int VDimension>
void itk::FlatStructuringElement< VDimension >::AddLine ( LType  l)
inline
virtual void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::Allocate ( NeighborIndexType  i)
inlineprotectedvirtualinherited

Allocates the neighborhood's memory buffer.

Definition at line 244 of file itkNeighborhood.h.

template<unsigned int NDimension>
FlatStructuringElement< NDimension > itk::FlatStructuringElement< NDimension >::Annulus ( RadiusType  radius,
unsigned int  thickness = 1,
bool  includeCenter = false,
bool  radiusIsParametric = false 
)
static
template<unsigned int VDimension>
FlatStructuringElement< VDimension > itk::FlatStructuringElement< VDimension >::Ball ( RadiusType  radius,
bool  radiusIsParametric = false 
)
static
Iterator itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::Begin ( void  )
inlineinherited

Definition at line 160 of file itkNeighborhood.h.

ConstIterator itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::Begin ( void  ) const
inlineinherited

Definition at line 164 of file itkNeighborhood.h.

template<unsigned int VDimension>
FlatStructuringElement< VDimension > itk::FlatStructuringElement< VDimension >::Box ( RadiusType  radius)
static
template<unsigned int VDimension>
bool itk::FlatStructuringElement< VDimension >::CheckParallel ( LType  NewVec) const
template<unsigned int VDimension>
void itk::FlatStructuringElement< VDimension >::ComputeBufferFromLines ( )
virtual void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::ComputeNeighborhoodOffsetTable ( )
protectedvirtualinherited

Fills entries into the offset lookup table. Called once on initialization.

virtual void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::ComputeNeighborhoodStrideTable ( )
protectedvirtualinherited

Computes the entries for the stride table

template<unsigned int VDimension>
FlatStructuringElement< VDimension > itk::FlatStructuringElement< VDimension >::Cross ( RadiusType  radius)
static
Iterator itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::End ( void  )
inlineinherited

STL-style iterator support.

Definition at line 158 of file itkNeighborhood.h.

ConstIterator itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::End ( void  ) const
inlineinherited

Definition at line 162 of file itkNeighborhood.h.

template<unsigned int VDimension>
template<typename TStructuringElement , typename TRadius >
void itk::FlatStructuringElement< VDimension >::GeneratePolygon ( TStructuringElement &  ,
TRadius  ,
unsigned   
)

Definition at line 59 of file itkFlatStructuringElement.hxx.

template<unsigned int VDimension>
template<typename TStructuringElement , typename TRadius >
static void itk::FlatStructuringElement< VDimension >::GeneratePolygon ( TStructuringElement &  res,
TRadius  radius,
unsigned  lines 
)
staticprivate
template<unsigned int VDimension>
void itk::FlatStructuringElement< VDimension >::GeneratePolygon ( itk::FlatStructuringElement< 2 > &  res,
itk::Size< 2 >  radius,
unsigned  lines 
)
staticprivate
template<unsigned int VDimension>
void itk::FlatStructuringElement< VDimension >::GeneratePolygon ( itk::FlatStructuringElement< 3 > &  res,
itk::Size< 3 >  radius,
unsigned  lines 
)
staticprivate
AllocatorType& itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetBufferReference ( )
inlineinherited

Returns a reference to the data buffer structure.

Definition at line 208 of file itkNeighborhood.h.

const AllocatorType& itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetBufferReference ( ) const
inlineinherited

Definition at line 210 of file itkNeighborhood.h.

NeighborIndexType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetCenterNeighborhoodIndex ( ) const
inlineinherited

Definition at line 226 of file itkNeighborhood.h.

bool itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetCenterValue ( ) const
inlineinherited

Returns the element at the center of the neighborhood.

Definition at line 180 of file itkNeighborhood.h.

template<unsigned int VDimension>
bool itk::FlatStructuringElement< VDimension >::GetDecomposable ( ) const
inline
bool & itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetElement ( NeighborIndexType  i)
inlineinherited

Definition at line 176 of file itkNeighborhood.h.

template<unsigned int VDimension>
const DecompType& itk::FlatStructuringElement< VDimension >::GetLines ( ) const
inline

Return the lines associated with the structuring element

Definition at line 172 of file itkFlatStructuringElement.h.

References itk::FlatStructuringElement< VDimension >::m_Lines.

virtual NeighborIndexType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetNeighborhoodIndex ( const OffsetType ) const
virtualinherited
OffsetType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetOffset ( NeighborIndexType  i) const
inlineinherited

Returns the itk::Offset from the center of the Neighborhood to the requested neighbor index.

Definition at line 221 of file itkNeighborhood.h.

const SizeType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetRadius ( void  ) const
inlineinherited

Returns the radius of the neighborhood.

Definition at line 134 of file itkNeighborhood.h.

SizeValueType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetRadius ( DimensionValueType  n) const
inlineinherited

Returns the radius of the neighborhood along a specified dimension.

Definition at line 139 of file itkNeighborhood.h.

template<unsigned int VDimension>
bool itk::FlatStructuringElement< VDimension >::GetRadiusIsParametric ( ) const
inline

The RadiusIsParametric mode ensures that the area of the foreground corresponds to the radius that was specified. This defaults to "off" for backward compatibility.

Definition at line 194 of file itkFlatStructuringElement.h.

References itk::FlatStructuringElement< VDimension >::m_RadiusIsParametric.

Referenced by itk::FlatStructuringElement< VDimension >::Annulus(), and itk::FlatStructuringElement< VDimension >::Ball().

SizeValueType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetSize ( DimensionValueType  n) const
inlineinherited

Returns the size (total length) of the neighborhood along a specified dimension.

Definition at line 144 of file itkNeighborhood.h.

SizeType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetSize ( void  ) const
inlineinherited

Returns the size (total length of sides) of the neighborhood.

Definition at line 148 of file itkNeighborhood.h.

std::slice itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetSlice ( unsigned  int) const
inherited
OffsetValueType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::GetStride ( DimensionValueType  axis) const
inlineinherited

Returns the stride length for the specified dimension. Stride length is the number of pixels between adjacent pixels along the given dimension.

Definition at line 154 of file itkNeighborhood.h.

bool itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::operator!= ( const Self other) const
inlineinherited

Not Equal operator.

Definition at line 126 of file itkNeighborhood.h.

bool itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::operator== ( const Self other) const
inlineinherited

Comparison operator.

Definition at line 118 of file itkNeighborhood.h.

bool & itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::operator[] ( NeighborIndexType  i)
inlineinherited

Pass-through data access methods to the buffer.

Definition at line 172 of file itkNeighborhood.h.

const bool & itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::operator[] ( NeighborIndexType  i) const
inlineinherited

Definition at line 174 of file itkNeighborhood.h.

bool & itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::operator[] ( const OffsetType o)
inlineinherited

Get pixel value by offset

Definition at line 214 of file itkNeighborhood.h.

const bool & itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::operator[] ( const OffsetType o) const
inlineinherited

Definition at line 216 of file itkNeighborhood.h.

template<unsigned int NDimension>
FlatStructuringElement< NDimension > itk::FlatStructuringElement< NDimension >::Polygon ( RadiusType  radius,
unsigned  lines 
)
static

Create a polygon structuring element. The structuring element is is decomposable. lines is the number of elements in the decomposition

Definition at line 48 of file itkFlatStructuringElement.hxx.

void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::Print ( std::ostream &  os) const
inlineinherited

Standard itk object method.

Definition at line 204 of file itkNeighborhood.h.

template<unsigned int VDimension>
void itk::FlatStructuringElement< VDimension >::PrintSelf ( std::ostream &  ,
Indent   
) const
protectedvirtual

Standard itk object method.

Reimplemented from itk::Neighborhood< bool, VDimension >.

Definition at line 936 of file itkFlatStructuringElement.hxx.

template<unsigned int VDimension>
virtual void itk::FlatStructuringElement< VDimension >::RadiusIsParametricOff ( )
virtual
template<unsigned int VDimension>
virtual void itk::FlatStructuringElement< VDimension >::RadiusIsParametricOn ( )
virtual
template<unsigned int VDimension>
void itk::FlatStructuringElement< VDimension >::SetDecomposable ( bool  v)
inline
void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::SetRadius ( const SizeType &  )
inherited

Sets the radius for the neighborhood, calculates size from the radius, and allocates storage.

Referenced by itk::FlatStructuringElement< VDimension >::GeneratePolygon().

void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::SetRadius ( const SizeValueType rad)
inlineinherited

Sets the radius for the neighborhood. Overloaded to support an unsigned long array.

Definition at line 189 of file itkNeighborhood.h.

void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::SetRadius ( const SizeValueType  )
inherited

Overloads SetRadius to allow a single long integer argument that is used as the radius of all the dimensions of the Neighborhood (resulting in a "square" neighborhood).

template<unsigned int VDimension>
void itk::FlatStructuringElement< VDimension >::SetRadiusIsParametric ( bool  flag)
inline
void itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::SetSize ( )
inlineprotectedinherited

Sets the length along each dimension.

Definition at line 235 of file itkNeighborhood.h.

NeighborIndexType itk::Neighborhood< bool , VDimension, NeighborhoodAllocator< bool > >::Size ( void  ) const
inlineinherited

More STL-style support.

Definition at line 168 of file itkNeighborhood.h.

Member Data Documentation

template<unsigned int VDimension>
bool itk::FlatStructuringElement< VDimension >::m_Decomposable
private
template<unsigned int VDimension>
DecompType itk::FlatStructuringElement< VDimension >::m_Lines
private
template<unsigned int VDimension>
bool itk::FlatStructuringElement< VDimension >::m_RadiusIsParametric
private
template<unsigned int VDimension>
const unsigned int itk::FlatStructuringElement< VDimension >::NeighborhoodDimension = VDimension
static

External support for dimensionality.

Definition at line 115 of file itkFlatStructuringElement.h.


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

Generated at Sat Aug 30 2014 17:11:45 for Orfeo Toolbox with doxygen 1.8.3.1