ITK  5.4.0
Insight Toolkit
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Private Attributes | List of all members
itk::GaussianOperator< TPixel, VDimension, TAllocator > Class Template Reference

#include <itkGaussianOperator.h>

Detailed Description

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
class itk::GaussianOperator< TPixel, VDimension, TAllocator >

A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel.

GaussianOperator can be used to perform Gaussian blurring by taking its inner product with a Neighborhood (NeighborhoodIterator) that is swept across an image region. It is a directional operator. N successive applications oriented along each dimensional direction will effect separable, efficient, N-D Gaussian blurring of an image region.

GaussianOperator takes two parameters:

(1) The floating-point variance of the desired Gaussian function.

(2) The "maximum error" allowed in the discrete Gaussian function. "Maximum error" is defined as the difference between the area under the discrete Gaussian curve and the area under the continuous Gaussian. Maximum error affects the Gaussian operator size. Care should be taken not to make this value too small relative to the variance lest the operator size become unreasonably large.

References: The Gaussian kernel contained in this operator was described by Tony Lindeberg (Discrete Scale-Space Theory and the Scale-Space Primal Sketch. Dissertation. Royal Institute of Technology, Stockholm, Sweden. May 1991.).

Note
GaussianOperator does not have any user-declared "special member function", following the C++ Rule of Zero: the compiler will generate them if necessary.
See also
NeighborhoodOperator
NeighborhoodIterator
Neighborhood
ITK Sphinx Examples:
Examples
Examples/Iterators/NeighborhoodIterators4.cxx, Examples/Iterators/NeighborhoodIterators5.cxx, SphinxExamples/src/Core/Common/CreateGaussianKernel/Code.cxx, and SphinxExamples/src/Core/Common/DemonstrateAllOperators/Code.cxx.

Definition at line 69 of file itkGaussianOperator.h.

+ Inheritance diagram for itk::GaussianOperator< TPixel, VDimension, TAllocator >:
+ Collaboration diagram for itk::GaussianOperator< TPixel, VDimension, TAllocator >:

Public Types

using Self = GaussianOperator
 
using Superclass = NeighborhoodOperator< TPixel, VDimension, TAllocator >
 
- Public Types inherited from itk::NeighborhoodOperator< TPixel, VDimension, TAllocator >
using PixelRealType = typename NumericTraits< TPixel >::RealType
 
using PixelType = TPixel
 
using Self = NeighborhoodOperator
 
using SizeType = itk::Size< VDimension >
 
using SliceIteratorType = SliceIterator< TPixel, Self >
 
using Superclass = Neighborhood< TPixel, VDimension, TAllocator >
 
- Public Types inherited from itk::Neighborhood< TPixel, VDimension, TAllocator >
using AllocatorType = TAllocator
 
using ConstIterator = typename AllocatorType::const_iterator
 
using DimensionValueType = unsigned int
 
using Iterator = typename AllocatorType::iterator
 
using NeighborIndexType = SizeValueType
 
using OffsetType = Offset< VDimension >
 
using PixelType = TPixel
 
using RadiusType = itk::Size< VDimension >
 
using Self = Neighborhood
 
using SizeType = itk::Size< VDimension >
 
using SizeValueType = typename SizeType::SizeValueType
 
using SliceIteratorType = SliceIterator< TPixel, Self >
 

Public Member Functions

void DebugOff () const
 
void DebugOn () const
 
bool GetDebug () const
 
double GetMaximumError ()
 
unsigned int GetMaximumKernelWidth () const
 
const char * GetNameOfClass () const override
 
double GetVariance ()
 
double ModifiedBesselI (int, double)
 
double ModifiedBesselI0 (double)
 
double ModifiedBesselI1 (double)
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
void SetDebug (bool debugFlag) const
 
void SetMaximumError (const double max_error)
 
void SetMaximumKernelWidth (unsigned int n)
 
void SetVariance (const double variance)
 
- Public Member Functions inherited from itk::NeighborhoodOperator< TPixel, VDimension, TAllocator >
virtual void CreateDirectional ()
 
virtual void CreateToRadius (const SizeType &)
 
virtual void CreateToRadius (const SizeValueType)
 
virtual void FlipAxes ()
 
unsigned long GetDirection () const
 
const char * GetNameOfClass () const override
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
void ScaleCoefficients (PixelRealType)
 
void SetDirection (const unsigned long direction)
 
- Public Member Functions inherited from itk::Neighborhood< TPixel, VDimension, TAllocator >
NeighborIndexType GetCenterNeighborhoodIndex () const
 
TPixel GetCenterValue () const
 
virtual NeighborIndexType GetNeighborhoodIndex (const OffsetType &) const
 
