ITK
4.6.0
Insight Segmentation and Registration Toolkit
|
#include <itkFlatStructuringElement.h>
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.
Definition at line 88 of file itkFlatStructuringElement.h.
Classes | |
struct | StructuringElementFacet |
Public Types | |
typedef Superclass::ConstIterator | ConstIterator |
typedef std::vector< LType > | DecompType |
typedef Superclass::Iterator | Iterator |
typedef Vector< float, VDimension > | LType |
typedef Superclass::OffsetType | OffsetType |
typedef Superclass::PixelType | PixelType |
typedef Superclass::RadiusType | RadiusType |
typedef FlatStructuringElement < VDimension > | Self |
typedef Superclass::SizeType | SizeType |
typedef Superclass::SliceIteratorType | SliceIteratorType |
typedef Neighborhood< bool, VDimension > | Superclass |
Public Types inherited from itk::Neighborhood< bool, VDimension > | |
typedef NeighborhoodAllocator < bool > | AllocatorType |
typedef AllocatorType::const_iterator | ConstIterator |
typedef unsigned int | DimensionValueType |
typedef AllocatorType::iterator | Iterator |
typedef SizeValueType | NeighborIndexType |
typedef Offset< VDimension > | OffsetType |
typedef bool | PixelType |
typedef Neighborhood | Self |
typedef SizeType::SizeValueType | SizeValueType |
typedef SliceIterator< bool, Self > | SliceIteratorType |
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 |
Static Public Attributes inherited from itk::Neighborhood< bool, VDimension > | |
static const unsigned int | NeighborhoodDimension |
Protected Member Functions | |
void | PrintSelf (std::ostream &os, Indent indent) const |
Protected Member Functions inherited from itk::Neighborhood< bool, VDimension > | |
virtual void | Allocate (NeighborIndexType i) |
virtual void | ComputeNeighborhoodOffsetTable () |
virtual void | ComputeNeighborhoodStrideTable () |
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 |
Additional Inherited Members | |
Public Attributes inherited from itk::Neighborhood< bool, VDimension > | |
typedef::itk::Size< VDimension > | RadiusType |
typedef::itk::Size< VDimension > | SizeType |
typedef Superclass::ConstIterator itk::FlatStructuringElement< VDimension >::ConstIterator |
Definition at line 102 of file itkFlatStructuringElement.h.
typedef std::vector< LType > itk::FlatStructuringElement< VDimension >::DecompType |
Definition at line 118 of file itkFlatStructuringElement.h.
|
private |
Definition at line 221 of file itkFlatStructuringElement.h.
|
private |
Definition at line 231 of file itkFlatStructuringElement.h.
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.
typedef Vector< float, VDimension > itk::FlatStructuringElement< VDimension >::LType |
Definition at line 117 of file itkFlatStructuringElement.h.
|
private |
Definition at line 228 of file itkFlatStructuringElement.h.
|
private |
Definition at line 230 of file itkFlatStructuringElement.h.
typedef Superclass::OffsetType itk::FlatStructuringElement< VDimension >::OffsetType |
Definition at line 106 of file itkFlatStructuringElement.h.
typedef Superclass::PixelType itk::FlatStructuringElement< VDimension >::PixelType |
External support for pixel type.
Definition at line 96 of file itkFlatStructuringElement.h.
typedef Superclass::RadiusType itk::FlatStructuringElement< VDimension >::RadiusType |
Radius typedef support.
Definition at line 109 of file itkFlatStructuringElement.h.
typedef FlatStructuringElement< VDimension > itk::FlatStructuringElement< VDimension >::Self |
Standard class typedefs.
Definition at line 92 of file itkFlatStructuringElement.h.
typedef Superclass::SizeType itk::FlatStructuringElement< VDimension >::SizeType |
Size and value typedef support.
Definition at line 105 of file itkFlatStructuringElement.h.
typedef Superclass::SliceIteratorType itk::FlatStructuringElement< VDimension >::SliceIteratorType |
External slice iterator type typedef support.
Definition at line 112 of file itkFlatStructuringElement.h.
typedef Neighborhood< bool, VDimension > itk::FlatStructuringElement< VDimension >::Superclass |
Definition at line 93 of file itkFlatStructuringElement.h.
|
inlinevirtual |
Default destructor.
Definition at line 121 of file itkFlatStructuringElement.h.
|
inline |
Default constructor.
Definition at line 124 of file itkFlatStructuringElement.h.
References itk::FlatStructuringElement< VDimension >::m_Decomposable, and itk::FlatStructuringElement< VDimension >::m_RadiusIsParametric.
|
inline |
Return the lines associated with the structuring element
Definition at line 177 of file itkFlatStructuringElement.h.
References itk::FlatStructuringElement< VDimension >::m_Lines.
|
static |
Create an annulus structuring element
|
static |
Create a ball structuring element
|
static |
Various constructors Create a box structuring element. The structuring element is is decomposable.
Referenced by itk::KernelImageFilter< TImage, TImage, TKernel >::MakeKernel().
bool itk::FlatStructuringElement< VDimension >::CheckParallel | ( | LType | NewVec | ) | const |
void itk::FlatStructuringElement< VDimension >::ComputeBufferFromLines | ( | ) |
Fill the buffer of the structuring element based on the lines associated to the structuring element
|
static |
Create a cross structuring element
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
inline |
Returns whether the structuring element is decomposable or not. If the structuring is decomposable, the set of lines associated with the structuring may be used by an algorithm instead of the standard buffer.
Definition at line 162 of file itkFlatStructuringElement.h.
References itk::FlatStructuringElement< VDimension >::m_Decomposable.
Referenced by itk::KernelImageFilter< TImage, TImage, TKernel >::MakeKernel().
|
inline |
Return the lines associated with the structuring element
Definition at line 173 of file itkFlatStructuringElement.h.
References itk::FlatStructuringElement< VDimension >::m_Lines.
|
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 196 of file itkFlatStructuringElement.h.
References itk::FlatStructuringElement< VDimension >::m_RadiusIsParametric.
|
static |
Create a polygon structuring element. The structuring element is is decomposable. lines is the number of elements in the decomposition
|
protectedvirtual |
Standard itk object method.
Reimplemented from itk::Neighborhood< bool, VDimension >.
|
virtual |
The RadiusIsParametric mode ensures that the area of the foreground corresponds to the radius that was specified. This defaults to "off" for backward compatibility.
|
virtual |
The RadiusIsParametric mode ensures that the area of the foreground corresponds to the radius that was specified. This defaults to "off" for backward compatibility.
|
inline |
Returns whether the structuring element is decomposable or not. If the structuring is decomposable, the set of lines associated with the structuring may be used by an algorithm instead of the standard buffer.
Definition at line 166 of file itkFlatStructuringElement.h.
References itk::FlatStructuringElement< VDimension >::m_Decomposable.
|
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 200 of file itkFlatStructuringElement.h.
References itk::FlatStructuringElement< VDimension >::m_RadiusIsParametric.
|
private |
|
private |
Definition at line 215 of file itkFlatStructuringElement.h.
Referenced by itk::FlatStructuringElement< VDimension >::AddLine(), and itk::FlatStructuringElement< VDimension >::GetLines().
|
private |
|
static |
External support for dimensionality.
Definition at line 115 of file itkFlatStructuringElement.h.