Orfeo Toolbox  3.16
otbBSplineInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbBSplineInterpolateImageFunction_h
19 #define __otbBSplineInterpolateImageFunction_h
20 
21 #include <vector>
22 
25 #include "vnl/vnl_matrix.h"
26 
28 #include "itkConceptChecking.h"
29 #include "itkCovariantVector.h"
30 
31 namespace otb
32 {
43 template <
44  class TImageType,
45  class TCoordRep = double,
46  class TCoefficientType = double>
48  public itk::InterpolateImageFunction<TImageType, TCoordRep>
49 {
50 public:
56 
58  itkTypeMacro(BSplineInterpolateImageFunction, InterpolateImageFunction);
59 
61  itkNewMacro(Self);
62 
64  typedef typename Superclass::OutputType OutputType;
65 
68 
70  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
71 
73  typedef typename Superclass::IndexType IndexType;
74 
76  typedef typename InputImageType::RegionType RegionType;
77 
80 
82  typedef typename Superclass::PointType PointType;
83 
86 
88  typedef TCoefficientType CoefficientDataType;
90  itkGetStaticConstMacro(ImageDimension)
92 
97 
106  virtual OutputType EvaluateAtContinuousIndex(
107  const ContinuousIndexType& index) const;
108 
111  itkGetStaticConstMacro(ImageDimension)
113 
114  CovariantVectorType EvaluateDerivative(const PointType& point) const
115  {
116  ContinuousIndexType index;
117  this->GetInputImage()->TransformPhysicalPointToContinuousIndex(point, index);
118  return (this->EvaluateDerivativeAtContinuousIndex(index));
119  }
120 
121  CovariantVectorType EvaluateDerivativeAtContinuousIndex(
122  const ContinuousIndexType& x) const;
123 
126  void SetSplineOrder(unsigned int SplineOrder);
127  itkGetMacro(SplineOrder, int);
128 
130  virtual void SetInputImage(const TImageType * inputData);
131 
134  virtual void UpdateCoefficientsFilter(void);
135 
136 protected:
139  void operator =(const Self&); //purposely not implemented
140  void PrintSelf(std::ostream& os, itk::Indent indent) const;
141 
142  // These are needed by the smoothing spline routine.
143  std::vector<CoefficientDataType> m_Scratch; // temp storage for processing of Coefficients
144  typename TImageType::SizeType m_DataLength; // Image size
145  unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
146 
147  typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
148 
149 private:
150  BSplineInterpolateImageFunction(const Self &); //purposely not implemented
152  void SetInterpolationWeights(const ContinuousIndexType& x,
153  const vnl_matrix<long>& EvaluateIndex,
154  vnl_matrix<double>& weights,
155  unsigned int splineOrder) const;
156 
158  void SetDerivativeWeights(const ContinuousIndexType& x,
159  const vnl_matrix<long>& EvaluateIndex,
160  vnl_matrix<double>& weights,
161  unsigned int splineOrder) const;
162 
165  void GeneratePointsToIndex();
166 
168  void DetermineRegionOfSupport(vnl_matrix<long>& evaluateIndex,
169  const ContinuousIndexType& x,
170  unsigned int splineOrder) const;
171 
174  void ApplyMirrorBoundaryConditions(vnl_matrix<long>& evaluateIndex,
175  unsigned int splineOrder) const;
176 
177  Iterator m_CIterator; // Iterator for traversing spline coefficients.
178  unsigned long m_MaxNumberInterpolationPoints; // number of neighborhood points used for interpolation
179  std::vector<IndexType> m_PointsToIndex; // Preallocation of interpolation neighborhood indicies
180 
182 
184 
185 };
186 
187 } // namespace otb
188 
189 #ifndef OTB_MANUAL_INSTANTIATION
191 #endif
192 
193 #endif

Generated at Sun May 19 2013 00:19:28 for Orfeo Toolbox with doxygen 1.8.3.1