OffsetType GetOffset (NeighborIndexType i) const
 
const SizeType GetRadius () const
 
SizeValueType GetRadius (DimensionValueType n) const
 
SizeType GetSize () const
 
SizeValueType GetSize (DimensionValueType n) const
 
std::slice GetSlice (unsigned int) const
 
OffsetValueType GetStride (DimensionValueType axis) const
 
 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION (Self)
 
 Neighborhood ()=default
 
 Neighborhood (const Self &)=default
 
 Neighborhood (Self &&)=default
 
Selfoperator= (const Self &)=default
 
Selfoperator= (Self &&)=default
 
bool operator== (const Self &other) const
 
void Print (std::ostream &os) const
 
void SetRadius (const SizeType &)
 
void SetRadius (const SizeValueType)
 
NeighborIndexType Size () const
 
virtual ~Neighborhood ()=default
 
Iterator End ()
 
Iterator Begin ()
 
ConstIterator End () const
 
ConstIterator Begin () const
 
TPixel & operator[] (NeighborIndexType i)
 
const TPixel & operator[] (NeighborIndexType i) const
 
TPixel & GetElement (NeighborIndexType i)
 
void SetRadius (const SizeValueType *rad)
 
AllocatorTypeGetBufferReference ()
 
const AllocatorTypeGetBufferReference () const
 
TPixel & operator[] (const OffsetType &o)
 
const TPixel & operator[] (const OffsetType &o) const
 

Protected Types

using CoefficientVector = typename std::vector< PixelRealType >
 
- Protected Types inherited from itk::NeighborhoodOperator< TPixel, VDimension, TAllocator >
using CoefficientVector = typename std::vector< PixelRealType >
 

Protected Member Functions

void Fill (const CoefficientVector &coeff) override
 
CoefficientVector GenerateCoefficients () override
 
- Protected Member Functions inherited from itk::NeighborhoodOperator< TPixel, VDimension, TAllocator >
virtual void FillCenteredDirectional (const CoefficientVector &)
 
void InitializeToZero ()
 
- Protected Member Functions inherited from itk::Neighborhood< TPixel, VDimension, TAllocator >
virtual void Allocate (NeighborIndexType i)
 
virtual void ComputeNeighborhoodOffsetTable ()
 
virtual void ComputeNeighborhoodStrideTable ()
 
void SetSize ()
 

Private Attributes

bool m_Debug { false }
 
double m_MaximumError { .01 }
 
unsigned int m_MaximumKernelWidth { 30 }
 
double m_Variance { 1 }
 

Additional Inherited Members

- Static Public Attributes inherited from itk::Neighborhood< TPixel, VDimension, TAllocator >
static constexpr unsigned int NeighborhoodDimension = VDimension
 

Member Typedef Documentation

◆ CoefficientVector

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
using itk::NeighborhoodOperator< TPixel, VDimension, TAllocator >::CoefficientVector = typename std::vector<PixelRealType>
protected

Type alias support for coefficient vector type. Necessary to fix bug in the microsoft VC++ compiler.

Definition at line 147 of file itkNeighborhoodOperator.h.

◆ Self

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
using itk::GaussianOperator< TPixel, VDimension, TAllocator >::Self = GaussianOperator

Standard class type aliases.

Definition at line 74 of file itkGaussianOperator.h.

◆ Superclass

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
using itk::GaussianOperator< TPixel, VDimension, TAllocator >::Superclass = NeighborhoodOperator<TPixel, VDimension, TAllocator>

Definition at line 75 of file itkGaussianOperator.h.

Member Function Documentation

◆ DebugOff()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::DebugOff ( ) const
inline

Turn debugging output off.

Definition at line 164 of file itkGaussianOperator.h.

◆ DebugOn()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::DebugOn ( ) const
inline

Turn debugging output on.

Definition at line 157 of file itkGaussianOperator.h.

◆ Fill()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::Fill ( const CoefficientVector coeff)
inlineoverrideprotectedvirtual

Arranges coefficients spatially in the memory buffer.

Implements itk::NeighborhoodOperator< TPixel, VDimension, TAllocator >.

Definition at line 202 of file itkGaussianOperator.h.

◆ GenerateCoefficients()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
CoefficientVector itk::GaussianOperator< TPixel, VDimension, TAllocator >::GenerateCoefficients ( )
overrideprotectedvirtual

Calculates operator coefficients.

Implements itk::NeighborhoodOperator< TPixel, VDimension, TAllocator >.

◆ GetDebug()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
bool itk::GaussianOperator< TPixel, VDimension, TAllocator >::GetDebug ( ) const
inline

