OTB  9.0.0
Orfeo Toolbox
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | List of all members
otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep > Class Template Reference

#include <otbWindowedSincInterpolateImageFunctionBase.h>

+ Inheritance diagram for otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >:
+ Collaboration diagram for otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >:

Public Types

typedef itk::SmartPointer< const SelfConstPointer
 
typedef Superclass::ContinuousIndexType ContinuousIndexType
 
typedef Superclass::FunctionType FunctionType
 
typedef Superclass::IndexType IndexType
 
typedef Superclass::InputImageType InputImageType
 
typedef Superclass::IteratorType IteratorType
 
typedef Superclass::OutputType OutputType
 
typedef itk::SmartPointer< SelfPointer
 
typedef Superclass::RealType RealType
 
typedef WindowedSincInterpolateImageFunctionBase Self
 
typedef Superclass::SizeType SizeType
 
typedef GenericInterpolateImageFunction< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep > Superclass
 
typedef std::vector< double > VectorType
 
- Public Types inherited from otb::GenericInterpolateImageFunction< TInputImage, TWindowFunction, itk::ZeroFluxNeumannBoundaryCondition< TInputImage >, double >
typedef itk::SmartPointer< const SelfConstPointer
 
typedef Superclass::ContinuousIndexType ContinuousIndexType
 
typedef TWindowFunction FunctionType
 
typedef Superclass::IndexType IndexType
 
typedef Superclass::InputImageType InputImageType
 
typedef itk::ConstNeighborhoodIterator< InputImageType, itk::ZeroFluxNeumannBoundaryCondition< TInputImage > > IteratorType
 
typedef Superclass::OutputType OutputType
 
typedef itk::SmartPointer< SelfPointer
 
typedef Superclass::RealType RealType
 
typedef GenericInterpolateImageFunction Self
 
typedef InputImageType::SizeType SizeType
 
typedef itk::InterpolateImageFunction< TInputImage, double > Superclass
 

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
virtual const char * GetNameOfClass () const
 
- Public Member Functions inherited from otb::GenericInterpolateImageFunction< TInputImage, TWindowFunction, itk::ZeroFluxNeumannBoundaryCondition< TInputImage >, double >
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
virtual const char * GetNameOfClass () const
 
OutputType EvaluateAtContinuousIndex (const ContinuousIndexType &index) const override
 
virtual void SetRadius (unsigned int rad)
 
virtual unsigned int GetRadius () const
 
virtual FunctionTypeGetFunction (void)
 
virtual void Initialize ()
 
virtual void SetNormalizeWeight (bool _arg)
 
virtual bool GetNormalizeWeight ()
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from otb::GenericInterpolateImageFunction< TInputImage, TWindowFunction, itk::ZeroFluxNeumannBoundaryCondition< TInputImage >, double >
static Pointer New ()
 

Static Public Attributes

static const unsigned int ImageDimension = Superclass::ImageDimension
 
- Static Public Attributes inherited from otb::GenericInterpolateImageFunction< TInputImage, TWindowFunction, itk::ZeroFluxNeumannBoundaryCondition< TInputImage >, double >
static const unsigned int ImageDimension
 

Protected Member Functions

void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
 WindowedSincInterpolateImageFunctionBase ()
 
 ~WindowedSincInterpolateImageFunctionBase () override
 
- Protected Member Functions inherited from otb::GenericInterpolateImageFunction< TInputImage, TWindowFunction, itk::ZeroFluxNeumannBoundaryCondition< TInputImage >, double >
 GenericInterpolateImageFunction ()
 
 ~GenericInterpolateImageFunction () override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
void Modified (void) const override
 
virtual void ResetOffsetTable ()
 
virtual void InitializeTables ()
 
virtual void FillWeightOffsetTable ()
 

Private Member Functions

void operator= (const Self &)=delete
 
 WindowedSincInterpolateImageFunctionBase (const Self &)=delete
 

Detailed Description

template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
class otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >

Use the windowed sinc function to interpolate.

THEORY

This function is intended to provide an interpolation function that has minimum aliasing artifacts, in contrast to linear interpolation. According to sampling theory, the infinite-support sinc filter, whose Fourier transform is the box filter, is optimal for resampling a function. In practice, the infinite support sinc filter is approximated using a limited support 'windowed' sinc filter. Most of those functions are inspired of the itk::WindowedSincInterpolateImageFunction source code.

This function is based on the following publication:
Erik H. W. Meijering, Wiro J. Niessen, Josien P. W. Pluim, Max A. Viergever: Quantitative Comparison of Sinc-Approximating Kernels for Medical Image Interpolation. MICCAI 1999, pp. 210-217
In this work, several 'windows' are estimated. In two dimensions, the interpolation at a position (x, y) is given by the following expression:

\[ I(x, y) = \sum_{i = \lfloor x \rfloor + 1 - m}^{\lfloor x \rfloor + m} \sum_{j = \lfloor y \rfloor + 1 - m}^{\lfloor y \rfloor + m} I_{i, j} K(x-i) K(y-j), \]

where m is the 'radius' of the window, (3, 4 are reasonable numbers), and K(t) is the kernel function, composed of the sinc function and one of several possible window functions:

