Orfeo Toolbox  3.16
itkWindowedSincInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkWindowedSincInterpolateImageFunction.h,v $
5  Language: C++
6  Date: $Date: 2009-10-29 11:18:58 $
7  Version: $Revision: 1.10 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkWindowedSincInterpolateImageFunction_h
18 #define __itkWindowedSincInterpolateImageFunction_h
19 
23 
24 namespace itk
25 {
26 
27 namespace Function {
28 
35 template< unsigned int VRadius,
36  class TInput=double, class TOutput=double>
38 {
39 public:
40  inline TOutput operator()( const TInput & A ) const
41  { return (TOutput) vcl_cos(A * m_Factor ); }
42 private:
44  static const double m_Factor;
45 };
46 
53 template< unsigned int VRadius,
54  class TInput=double, class TOutput=double>
56 {
57 public:
58  inline TOutput operator()( const TInput & A ) const
59  { return (TOutput) 0.54 + 0.46 * vcl_cos(A * m_Factor ); }
60 private:
62  static const double m_Factor;
63 };
64 
71 template< unsigned int VRadius,
72  class TInput=double, class TOutput=double>
74 {
75 public:
76  inline TOutput operator()( const TInput & A ) const
77  { return (TOutput) (1.0 - A * m_Factor * A); }
78 private:
80  static const double m_Factor;
81 };
82 
91 template< unsigned int VRadius,
92  class TInput=double, class TOutput=double>
94 {
95 public:
96  inline TOutput operator()( const TInput & A ) const
97  {
98  if(A == 0.0) return (TOutput) 1.0;
99  double z = m_Factor * A;
100  return (TOutput) ( vcl_sin(z) / z );
101  }
102 private:
104  static const double m_Factor;
105 };
106 
113 template< unsigned int VRadius,
114  class TInput=double, class TOutput=double>
116 {
117 public:
118  inline TOutput operator()( const TInput & A ) const
119  {
120  return (TOutput)
121  (0.42 + 0.5 * vcl_cos(A * m_Factor1) + 0.08 * vcl_cos(A * m_Factor2));
122  }
123 private:
125  static const double m_Factor1;
126 
128  static const double m_Factor2;
129 };
130 
131 } // namespace Function
132 
242 template <
243  class TInputImage,
244  unsigned int VRadius,
245  class TWindowFunction = Function::HammingWindowFunction<VRadius>,
246  class TBoundaryCondition = ConstantBoundaryCondition<TInputImage>,
247  class TCoordRep=double >
249  public InterpolateImageFunction<TInputImage, TCoordRep>
250 {
251 public:
255 
258 
262 
264  itkNewMacro(Self);
265 
267  typedef typename Superclass::OutputType OutputType;
268 
271 
273  typedef typename Superclass::RealType RealType;
274 
276  itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
277 
281 
283  typedef TInputImage ImageType;
284 
287 
288  virtual void SetInputImage(const ImageType *image);
289 
296  virtual OutputType EvaluateAtContinuousIndex(
297  const ContinuousIndexType & index ) const;
298 
299 protected:
302  void PrintSelf(std::ostream& os, Indent indent) const;
303 
304 private:
305  WindowedSincInterpolateImageFunction( const Self& ); //not implemented
306  void operator=( const Self& ); //purposely not implemented
307 
308  // Internal typedefs
310  ImageType, TBoundaryCondition> IteratorType;
311 
312  // Constant to store twice the radius
313  static const unsigned int m_WindowSize;
314 
316  TWindowFunction m_WindowFunction;
317 
320  unsigned int *m_OffsetTable;
321 
323  unsigned int m_OffsetTableSize;
324 
326  unsigned int **m_WeightOffsetTable;
327 
329  inline double Sinc(double x) const
330  {
331  double px = vnl_math::pi * x;
332  return (x == 0.0) ? 1.0 : vcl_sin(px) / px;
333  }
334 };
335 
336 } // namespace itk
337 
338 #ifndef ITK_MANUAL_INSTANTIATION
340 #endif
341 
342 #endif // _itkWindowedSincInterpolateImageFunction_h

Generated at Sun Feb 3 2013 00:15:07 for Orfeo Toolbox with doxygen 1.8.1.1