Orfeo Toolbox  4.0
itkWindowedSincInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkWindowedSincInterpolateImageFunction_h
19 #define __itkWindowedSincInterpolateImageFunction_h
20 
24 
25 namespace itk
26 {
27 namespace Function
28 {
36 template< unsigned int VRadius,
37  typename TInput = double, typename TOutput = double >
39 {
40 public:
41  inline TOutput operator()(const TInput & A) const
42  { return (TOutput)vcl_cos(A * m_Factor); }
43 
44 private:
46  static const double m_Factor;
47 };
48 
56 template< unsigned int VRadius,
57  typename TInput = double, typename TOutput = double >
59 {
60 public:
61  inline TOutput operator()(const TInput & A) const
62  { return (TOutput)0.54 + 0.46 * vcl_cos(A * m_Factor); }
63 
64 private:
66  static const double m_Factor;
67 };
68 
76 template< unsigned int VRadius,
77  typename TInput = double, typename TOutput = double >
79 {
80 public:
81  inline TOutput operator()(const TInput & A) const
82  { return (TOutput)( 1.0 - A * m_Factor * A ); }
83 
84 private:
86  static const double m_Factor;
87 };
88 
98 template< unsigned int VRadius,
99  typename TInput = double, typename TOutput = double >
101 {
102 public:
103  inline TOutput operator()(const TInput & A) const
104  {
105  if ( A == 0.0 ) { return (TOutput)1.0; }
106  double z = m_Factor * A;
107  return (TOutput)( vcl_sin(z) / z );
108  }
109 
110 private:
112  static const double m_Factor;
113 };
114 
122 template< unsigned int VRadius,
123  typename TInput = double, typename TOutput = double >
125 {
126 public:
127  inline TOutput operator()(const TInput & A) const
128  {
129  return (TOutput)
130  ( 0.42 + 0.5 * vcl_cos(A * m_Factor1) + 0.08 * vcl_cos(A * m_Factor2) );
131  }
132 
133 private:
135  static const double m_Factor1;
136 
138  static const double m_Factor2;
139 };
140 } // namespace Function
141 
252 template<
253  typename TInputImage,
254  unsigned int VRadius,
255  typename TWindowFunction = Function::HammingWindowFunction< VRadius >,
257  class TCoordRep = double >
259  public InterpolateImageFunction< TInputImage, TCoordRep >
260 {
261 public:
265 
268 
272 
274  itkNewMacro(Self);
275 
277  typedef typename Superclass::OutputType OutputType;
278 
281 
283  typedef typename Superclass::RealType RealType;
284 
286  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
287 
291 
293  typedef TInputImage ImageType;
294 
297 
298  virtual void SetInputImage(const ImageType *image);
299 
307  const ContinuousIndexType & index) const;
308 
309 protected:
312  void PrintSelf(std::ostream & os, Indent indent) const;
313 
314 private:
315  WindowedSincInterpolateImageFunction(const Self &); //not implemented
316  void operator=(const Self &); //purposely not
317  // implemented
318 
319  // Internal typedefs
321  ImageType, TBoundaryCondition > IteratorType;
322 
323  // Constant to store twice the radius
324  static const unsigned int m_WindowSize;
325 
327  TWindowFunction m_WindowFunction;
328 
331  unsigned int *m_OffsetTable;
332 
334  unsigned int m_OffsetTableSize;
335 
337  unsigned int **m_WeightOffsetTable;
338 
340  inline double Sinc(double x) const
341  {
342  double px = vnl_math::pi * x;
343 
344  return ( x == 0.0 ) ? 1.0 : vcl_sin(px) / px;
345  }
346 };
347 } // namespace itk
348 
349 #ifndef ITK_MANUAL_INSTANTIATION
351 #endif
352 
353 #endif // _itkWindowedSincInterpolateImageFunction_h

Generated at Sat Mar 8 2014 15:48:01 for Orfeo Toolbox with doxygen 1.8.3.1