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,typename NumericTraits<typename TInputImage::PixelType>::RealType,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->GetInputImage()->TransformPhysicalPointToContinuousIndex( point, index );
00090 return ( this->EvaluateAtContinuousIndex( index ) );
00091 }
00093
00104 virtual OutputType EvaluateAtContinuousIndex(
00105 const ContinuousIndexType & index ) const = 0;
00106
00115 virtual OutputType EvaluateAtIndex( const IndexType & index ) const
00116 {
00117 return ( static_cast<RealType>( this->GetInputImage()->GetPixel( index ) ) );
00118 }
00119
00120 protected:
00121 InterpolateImageFunction(){};
00122 ~InterpolateImageFunction(){};
00123 void PrintSelf(std::ostream& os, Indent indent) const
00124 { Superclass::PrintSelf( os, indent ); }
00125
00126 private:
00127 InterpolateImageFunction( const Self& );
00128 void operator=( const Self& );
00129
00130 };
00131
00132 }
00133
00134 #endif
00135