Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef __itkReducedDimensionBSplineInterpolateImageFunction_h
00035 #define __itkReducedDimensionBSplineInterpolateImageFunction_h
00036
00037 #include <vector>
00038
00039 #include "itkImageLinearIteratorWithIndex.h"
00040 #include "itkInterpolateImageFunction.h"
00041 #include "vnl/vnl_matrix.h"
00042
00043 #include "itkBSplineDecompositionImageFilter.h"
00044 #include "itkConceptChecking.h"
00045 #include "itkCovariantVector.h"
00046
00047 namespace itk
00048 {
00082 template <
00083 class TImageType,
00084 class TCoordRep = double,
00085 class TCoefficientType = double >
00086 class ITK_EXPORT ReducedDimensionBSplineInterpolateImageFunction :
00087 public InterpolateImageFunction<TImageType,TCoordRep>
00088 {
00089 public:
00091 typedef ReducedDimensionBSplineInterpolateImageFunction Self;
00092 typedef InterpolateImageFunction<TImageType,TCoordRep> Superclass;
00093 typedef SmartPointer<Self> Pointer;
00094 typedef SmartPointer<const Self> ConstPointer;
00095
00097 itkTypeMacro(ReducedDimensionBSplineInterpolateImageFunction, InterpolateImageFunction);
00098
00099
00101 itkNewMacro( Self );
00102
00104 typedef typename Superclass::OutputType OutputType;
00105
00107 typedef typename Superclass::InputImageType InputImageType;
00108
00110 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00111
00113 typedef typename Superclass::IndexType IndexType;
00114
00116 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00117
00119 typedef typename Superclass::PointType PointType;
00120
00122 typedef ImageLinearIteratorWithIndex<TImageType> Iterator;
00123
00125 typedef TCoefficientType CoefficientDataType;
00126 typedef Image<CoefficientDataType,
00127 itkGetStaticConstMacro(ImageDimension)
00128 > CoefficientImageType;
00129
00131 typedef BSplineDecompositionImageFilter<TImageType, CoefficientImageType>
00132 CoefficientFilter;
00133
00134 typedef typename CoefficientFilter::Pointer CoefficientFilterPointer;
00135
00144 virtual OutputType EvaluateAtContinuousIndex(
00145 const ContinuousIndexType & index ) const;
00146
00148 typedef CovariantVector<OutputType,
00149 itkGetStaticConstMacro(ImageDimension)
00150 > CovariantVectorType;
00151
00152 CovariantVectorType EvaluateDerivative( const PointType & point ) const
00153 {
00154 ContinuousIndexType index;
00155 this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
00156 return ( this->EvaluateDerivativeAtContinuousIndex( index ) );
00157 }
00158
00159 CovariantVectorType EvaluateDerivativeAtContinuousIndex(
00160 const ContinuousIndexType & x ) const;
00161
00162
00165 void SetSplineOrder(unsigned int SplineOrder);
00166 itkGetConstMacro(SplineOrder, int);
00167
00168
00170 virtual void SetInputImage(const TImageType * inputData);
00171
00172
00185 itkSetMacro( UseImageDirection, bool );
00186 itkGetConstMacro( UseImageDirection, bool );
00187 itkBooleanMacro( UseImageDirection );
00188
00189
00190 protected:
00191 ReducedDimensionBSplineInterpolateImageFunction();
00192 virtual ~ReducedDimensionBSplineInterpolateImageFunction() {};
00193 void PrintSelf(std::ostream& os, Indent indent) const;
00194
00195
00196 std::vector<CoefficientDataType> m_Scratch;
00197 typename TImageType::SizeType m_DataLength;
00198 unsigned int m_SplineOrder;
00199
00200 typename CoefficientImageType::ConstPointer m_Coefficients;
00201
00202 private:
00203 ReducedDimensionBSplineInterpolateImageFunction( const Self& );
00204 void operator=( const Self& );
00205
00207 void SetInterpolationWeights( const ContinuousIndexType & x,
00208 const vnl_matrix<long> & EvaluateIndex,
00209 vnl_matrix<double> & weights,
00210 unsigned int splineOrder ) const;
00211
00213 void SetDerivativeWeights( const ContinuousIndexType & x,
00214 const vnl_matrix<long> & EvaluateIndex,
00215 vnl_matrix<double> & weights,
00216 unsigned int splineOrder ) const;
00217
00220 void GeneratePointsToIndex( );
00221
00223 void DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
00224 const ContinuousIndexType & x,
00225 unsigned int splineOrder ) const;
00226
00229 void ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
00230 unsigned int splineOrder) const;
00231
00232
00233 Iterator m_CIterator;
00234 unsigned long m_MaxNumberInterpolationPoints;
00235 std::vector<IndexType> m_PointsToIndex;
00236
00237 CoefficientFilterPointer m_CoefficientFilter;
00238
00239
00240
00241 bool m_UseImageDirection;
00242
00243 };
00244
00245 }
00246
00247 #ifndef ITK_MANUAL_INSTANTIATION
00248 #include "itkReducedDimensionBSplineInterpolateImageFunction.txx"
00249 #endif
00250
00251 #endif