go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkReducedDimensionBSplineInterpolateImageFunction.h
Go to the documentation of this file.
1 /*======================================================================
2 
3  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 /*=========================================================================
16 
17  Program: Insight Segmentation & Registration Toolkit
18  Module: $RCSfile: itkReducedDimBSplineInterpolateImageFunction.h,v $
19  Language: C++
20  Date: $Date: 2009-04-25 12:27:05 $
21  Version: $Revision: 1.24 $
22 
23  Copyright (c) Insight Software Consortium. All rights reserved.
24  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
25 
26  Portions of this code are covered under the VTK copyright.
27  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
28 
29  This software is distributed WITHOUT ANY WARRANTY; without even
30  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
31  PURPOSE. See the above copyright notices for more information.
32 
33 =========================================================================*/
34 #ifndef __itkReducedDimensionBSplineInterpolateImageFunction_h
35 #define __itkReducedDimensionBSplineInterpolateImageFunction_h
36 
37 #include <vector>
38 
39 #include "itkImageLinearIteratorWithIndex.h"
40 #include "itkInterpolateImageFunction.h"
41 #include "vnl/vnl_matrix.h"
42 
44 #include "itkConceptChecking.h"
45 #include "itkCovariantVector.h"
46 
47 namespace itk
48 {
83 template <
84  class TImageType,
85  class TCoordRep = double,
86  class TCoefficientType = double >
88  public InterpolateImageFunction<TImageType,TCoordRep>
89 {
90 public:
93  typedef InterpolateImageFunction<TImageType,TCoordRep> Superclass;
94  typedef SmartPointer<Self> Pointer;
95  typedef SmartPointer<const Self> ConstPointer;
96 
98  itkTypeMacro(ReducedDimensionBSplineInterpolateImageFunction, InterpolateImageFunction);
99 
100 
102  itkNewMacro( Self );
103 
105  typedef typename Superclass::OutputType OutputType;
106 
108  typedef typename Superclass::InputImageType InputImageType;
109 
111  itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
112 
114  typedef typename Superclass::IndexType IndexType;
115 
117  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
118 
120  typedef typename Superclass::PointType PointType;
121 
123  typedef ImageLinearIteratorWithIndex<TImageType> Iterator;
124 
126  typedef TCoefficientType CoefficientDataType;
127  typedef Image<CoefficientDataType,
128  itkGetStaticConstMacro(ImageDimension)
130 
134 
136 
145  virtual OutputType EvaluateAtContinuousIndex(
146  const ContinuousIndexType & index ) const;
147 
149  typedef CovariantVector<OutputType,
150  itkGetStaticConstMacro(ImageDimension)
152 
154  {
155  ContinuousIndexType index;
156  this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
157  return ( this->EvaluateDerivativeAtContinuousIndex( index ) );
158  }
159 
160  CovariantVectorType EvaluateDerivativeAtContinuousIndex(
161  const ContinuousIndexType & x ) const;
162 
163 
166  void SetSplineOrder(unsigned int SplineOrder);
167  itkGetConstMacro(SplineOrder, int);
168 
169 
171  virtual void SetInputImage(const TImageType * inputData);
172 
173 
186  itkSetMacro( UseImageDirection, bool );
187  itkGetConstMacro( UseImageDirection, bool );
188  itkBooleanMacro( UseImageDirection );
189 
190 
191 protected:
194  void PrintSelf(std::ostream& os, Indent indent) const;
195 
196  // These are needed by the smoothing spline routine.
197  std::vector<CoefficientDataType> m_Scratch; // temp storage for processing of Coefficients
198  typename TImageType::SizeType m_DataLength; // Image size
199  unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
200 
201  typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
202 
203 private:
204  ReducedDimensionBSplineInterpolateImageFunction( const Self& ); //purposely not implemented
205  void operator=( const Self& ); //purposely not implemented
206 
208  void SetInterpolationWeights( const ContinuousIndexType & x,
209  const vnl_matrix<long> & EvaluateIndex,
210  vnl_matrix<double> & weights,
211  unsigned int splineOrder ) const;
212 
214  void SetDerivativeWeights( const ContinuousIndexType & x,
215  const vnl_matrix<long> & EvaluateIndex,
216  vnl_matrix<double> & weights,
217  unsigned int splineOrder ) const;
218 
221  void GeneratePointsToIndex( );
222 
224  void DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
225  const ContinuousIndexType & x,
226  unsigned int splineOrder ) const;
227 
230  void ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
231  unsigned int splineOrder) const;
232 
233 
234  Iterator m_CIterator; // Iterator for traversing spline coefficients.
235  unsigned long m_MaxNumberInterpolationPoints; // number of neighborhood points used for interpolation
236  std::vector<IndexType> m_PointsToIndex; // Preallocation of interpolation neighborhood indicies
237 
239 
240  // flag to take or not the image direction into account when computing the
241  // derivatives.
243 
244 };
245 
246 } // namespace itk
247 
248 #ifndef ITK_MANUAL_INSTANTIATION
249 #include "itkReducedDimensionBSplineInterpolateImageFunction.txx"
250 #endif
251 
252 #endif
Evaluates the B-Spline interpolation of an image. Spline order may be from 0 to 5.
Calculates the B-Spline coefficients of an image. Spline order may be per dimension from 0 to 5 per...
MultiOrderBSplineDecompositionImageFilter< TImageType, CoefficientImageType > CoefficientFilter


Generated on 05-12-2013 for elastix by doxygen 1.8.5 elastix logo