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:
91 
94  typedef InterpolateImageFunction< TImageType, TCoordRep > Superclass;
95  typedef SmartPointer< Self > Pointer;
96  typedef SmartPointer< const Self > ConstPointer;
97 
99  itkTypeMacro( ReducedDimensionBSplineInterpolateImageFunction, InterpolateImageFunction );
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 
161  CovariantVectorType EvaluateDerivativeAtContinuousIndex(
162  const ContinuousIndexType & x ) const;
163 
166  void SetSplineOrder( unsigned int SplineOrder );
167 
168  itkGetConstMacro( SplineOrder, int );
169 
171  virtual void SetInputImage( const TImageType * inputData );
172 
185  itkSetMacro( UseImageDirection, bool );
186  itkGetConstMacro( UseImageDirection, bool );
187  itkBooleanMacro( UseImageDirection );
188 
189 protected:
190 
193  void PrintSelf( std::ostream & os, Indent indent ) const;
194 
195  // These are needed by the smoothing spline routine.
196  std::vector< CoefficientDataType > m_Scratch; // temp storage for processing of Coefficients
197  typename TImageType::SizeType m_DataLength; // Image size
198  unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
199 
200  typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients
201 
202 private:
203 
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  Iterator m_CIterator; // Iterator for traversing spline coefficients.
234  unsigned long m_MaxNumberInterpolationPoints; // number of neighborhood points used for interpolation
235  std::vector< IndexType > m_PointsToIndex; // Preallocation of interpolation neighborhood indicies
236 
238 
239  // flag to take or not the image direction into account when computing the
240  // derivatives.
242 
243 };
244 
245 } // namespace itk
246 
247 #ifndef ITK_MANUAL_INSTANTIATION
248 #include "itkReducedDimensionBSplineInterpolateImageFunction.hxx"
249 #endif
250 
251 #endif
MultiOrderBSplineDecompositionImageFilter< TImageType, CoefficientImageType > CoefficientFilter
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...
CovariantVector< OutputType, itkGetStaticConstMacro(ImageDimension) > CovariantVectorType
Image< CoefficientDataType, itkGetStaticConstMacro(ImageDimension) > CoefficientImageType


Generated on 27-04-2014 for elastix by doxygen 1.8.6 elastix logo