Orfeo ToolBox  4.2
Orfeo ToolBox is not a black box
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

Use the windowed sinc function to interpolate. More...

#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 Self
ConstPointer
 
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, TBoundaryCondition, TCoordRep >
typedef itk::SmartPointer
< const Self
ConstPointer
 
typedef
Superclass::ContinuousIndexType 
ContinuousIndexType
 
typedef TWindowFunction FunctionType
 
typedef Superclass::IndexType IndexType
 
typedef Superclass::InputImageType InputImageType
 
typedef
itk::ConstNeighborhoodIterator
< InputImageType,
TBoundaryCondition > 
IteratorType
 
typedef Superclass::OutputType OutputType
 
typedef itk::SmartPointer< SelfPointer
 
typedef Superclass::RealType RealType
 
typedef
GenericInterpolateImageFunction 
Self
 
typedef InputImageType::SizeType SizeType
 
typedef
itk::InterpolateImageFunction
< TInputImage, TCoordRep > 
Superclass
 
- Public Types inherited from itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordRep >
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef ContinuousIndex
< TCoordRep,
itkGetStaticConstMacro(ImageDimension) > 
ContinuousIndexType
 
typedef TCoordRep CoordRepType
 
typedef InputImageType::IndexType IndexType
 
typedef
InputImageType::IndexValueType 
IndexValueType
 
typedef
InputImageType::ConstPointer 
InputImageConstPointer
 
typedef TInputImage InputImageType
 
typedef InputImageType::PixelType InputPixelType
 
typedef Point< TCoordRep,
TInputImage::ImageDimension > 
InputType
 
typedef NumericTraits
< TInputImage::PixelType >
::RealType 
OutputType
 
typedef NumericTraits
< TInputImage::PixelType >
::RealType 
OutputType
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< SelfPointer
 
typedef Point< TCoordRep,
itkGetStaticConstMacro(ImageDimension) > 
PointType
 
typedef FunctionBase Self
 
typedef ImageFunction Self
 
typedef Object Superclass
 
typedef FunctionBase< Point
< TCoordRep,
itkGetStaticConstMacro(ImageDimension) >
, NumericTraits
< TInputImage::PixelType >
::RealType > 
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, TBoundaryCondition, TCoordRep >
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
virtual OutputType EvaluateAtContinuousIndex (const ContinuousIndexType &index) const
 
virtual FunctionTypeGetFunction (void)
 
virtual bool GetNormalizeWeight ()
 
virtual unsigned int GetRadius () const
 
virtual void Initialize ()
 
virtual void SetNormalizeWeight (bool _arg)
 
virtual void SetRadius (unsigned int rad)
 
- Public Member Functions inherited from itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordRep >
void ConvertContinuousIndexToNearestIndex (const ContinuousIndexType &cindex, IndexType &index) const
 
void ConvertPointToContinuousIndex (const PointType &point, ContinuousIndexType &cindex) const
 
void ConvertPointToNearestIndex (const PointType &point, IndexType &index) const
 
virtual NumericTraits
< TInputImage::PixelType >
::RealType 
Evaluate (const PointType &point) const =0
 
virtual OutputType Evaluate (const InputType &input) const =0
 
virtual NumericTraits
< TInputImage::PixelType >
::RealType 
EvaluateAtIndex (const IndexType &index) const =0
 
virtual const ContinuousIndexTypeGetEndContinuousIndex () const
 
virtual const IndexTypeGetEndIndex () const
 
const InputImageTypeGetInputImage () const
 
virtual const ContinuousIndexTypeGetStartContinuousIndex () const
 
virtual const IndexTypeGetStartIndex () const
 
virtual bool IsInsideBuffer (const IndexType &index) const
 
virtual bool IsInsideBuffer (const PointType &point) const
 
virtual bool IsInsideBuffer (const ContinuousIndexType &index) const
 
virtual void SetInputImage (const InputImageType *ptr)
 
- Public Member Functions inherited from itk::FunctionBase< Point< TCoordRep, TInputImage::ImageDimension >, NumericTraits< TInputImage::PixelType >::RealType >
virtual OutputType Evaluate (const InputType &input) const =0
 

Static Public Member Functions

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

Static Public Attributes

static const unsigned int ImageDimension = Superclass::ImageDimension
 
- Static Public Attributes inherited from otb::GenericInterpolateImageFunction< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >
static const unsigned int ImageDimension
 
- Static Public Attributes inherited from itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordRep >
static const unsigned int ImageDimension
 

Protected Member Functions

 WindowedSincInterpolateImageFunctionBase ()
 
virtual ~WindowedSincInterpolateImageFunctionBase ()
 
virtual void PrintSelf (std::ostream &os, itk::Indent indent) const
 
- Protected Member Functions inherited from otb::GenericInterpolateImageFunction< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >
 GenericInterpolateImageFunction ()
 
virtual ~GenericInterpolateImageFunction ()
 
virtual void FillWeightOffsetTable ()
 
virtual void InitializeTables ()
 
virtual void Modified (void)
 
virtual void ResetOffsetTable ()
 
- Protected Member Functions inherited from itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordRep >
 ImageFunction ()
 
 ~FunctionBase ()
 
 ~ImageFunction ()
 
 FunctionBase ()
 
void PrintSelf (std::ostream &os, Indent indent) const
 

Private Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from itk::ImageFunction< TInputImage, NumericTraits< TInputImage::PixelType >::RealType, TCoordRep >
ContinuousIndexType m_EndContinuousIndex
 
IndexType m_EndIndex
 
InputImageConstPointer m_Image
 
ContinuousIndexType m_StartContinuousIndex
 
IndexType m_StartIndex
 

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 fouth (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 136 of file otbWindowedSincInterpolateImageFunctionBase.h.

Member Typedef Documentation

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
template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::ContinuousIndexType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::ContinuousIndexType
template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::FunctionType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::FunctionType
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 163 of file otbWindowedSincInterpolateImageFunctionBase.h.

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 153 of file otbWindowedSincInterpolateImageFunctionBase.h.

template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::IteratorType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::IteratorType
template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::OutputType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::OutputType
template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef itk::SmartPointer<Self> otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::Pointer
template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::RealType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::RealType
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 144 of file otbWindowedSincInterpolateImageFunctionBase.h.

template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
typedef Superclass::SizeType otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::SizeType
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
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

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 28 of file otbWindowedSincInterpolateImageFunctionBase.txx.

template<class TInputImage , class TWindowFunction , class TBoundaryCondition , class TCoordRep >
otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::~WindowedSincInterpolateImageFunctionBase ( )
protectedvirtual

Destructor

Definition at line 35 of file otbWindowedSincInterpolateImageFunctionBase.txx.

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

Member Function Documentation

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
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
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.

template<class TInputImage, class TWindowFunction, class TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<TInputImage>, class TCoordRep = double>
void otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::operator= ( const Self )
private
template<class TInputImage , class TWindowFunction , class TBoundaryCondition , class TCoordRep >
void otb::WindowedSincInterpolateImageFunctionBase< TInputImage, TWindowFunction, TBoundaryCondition, TCoordRep >::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
protectedvirtual

Member Data Documentation

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 160 of file otbWindowedSincInterpolateImageFunctionBase.h.


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