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 "itkMultiOrderBSplineDecompositionImageFilter.h"
00044 #include "itkConceptChecking.h"
00045 #include "itkCovariantVector.h"
00046
00047 namespace itk
00048 {
00083 template <
00084 class TImageType,
00085 class TCoordRep = double,
00086 class TCoefficientType = double >
00087 class ITK_EXPORT ReducedDimensionBSplineInterpolateImageFunction :
00088 public InterpolateImageFunction<TImageType,TCoordRep>
00089 {
00090 public:
00092 typedef ReducedDimensionBSplineInterpolateImageFunction Self;
00093 typedef InterpolateImageFunction<TImageType,TCoordRep> Superclass;
00094 typedef SmartPointer<Self> Pointer;
00095 typedef SmartPointer<const Self> ConstPointer;
00096
00098 itkTypeMacro(ReducedDimensionBSplineInterpolateImageFunction, InterpolateImageFunction);
00099
00100
00102 itkNewMacro( Self );
00103
00105 typedef typename Superclass::OutputType OutputType;
00106
00108 typedef typename Superclass::InputImageType InputImageType;
00109
00111 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00112
00114 typedef typename Superclass::IndexType IndexType;
00115
00117 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00118
00120 typedef typename Superclass::PointType PointType;
00121
00123 typedef ImageLinearIteratorWithIndex<TImageType> Iterator;
00124
00126 typedef TCoefficientType CoefficientDataType;
00127 typedef Image<CoefficientDataType,
00128 itkGetStaticConstMacro(ImageDimension)
00129 > CoefficientImageType;
00130
00132 typedef MultiOrderBSplineDecompositionImageFilter<TImageType, CoefficientImageType>
00133 CoefficientFilter;
00134
00135 typedef typename CoefficientFilter::Pointer CoefficientFilterPointer;
00136
00145 virtual OutputType EvaluateAtContinuousIndex(
00146 const ContinuousIndexType & index ) const;
00147
00149 typedef CovariantVector<OutputType,
00150 itkGetStaticConstMacro(ImageDimension)
00151 > CovariantVectorType;
00152
00153 CovariantVectorType EvaluateDerivative( const PointType & point ) const
00154 {
00155 ContinuousIndexType index;
00156 this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
00157 return ( this->EvaluateDerivativeAtContinuousIndex( index ) );
00158 }
00159
00160 CovariantVectorType EvaluateDerivativeAtContinuousIndex(
00161 const ContinuousIndexType & x ) const;
00162
00163
00166 void SetSplineOrder(unsigned int SplineOrder);
00167 itkGetConstMacro(SplineOrder, int);
00168
00169
00171 virtual void SetInputImage(const TImageType * inputData);
00172
00173
00186 itkSetMacro( UseImageDirection, bool );
00187 itkGetConstMacro( UseImageDirection, bool );
00188 itkBooleanMacro( UseImageDirection );
00189
00190
00191 protected:
00192 ReducedDimensionBSplineInterpolateImageFunction();
00193 virtual ~ReducedDimensionBSplineInterpolateImageFunction() {};
00194 void PrintSelf(std::ostream& os, Indent indent) const;
00195
00196
00197 std::vector<CoefficientDataType> m_Scratch;
00198 typename TImageType::SizeType m_DataLength;
00199 unsigned int m_SplineOrder;
00200
00201 typename CoefficientImageType::ConstPointer m_Coefficients;
00202
00203 private:
00204 ReducedDimensionBSplineInterpolateImageFunction( const Self& );
00205 void operator=( const Self& );
00206
00208 void SetInterpolationWeights( const ContinuousIndexType & x,
00209 const vnl_matrix<long> & EvaluateIndex,
00210 vnl_matrix<double> & weights,
00211 unsigned int splineOrder ) const;
00212
00214 void SetDerivativeWeights( const ContinuousIndexType & x,
00215 const vnl_matrix<long> & EvaluateIndex,
00216 vnl_matrix<double> & weights,
00217 unsigned int splineOrder ) const;
00218
00221 void GeneratePointsToIndex( );
00222
00224 void DetermineRegionOfSupport( vnl_matrix<long> & evaluateIndex,
00225 const ContinuousIndexType & x,
00226 unsigned int splineOrder ) const;
00227
00230 void ApplyMirrorBoundaryConditions(vnl_matrix<long> & evaluateIndex,
00231 unsigned int splineOrder) const;
00232
00233
00234 Iterator m_CIterator;
00235 unsigned long m_MaxNumberInterpolationPoints;
00236 std::vector<IndexType> m_PointsToIndex;
00237
00238 CoefficientFilterPointer m_CoefficientFilter;
00239
00240
00241
00242 bool m_UseImageDirection;
00243
00244 };
00245
00246 }
00247
00248 #ifndef ITK_MANUAL_INSTANTIATION
00249 #include "itkReducedDimensionBSplineInterpolateImageFunction.txx"
00250 #endif
00251
00252 #endif