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 = float>
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,double,TCoordRep> Superclass;
00050 typedef SmartPointer<Self> Pointer;
00051 typedef SmartPointer<const Self> ConstPointer;
00052
00054 itkTypeMacro(InterpolateImageFunction, ImageFunction);
00055
00057 typedef typename Superclass::OutputType OutputType;
00058
00060 typedef typename Superclass::InputImageType InputImageType;
00061
00063 itkStaticConstMacro(ImageDimension, unsigned int,
00064 Superclass::ImageDimension);
00065
00067 typedef typename Superclass::PointType PointType;
00068
00070 typedef typename Superclass::IndexType IndexType;
00071
00073 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00074
00076 typedef typename NumericTraits<typename TInputImage::PixelType>::RealType RealType;
00077
00086 virtual OutputType Evaluate( const PointType& point ) const
00087 {
00088 ContinuousIndexType index;
00089 this->ConvertPointToContinuousIndex( point, index );
00090 return ( this->EvaluateAtContinuousIndex( index ) );
00091 }
00092
00103 virtual OutputType EvaluateAtContinuousIndex(
00104 const ContinuousIndexType & index ) const = 0;
00105
00114 virtual OutputType EvaluateAtIndex( const IndexType & index ) const
00115 {
00116 return ( static_cast<RealType>( m_Image->GetPixel( index ) ) );
00117 }
00118
00119 protected:
00120 InterpolateImageFunction(){};
00121 ~InterpolateImageFunction(){};
00122 void PrintSelf(std::ostream& os, Indent indent) const
00123 { Superclass::PrintSelf( os, indent ); }
00124
00125 private:
00126 InterpolateImageFunction( const Self& );
00127 void operator=( const Self& );
00128
00129 };
00130
00131 }
00132
00133 #endif