00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _itkNearestNeighborInterpolateImageFunction_h
00018 #define _itkNearestNeighborInterpolateImageFunction_h
00019
00020 #include "itkInterpolateImageFunction.h"
00021
00022 namespace itk
00023 {
00024
00036 template <class TInputImage, class TCoordRep = float>
00037 class ITK_EXPORT NearestNeighborInterpolateImageFunction :
00038 public InterpolateImageFunction<TInputImage,TCoordRep>
00039 {
00040 public:
00042 typedef NearestNeighborInterpolateImageFunction Self;
00043 typedef InterpolateImageFunction<TInputImage,TCoordRep> Superclass;
00044 typedef SmartPointer<Self> Pointer;
00045 typedef SmartPointer<const Self> ConstPointer;
00046
00048 itkTypeMacro(NearestNeighborInterpolateImageFunction,
00049 InterpolateImageFunction);
00050
00052 itkNewMacro(Self);
00053
00055 typedef typename Superclass::OutputType OutputType;
00056
00058 typedef typename Superclass::InputImageType InputImageType;
00059
00061 itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
00062
00064 typedef typename Superclass::IndexType IndexType;
00065
00067 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00068
00077 virtual OutputType EvaluateAtContinuousIndex(
00078 const ContinuousIndexType & index ) const
00079 {
00080 IndexType nindex;
00081 this->ConvertContinuousIndexToNearestIndex(index, nindex);
00082 return static_cast<OutputType>( m_Image->GetPixel( nindex ) );
00083 }
00084
00085 protected:
00086 NearestNeighborInterpolateImageFunction(){};
00087 ~NearestNeighborInterpolateImageFunction(){};
00088 void PrintSelf(std::ostream& os, Indent indent) const
00089 { Superclass::PrintSelf( os, indent ); }
00090
00091 private:
00092 NearestNeighborInterpolateImageFunction(const Self&);
00093 void operator=(const Self&);
00094
00095 };
00096
00097 }
00098
00099 #endif