00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _itkUpwindDerivativeImageFunction_h
00018 #define _itkUpwindDerivativeImageFunction_h
00019
00020 #include "itkImageFunction.h"
00021
00022 namespace itk
00023 {
00024
00048 template <class TInputImage, class TCoordRep = float >
00049 class ITK_EXPORT UpwindDerivativeImageFunction :
00050 public ImageFunction< TInputImage, double, TCoordRep >
00051 {
00052 public:
00054 typedef UpwindDerivativeImageFunction Self;
00055 typedef ImageFunction<TInputImage, double,TCoordRep> Superclass;
00056 typedef SmartPointer<Self> Pointer;
00057 typedef SmartPointer<const Self> ConstPointer;
00058
00060 itkNewMacro(Self);
00061
00063 itkTypeMacro(UpwindDerivativeImageFunction, ImageFunction);
00064
00066 typedef TInputImage InputImageType;
00067
00069 itkStaticConstMacro(ImageDimension, unsigned int,
00070 InputImageType::ImageDimension);
00071
00073 typedef typename Superclass::IndexType IndexType;
00074
00076 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00077
00079 typedef typename Superclass::PointType PointType;
00080
00082 virtual void SetInputImage( const InputImageType * ptr );
00083
00085 virtual void SetSpeed( double value )
00086 { m_Speed = value; }
00087
00089 virtual double GetSpeed() const
00090 { return m_Speed; }
00091
00093 virtual double EvaluateAtIndex( const IndexType& index ) const
00094 { return ( this->EvaluateNthDerivativeAtIndex( index, 0 ) ); }
00095
00097 virtual double Evaluate( const PointType& point ) const
00098 {
00099 IndexType index;
00100 this->ConvertPointToNearestIndex( point, index );
00101 return this->EvaluateAtIndex( index );
00102 }
00103 virtual double EvaluateAtContinuousIndex(
00104 const ContinuousIndexType& cindex ) const
00105 {
00106 IndexType index;
00107 this->ConvertContinuousIndexToNearestIndex( cindex, index );
00108 return this->EvaluateAtIndex( index ) ;
00109 }
00110
00112 virtual double EvaluateNthDerivativeAtIndex( const IndexType& index,
00113 unsigned int dim = 0 ) const;
00114
00116 virtual double GetDerivative() const
00117 { return m_Derivative; }
00118
00119 protected:
00120 UpwindDerivativeImageFunction(){};
00121 ~UpwindDerivativeImageFunction(){};
00122 void PrintSelf(std::ostream& os, Indent indent) const;
00123
00124 double m_Speed;
00125 mutable double m_Derivative;
00126
00127 private:
00128 UpwindDerivativeImageFunction(const Self&);
00129 void operator=(const Self&);
00130
00131 signed long m_ImageSize[ImageDimension];
00132 bool m_ImageSizeOK;
00133
00134 mutable IndexType m_NeighIndex;
00135 mutable double m_CenterValue;
00136 mutable double m_DiffValue;
00137
00138 };
00139
00140 }
00141
00142 #ifndef ITK_MANUAL_INSTANTIATION
00143 #include "itkUpwindDerivativeImageFunction.txx"
00144 #endif
00145
00146 #endif
00147