X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FAlgorithms%2FGradientFunctionBase.h;h=0472cc4efec3dc49450a8d16620c70077049ac48;hb=106a56bfe6a48067380089ffd61a518e40d77933;hp=a120a463211d230d55f74f4a8f22170b3377ecac;hpb=2361f4f97631e09d88d8a5510a369817dcaa19db;p=cpPlugins.git diff --git a/lib/cpExtensions/Algorithms/GradientFunctionBase.h b/lib/cpExtensions/Algorithms/GradientFunctionBase.h index a120a46..0472cc4 100644 --- a/lib/cpExtensions/Algorithms/GradientFunctionBase.h +++ b/lib/cpExtensions/Algorithms/GradientFunctionBase.h @@ -9,73 +9,75 @@ #include namespace cpExtensions +{ + namespace Algorithms { - namespace Algorithms + /** + */ + template< class G > + class GradientFunctionBase + : public itk::ImageFunction< G, typename G::PixelType::ValueType, typename G::PixelType::ValueType > { - /** - */ - template< class G > - class GradientFunctionBase - : public itk::ImageFunction< G, typename G::PixelType::ValueType, typename G::PixelType::ValueType > - { - public: - // Types from input arguments - typedef G TGradient; - typedef typename G::PixelType TVector; - typedef typename TVector::ValueType TScalar; - itkStaticConstMacro( Dimension, unsigned int, G::ImageDimension ); - - // Standard itk types - typedef GradientFunctionBase Self; - typedef itk::ImageFunction< G, TScalar, TScalar > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - // Types from base itk::ImageFunction - typedef typename Superclass::InputType TInput; - typedef typename Superclass::OutputType TOutput; - typedef typename Superclass::PointType TPoint; - typedef typename Superclass::ContinuousIndexType TContIndex; - typedef typename Superclass::IndexType TIndex; - - // Sparse buffer - typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer; - - public: - itkTypeMacro( GradientFunctionBase, itkImageFunction ); - - itkBooleanMacro( BufferResults ); - itkGetConstMacro( BufferResults, bool ); - itkSetMacro( BufferResults, bool ); - - public: - virtual void ResetBuffer( ); - - virtual TOutput Evaluate( const TPoint& p ) const; - virtual TOutput EvaluateAtIndex( const TIndex& i ) const; - virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const; - - protected: - GradientFunctionBase( ); - virtual ~GradientFunctionBase( ); - - virtual TOutput _Evaluate( const TIndex& i ) const = 0; - - private: - // Purposely not implemented. - GradientFunctionBase( const Self& ); - void operator=( const Self& ); - - protected: - mutable TBuffer m_Buffer; - bool m_BufferResults; - }; - - } // ecapseman + public: + // Types from input arguments + typedef G TGradient; + typedef typename G::PixelType TVector; + typedef typename TVector::ValueType TScalar; + itkStaticConstMacro( Dimension, unsigned int, G::ImageDimension ); + + // Standard itk types + typedef GradientFunctionBase Self; + typedef itk::ImageFunction< G, TScalar, TScalar > Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + // Types from base itk::ImageFunction + typedef typename Superclass::InputType TInput; + typedef typename Superclass::OutputType TOutput; + typedef typename Superclass::PointType TPoint; + typedef typename Superclass::ContinuousIndexType TContIndex; + typedef typename Superclass::IndexType TIndex; + + // Sparse buffer + typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer; + + public: + itkTypeMacro( GradientFunctionBase, itkImageFunction ); + + itkBooleanMacro( BufferResults ); + itkGetConstMacro( BufferResults, bool ); + itkSetMacro( BufferResults, bool ); + + public: + virtual void ResetBuffer( ); + + virtual TOutput Evaluate( const TPoint& p ) const; + virtual TOutput EvaluateAtIndex( const TIndex& i ) const; + virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const; + + protected: + GradientFunctionBase( ); + virtual ~GradientFunctionBase( ); + + virtual TOutput _Evaluate( const TIndex& i ) const = 0; + + private: + // Purposely not implemented. + GradientFunctionBase( const Self& ); + void operator=( const Self& ); + + protected: + mutable TBuffer m_Buffer; + bool m_BufferResults; + }; + + } // ecapseman } // ecapseman +#ifndef ITK_MANUAL_INSTANTIATION #include +#endif // ITK_MANUAL_INSTANTIATION #endif // __CPEXTENSIONS__ALGORITHMS__GRADIENTFUNCTIONBASE__H__