Get the value of the debug flag. Mimics the itk::Object interface so that itkDebugMacro can be used in selective printouts from Gaussian kernel generation.

Definition at line 150 of file itkGaussianOperator.h.

◆ GetMaximumError()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
double itk::GaussianOperator< TPixel, VDimension, TAllocator >::GetMaximumError ( )
inline

Returns the maximum error of the gaussian approximation. Maximum error is the difference between the area under the discrete Gaussian curve and the area under the continuous Gaussian. Maximum error affects the Gaussian operator size.

Definition at line 114 of file itkGaussianOperator.h.

◆ GetMaximumKernelWidth()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
unsigned int itk::GaussianOperator< TPixel, VDimension, TAllocator >::GetMaximumKernelWidth ( ) const
inline

Returns the maximum allowed kernel width.

Definition at line 131 of file itkGaussianOperator.h.

◆ GetNameOfClass()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
const char* itk::GaussianOperator< TPixel, VDimension, TAllocator >::GetNameOfClass ( ) const
overridevirtual

◆ GetVariance()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
double itk::GaussianOperator< TPixel, VDimension, TAllocator >::GetVariance ( )
inline

Returns the variance of the Gaussian (scale) for the operator.

Definition at line 104 of file itkGaussianOperator.h.

◆ ModifiedBesselI()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
double itk::GaussianOperator< TPixel, VDimension, TAllocator >::ModifiedBesselI ( int  ,
double   
)

Returns the value of the modified Bessel function Ik(x) at a point x>=0, where k>=2.

◆ ModifiedBesselI0()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
double itk::GaussianOperator< TPixel, VDimension, TAllocator >::ModifiedBesselI0 ( double  )

Returns the value of the modified Bessel function I0(x) at a point x >= 0.

◆ ModifiedBesselI1()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
double itk::GaussianOperator< TPixel, VDimension, TAllocator >::ModifiedBesselI1 ( double  )

Returns the value of the modified Bessel function I1(x) at a point x, x real.

◆ PrintSelf()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::PrintSelf ( std::ostream &  ,
Indent   
) const
inlineoverridevirtual

Standard itk object method.

Reimplemented from itk::Neighborhood< TPixel, VDimension, TAllocator >.

Definition at line 137 of file itkGaussianOperator.h.

◆ SetDebug()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::SetDebug ( bool  debugFlag) const
inline

Set the value of the debug flag. A non-zero value turns debugging on.

Definition at line 171 of file itkGaussianOperator.h.

◆ SetMaximumError()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::SetMaximumError ( const double  max_error)
inline

Sets the desired maximum error of the gaussian approximation. Maximum error is the difference between the area under the discrete Gaussian curve and the area under the continuous Gaussian. Maximum error affects the Gaussian operator size. The value must be between 0.0 and 1.0.

Definition at line 92 of file itkGaussianOperator.h.

◆ SetMaximumKernelWidth()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::SetMaximumKernelWidth ( unsigned int  n)
inline

Sets a limit for growth of the kernel. Small maximum error values with large variances will yield very large kernel sizes. This value can be used to truncate a kernel in such instances. A warning will be given on truncation of the kernel.

Definition at line 124 of file itkGaussianOperator.h.

◆ SetVariance()

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
void itk::GaussianOperator< TPixel, VDimension, TAllocator >::SetVariance ( const double  variance)
inline

Sets the desired variance of the Gaussian kernel.

Definition at line 82 of file itkGaussianOperator.h.

Member Data Documentation

◆ m_Debug

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
bool itk::GaussianOperator< TPixel, VDimension, TAllocator >::m_Debug { false }
mutableprivate

Enable/disable kernel generation debug warnings

Definition at line 221 of file itkGaussianOperator.h.

◆ m_MaximumError

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
double itk::GaussianOperator< TPixel, VDimension, TAllocator >::m_MaximumError { .01 }
private

Difference between the areas under the curves of the continuous and discrete Gaussian functions.

Definition at line 213 of file itkGaussianOperator.h.

◆ m_MaximumKernelWidth

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
unsigned int itk::GaussianOperator< TPixel, VDimension, TAllocator >::m_MaximumKernelWidth { 30 }
private

Maximum kernel size allowed. This value is used to truncate a kernel that has grown too large. A warning is given when the specified maximum error causes the kernel to exceed this size.

Definition at line 218 of file itkGaussianOperator.h.

◆ m_Variance

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
double itk::GaussianOperator< TPixel, VDimension, TAllocator >::m_Variance { 1 }
private

Desired variance of the discrete Gaussian function.

Definition at line 209 of file itkGaussianOperator.h.


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