\[ K(t) = w(t) \textrm{sinc}(t) = w(t) \frac{\sin(\pi t)}{\pi t} \]

Several window functions are provided here in the itk::Function namespace. The conclusions of the referenced paper suggest to use the Welch, Cosine, Kaiser, and Lanczos windows for m = 4, 5. These are based on error in rotating medical images w.r.t. the linear interpolation method. In some cases the results achieve a 20-fold improvement in accuracy.
USING THIS FILTER

Use this filter the way you would use any ImageInterpolationFunction, so for instance, you can plug it into the ResampleImageFilter class. In order to initialize the filter you must choose several template parameters.

The first (TInputImage) is the image type, that's standard.
The second (TWindowFunction) is the window function object, which you can choose from about five different functions defined in this header. The default is the Hamming window, which is commonly used but not optimal according to the cited paper.
The third (TBoundaryCondition) is the boundary condition class used to determine the values of pixels that fall off the image boundary. This class has the same meaning here as in the NeighborhoodItetator classes.
The fourth (TCoordRep) is again standard for interpolating functions, and should be float or double.
CAVEATS

There are a few improvements that an enthusiasting ITK developer could make to this filter. One issue is with the way that the kernel is applied. The computational expense comes from two sources: computing the kernel weights K(t) and multiplying the pixels in the window by the kernel weights. The first is done more or less efficiently in $ 2 m d $ operations (where d is the dimensionality of the image). The second can be done better. Presently, each pixel $ I(i, j, k) $ is multiplied by the weights $ K(x-i), K(y-j), K(z-k) $ and added to the running total. This results in $ d (2m)^d $ multiplication operations. However, by keeping intermediate sums, it would be possible to do the operation in $ O ( (2m)^d ) $ operations. This would require some creative coding. In addition, in the case when one of the coordinates is integer, the computation could be reduced by an order of magnitude.

See also
GenericInterpolatorImageFunctionBase
LinearInterpolateImageFunctionBase ResampleImageFilter
Function::HammingWindowFunction
Function::CosineWindowFunction
Function::WelchWindowFunction
Function::LanczosWindowFunction
Function::BlackmanWindowFunction

Definition at line 140 of file otbWindowedSincInterpolateImageFunctionBase.h.

Member Typedef Documentation

◆ ConstPointer

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef itk::SmartPointer<const Self> otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::ConstPointer

◆ ContinuousIndexType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::ContinuousIndexType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::ContinuousIndexType

◆ FunctionType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::FunctionType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::FunctionType

◆ IndexType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::IndexType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::IndexType

Superclass typedef inheritance.

Definition at line 164 of file otbWindowedSincInterpolateImageFunctionBase.h.

◆ InputImageType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::InputImageType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::InputImageType

Input and output images typedef definition.

Definition at line 154 of file otbWindowedSincInterpolateImageFunctionBase.h.

◆ IteratorType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::IteratorType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::IteratorType

◆ OutputType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::OutputType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::OutputType

◆ Pointer

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef itk::SmartPointer<Self> otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::Pointer

◆ RealType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::RealType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::RealType

◆ Self

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef WindowedSincInterpolateImageFunctionBase otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::Self

Standard class typedefs.

Definition at line 145 of file otbWindowedSincInterpolateImageFunctionBase.h.

◆ SizeType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::SizeType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::SizeType

◆ Superclass

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef GenericInterpolateImageFunction<TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep> otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::Superclass

◆ VectorType

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef std::vector<double> otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::VectorType

Constructor & Destructor Documentation

◆ WindowedSincInterpolateImageFunctionBase() [1/2]

template<class TInputImage , class TWindowFunction , class TBoundaryCondition , class TCoordRep >
otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::WindowedSincInterpolateImageFunctionBase
protected

Compute a resampled profil according to the window size.

Constructor

Definition at line 30 of file otbWindowedSincInterpolateImageFunctionBase.hxx.

◆ ~WindowedSincInterpolateImageFunctionBase()

template<class TInputImage , class TWindowFunction , class TBoundaryCondition , class TCoordRep >
otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::~WindowedSincInterpolateImageFunctionBase
overrideprotected

Destructor

Definition at line 36 of file otbWindowedSincInterpolateImageFunctionBase.hxx.

◆ WindowedSincInterpolateImageFunctionBase() [2/2]

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::WindowedSincInterpolateImageFunctionBase ( const Self )
privatedelete

Member Function Documentation

◆ CreateAnother()

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
virtual::itk::LightObject::Pointer otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::CreateAnother ( void  ) const

◆ GetNameOfClass()

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
virtual const char* otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

◆ New()

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
static Pointer otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::New ( )
static

Method for creation through the object factory.

◆ operator=()

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
void otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::operator= ( const Self )
privatedelete

◆ PrintSelf()

template<class TInputImage , class TWindowFunction , class TBoundaryCondition , class TCoordRep >
void otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

Member Data Documentation

◆ ImageDimension

template<class TInputImage , class TWindowFunction , class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
const unsigned int otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::ImageDimension = Superclass::ImageDimension
static

Dimension underlying input image.

Definition at line 161 of file otbWindowedSincInterpolateImageFunctionBase.h.


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