Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkBSplineInterpolateImageFunction.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkBSplineInterpolateImageFunction.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:28:43 $ 00007 Version: $Revision: 1.10 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 00021 #ifndef __itkBSplineInterpolateImageFunction_h 00022 #define __itkBSplineInterpolateImageFunction_h 00023 00024 #include <vector> 00025 00026 #include "itkImageLinearIteratorWithIndex.h" 00027 #include "itkInterpolateImageFunction.h" 00028 #include "vnl/vnl_matrix.h" 00029 00030 #include "itkBSplineDecompositionImageFilter.h" 00031 #include "itkConceptChecking.h" 00032 00033 namespace itk 00034 { 00068 template < 00069 class TImageType, 00070 class TCoordRep = float, 00071 class TCoefficientType = double > 00072 class ITK_EXPORT BSplineInterpolateImageFunction : 00073 public InterpolateImageFunction<TImageType,TCoordRep> 00074 { 00075 public: 00077 typedef BSplineInterpolateImageFunction Self; 00078 typedef InterpolateImageFunction<TImageType,TCoordRep> Superclass; 00079 typedef SmartPointer<Self> Pointer; 00080 typedef SmartPointer<const Self> ConstPointer; 00081 00083 itkTypeMacro(BSplineInterpolateImageFunction, InterpolateImageFunction); 00084 00085 00087 itkNewMacro( Self ); 00088 00090 typedef typename Superclass::OutputType OutputType; 00091 00093 typedef typename Superclass::InputImageType InputImageType; 00094 00096 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension); 00097 00099 typedef typename Superclass::IndexType IndexType; 00100 00102 typedef typename Superclass::ContinuousIndexType ContinuousIndexType; 00103 00105 typedef typename Superclass::PointType PointType; 00106 00108 typedef itk::ImageLinearIteratorWithIndex<TImageType> Iterator; 00109 00111 typedef TCoefficientType CoefficientDataType; 00112 typedef itk::Image<CoefficientDataType, 00113 itkGetStaticConstMacro(ImageDimension) 00114 > CoefficientImageType; 00115 00117 typedef itk::BSplineDecompositionImageFilter<TImageType, CoefficientImageType> 00118 CoefficientFilter; 00119 typedef typename CoefficientFilter::Pointer CoefficientFilterPointer; 00120 00129 virtual OutputType EvaluateAtContinuousIndex( 00130 const ContinuousIndexType & index ) const; 00131 00133 typedef CovariantVector<OutputType, 00134 itkGetStaticConstMacro(ImageDimension) 00135 > CovariantVectorType; 00136 00137 CovariantVectorType EvaluateDerivative( const PointType & point ) const 00138 { 00139 ContinuousIndexType index; 00140 m_Image->TransformPhysicalPointToContinuousIndex( point, index ); 00141 return ( this->EvaluateDerivativeAtContinuousIndex( index ) ); 00142 } 00143 00144 CovariantVectorType EvaluateDerivativeAtContinuousIndex( 00145 const ContinuousIndexType & x ) const; 00146 00147 00150 void SetSplineOrder(unsigned int SplineOrder); 00151 itkGetMacro(SplineOrder, int); 00152 00153 00155 virtual void SetInputImage(const TImageType * inputData); 00156 00157 protected: 00158 BSplineInterpolateImageFunction(); 00159 virtual ~BSplineInterpolateImageFunction() {}; 00160 void PrintSelf(std::ostream& os, Indent indent) const; 00161 00162 // These are needed by the smoothing spline routine. 00163 std::vector<CoefficientDataType> m_Scratch; // temp storage for processing of Coefficients 00164 typename TImageType::SizeType m_DataLength; // Image size 00165 unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default) 00166 00167 typename CoefficientImageType::ConstPointer m_Coefficients; // Spline coefficients 00168 00169 private: 00171 void SetInterpolationWeights( const ContinuousIndexType & x, 00172 const vnl_matrix<long> & EvaluateIndex, 00173 vnl_matrix<double> & weights, 00174 unsigned int splineOrder ) const; 00175 00177 void SetDerivativeWeights( const ContinuousIndexType & x, 00178 const vnl_matrix<long> & EvaluateIndex, 00179 vnl_matrix<double> & weights, 00180 unsigned int splineOrder ) const; 00181 00184 void GeneratePointsToIndex( ); 00185 00187 void DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex, 00188 const ContinuousIndexType & x, 00189 unsigned int splineOrder ) const; 00190 00193 void ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex, 00194 unsigned int splineOrder) const; 00195 00196 00197 Iterator m_CIterator; // Iterator for traversing spline coefficients. 00198 unsigned long m_MaxNumberInterpolationPoints; // number of neighborhood points used for interpolation 00199 std::vector<IndexType> m_PointsToIndex; // Preallocation of interpolation neighborhood indicies 00200 00201 BSplineInterpolateImageFunction( const Self& ); //purposely not implemented 00202 void operator=( const Self& ); //purposely not implemented 00203 CoefficientFilterPointer m_CoefficientFilter; 00204 00205 }; 00206 00207 } // namespace itk 00208 00209 #ifndef ITK_MANUAL_INSTANTIATION 00210 #include "itkBSplineInterpolateImageFunction.txx" 00211 #endif 00212 00213 #endif 00214

Generated at Sat Mar 31 02:15:17 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000