00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkMeanImageFunction_h
00018 #define __itkMeanImageFunction_h
00019
00020 #include "itkImageFunction.h"
00021 #include "itkNumericTraits.h"
00022
00023 namespace itk
00024 {
00025
00043 template <class TInputImage, class TCoordRep = float >
00044 class ITK_EXPORT MeanImageFunction :
00045 public ImageFunction< TInputImage,
00046 ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType,
00047 TCoordRep >
00048 {
00049 public:
00050
00052 typedef MeanImageFunction Self;
00053 typedef ImageFunction<TInputImage,
00054 ITK_TYPENAME NumericTraits<typename TInputImage::PixelType>::RealType,
00055 TCoordRep > Superclass;
00056 typedef SmartPointer<Self> Pointer;
00057 typedef SmartPointer<const Self> ConstPointer;
00058
00060 itkTypeMacro(MeanImageFunction, ImageFunction);
00061
00063 itkNewMacro(Self);
00064
00066 typedef TInputImage InputImageType;
00067
00069 typedef typename Superclass::OutputType OutputType;
00070
00072 typedef typename Superclass::IndexType IndexType;
00073
00075 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00076
00078 typedef typename Superclass::PointType PointType;
00079
00081 itkStaticConstMacro(ImageDimension, unsigned int,
00082 InputImageType::ImageDimension);
00083
00085 typedef typename NumericTraits<typename InputImageType::PixelType>::RealType
00086 RealType;
00087
00089 virtual RealType EvaluateAtIndex( const IndexType& index ) const;
00090
00092 virtual RealType Evaluate( const PointType& point ) const
00093 {
00094 IndexType index;
00095 this->ConvertPointToNearestIndex( point, index );
00096 return this->EvaluateAtIndex( index );
00097 }
00098 virtual RealType EvaluateAtContinuousIndex(
00099 const ContinuousIndexType& cindex ) const
00100 {
00101 IndexType index;
00102 this->ConvertContinuousIndexToNearestIndex( cindex, index );
00103 return this->EvaluateAtIndex( index ) ;
00104 }
00106
00109 itkSetMacro( NeighborhoodRadius, unsigned int );
00110 itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int );
00112
00113 protected:
00114 MeanImageFunction();
00115 ~MeanImageFunction(){};
00116 void PrintSelf(std::ostream& os, Indent indent) const;
00117
00118 private:
00119 MeanImageFunction( const Self& );
00120 void operator=( const Self& );
00121
00122 unsigned int m_NeighborhoodRadius;
00123
00124 };
00125
00126 }
00127
00128
00129 #define ITK_TEMPLATE_MeanImageFunction(_, EXPORT, x, y) namespace itk { \
00130 _(2(class EXPORT MeanImageFunction< ITK_TEMPLATE_2 x >)) \
00131 namespace Templates { typedef MeanImageFunction< ITK_TEMPLATE_2 x > \
00132 MeanImageFunction##y; } \
00133 }
00134
00135 #if ITK_TEMPLATE_EXPLICIT
00136 # include "Templates/itkMeanImageFunction+-.h"
00137 #endif
00138
00139 #if ITK_TEMPLATE_TXX
00140 # include "itkMeanImageFunction.txx"
00141 #endif
00142
00143 #endif
00144
00145