Orfeo Toolbox  3.16
itkBSplineInterpolateImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkBSplineInterpolateImageFunction.h,v $
5  Language: C++
6  Date: $Date: 2009-04-25 12:27:05 $
7  Version: $Revision: 1.24 $
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  Portions of this code are covered under the VTK copyright.
13  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
14 
15  This software is distributed WITHOUT ANY WARRANTY; without even
16  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17  PURPOSE. See the above copyright notices for more information.
18 
19 =========================================================================*/
20 #ifndef __itkBSplineInterpolateImageFunction_h
21 #define __itkBSplineInterpolateImageFunction_h
22 
23 // First make sure that the configuration is available.
24 // This line can be removed once the optimized versions
25 // gets integrated into the main directories.
26 #include "itkConfigure.h"
27 
28 #ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
30 #else
31 
32 #include <vector>
33 
36 #include "vnl/vnl_matrix.h"
37 
39 #include "itkConceptChecking.h"
40 #include "itkCovariantVector.h"
41 
42 namespace itk
43 {
77 template <
78  class TImageType,
79  class TCoordRep = double,
80  class TCoefficientType = double >
82  public InterpolateImageFunction<TImageType,TCoordRep>
83 {
84 public:
90 
93 
94 
96  itkNewMacro( Self );
97 
99  typedef typename Superclass::OutputType OutputType;
100 
102  typedef typename Superclass::InputImageType InputImageType;
103 
105  itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
106 
108  typedef typename Superclass::IndexType IndexType;
109 
111  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
112 
114  typedef typename Superclass::PointType PointType;
115 
118 
120  typedef TCoefficientType CoefficientDataType;
121  typedef Image<CoefficientDataType,
122  itkGetStaticConstMacro(ImageDimension)
124 
128 
130 
139  virtual OutputType EvaluateAtContinuousIndex(
140  const ContinuousIndexType & index ) const;
141 
143  typedef CovariantVector<OutputType,
144  itkGetStaticConstMacro(ImageDimension)
146 
147  CovariantVectorType EvaluateDerivative( const PointType & point ) const
148  {
149  ContinuousIndexType index;
150  this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
151  return ( this->EvaluateDerivativeAtContinuousIndex( index ) );
152  }
153 
154  CovariantVectorType EvaluateDerivativeAtContinuousIndex(
155  const ContinuousIndexType & x ) const;
156 
157 
160  void SetSplineOrder(unsigned int SplineOrder);
161  itkGetConstMacro(SplineOrder, int);
162 
163 
165  virtual void SetInputImage(const TImageType * inputData);
166 
167 
180  itkSetMacro( UseImageDirection, bool );
181  itkGetConstMacro( UseImageDirection, bool );
182  itkBooleanMacro( UseImageDirection );
183 
184 
185 protected:
188  void PrintSelf(std::ostream& os, Indent indent) const;
189 
190  // These are needed by the smoothing spline routine.
191  std::vector<CoefficientDataType> m_Scratch; // temp storage for processing of Coefficients
192  typename TImageType::SizeType m_DataLength; // Image size
193  unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
194 
195  typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
196 
197 private:
198  BSplineInterpolateImageFunction( const Self& ); //purposely not implemented
199  void operator=( const Self& ); //purposely not implemented
200 
202  void SetInterpolationWeights( const ContinuousIndexType & x,
203  const vnl_matrix<long> & EvaluateIndex,
204  vnl_matrix<double> & weights,
205  unsigned int splineOrder ) const;
206 
208  void SetDerivativeWeights( const ContinuousIndexType & x,
209  const vnl_matrix<long> & EvaluateIndex,
210  vnl_matrix<double> & weights,
211  unsigned int splineOrder ) const;
212 
215  void GeneratePointsToIndex( );
216 
218  void DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
219  const ContinuousIndexType & x,
220  unsigned int splineOrder ) const;
221 
224  void ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
225  unsigned int splineOrder) const;
226 
227 
228  Iterator m_CIterator; // Iterator for traversing spline coefficients.
229  unsigned long m_MaxNumberInterpolationPoints; // number of neighborhood points used for interpolation
230  std::vector<IndexType> m_PointsToIndex; // Preallocation of interpolation neighborhood indicies
231 
233 
234  // flag to take or not the image direction into account when computing the
235  // derivatives.
237 
238 };
239 
240 } // namespace itk
241 
242 #ifndef ITK_MANUAL_INSTANTIATION
244 #endif
245 
246 #endif
247 
248 #endif

Generated at Sat May 18 2013 23:32:13 for Orfeo Toolbox with doxygen 1.8.3.1