00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkInterpolateImageFunction_h
00018 #define __itkInterpolateImageFunction_h
00019
00020 #include "itkImageFunction.h"
00021
00022 namespace itk
00023 {
00024
00041 template <class TInputImage, class TCoordRep = double>
00042 class ITK_EXPORT InterpolateImageFunction :
00043 public ImageFunction< TInputImage,
00044 ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType, TCoordRep >
00045 {
00046 public:
00048 typedef InterpolateImageFunction Self;
00049 typedef ImageFunction<TInputImage,
00050 typename NumericTraits<typename TInputImage::PixelType>::RealType,
00051 TCoordRep> Superclass;
00052 typedef SmartPointer<Self> Pointer;
00053 typedef SmartPointer<const Self> ConstPointer;
00054
00056 itkTypeMacro(InterpolateImageFunction, ImageFunction);
00057
00059 typedef typename Superclass::OutputType OutputType;
00060
00062 typedef typename Superclass::InputImageType InputImageType;
00063
00065 itkStaticConstMacro(ImageDimension, unsigned int,
00066 Superclass::ImageDimension);
00067
00069 typedef typename Superclass::PointType PointType;
00070
00072 typedef typename Superclass::IndexType IndexType;
00073
00075 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00076
00078 typedef typename NumericTraits<typename TInputImage::PixelType>::RealType RealType;
00079
00088 virtual OutputType Evaluate( const PointType& point ) const
00089 {
00090 ContinuousIndexType index;
00091 this->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
00092 return ( this->EvaluateAtContinuousIndex( index ) );
00093 }
00095
00106 virtual OutputType EvaluateAtContinuousIndex(
00107 const ContinuousIndexType & index ) const = 0;
00108
00117 virtual OutputType EvaluateAtIndex( const IndexType & index ) const
00118 {
00119 return ( static_cast<RealType>( this->GetInputImage()->GetPixel( index ) ) );
00120 }
00121
00122 protected:
00123 InterpolateImageFunction(){};
00124 ~InterpolateImageFunction(){};
00125 void PrintSelf(std::ostream& os, Indent indent) const
00126 { Superclass::PrintSelf( os, indent ); }
00127
00128 private:
00129 InterpolateImageFunction( const Self& );
00130 void operator=( const Self& );
00131
00132 };
00133
00134 }
00135
00136 #endif
00137