X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FRegionGrowWithMultipleThresholds.h;h=f538e7bb49734f4bcbf9508a5e404269982bc211;hb=ee47805904ac406cd2433cd9a9a9eeec68d1fc6e;hp=3efd87a7313547b97e2413205e73fd47ee42a213;hpb=56882b09aa679c7d85e3f21bf9e45df78340a253;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/RegionGrowWithMultipleThresholds.h b/lib/fpa/Image/RegionGrowWithMultipleThresholds.h index 3efd87a..f538e7b 100644 --- a/lib/fpa/Image/RegionGrowWithMultipleThresholds.h +++ b/lib/fpa/Image/RegionGrowWithMultipleThresholds.h @@ -2,7 +2,9 @@ #define __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__H__ #include -#include +#include +#include +#include namespace fpa { @@ -13,18 +15,23 @@ namespace fpa */ template< class I > class RegionGrowWithMultipleThresholds - : public RegionGrow< I > + : public RegionGrowWithMultipleCriteria< I > { public: - typedef RegionGrowWithMultipleThresholds Self; - typedef RegionGrow< I > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; + typedef RegionGrowWithMultipleThresholds Self; + typedef RegionGrowWithMultipleCriteria< I > Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; typedef typename I::PixelType TPixel; - typedef std::map< TPixel, unsigned long > THistogram; - typedef typename Superclass::TBaseAlgorithm TBaseAlgorithm; + typedef std::map< TPixel, unsigned long > THistogram; + typedef typename Superclass::TBaseAlgorithm TBaseAlgorithm; + typedef typename Superclass::TMembershipFunction TMembershipFunction; + typedef typename Superclass::TFunctions TFunctions; + + typedef std::set< TPixel > TThresholds; + typedef fpa::Image::Functors::RegionGrowThresholdFunction< I > TFunction; protected: typedef typename TBaseAlgorithm::_TNode _TNode; @@ -33,8 +40,13 @@ namespace fpa itkNewMacro( Self ); itkTypeMacro( RegionGrowWithMultipleThresholds, RegionGrow ); - itkGetConstMacro( DerivativeThreshold, double ); - itkSetMacro( DerivativeThreshold, double ); + itkGetConstMacro( InsideValue, TPixel ); + itkGetConstMacro( OutsideValue, TPixel ); + itkGetConstMacro( DifferenceThreshold, double ); + + itkSetMacro( InsideValue, TPixel ); + itkSetMacro( OutsideValue, TPixel ); + itkSetMacro( DifferenceThreshold, double ); public: void AddThreshold( const TPixel& v ); @@ -48,23 +60,36 @@ namespace fpa RegionGrowWithMultipleThresholds( ); virtual ~RegionGrowWithMultipleThresholds( ); - virtual bool _UpdateResult( _TNode& n ); + virtual void _BeforeMainLoop( ); + virtual void _AfterMainLoop( ); virtual void _AfterLoop( ); + virtual bool _UpdateResult( _TNode& n ); + virtual void _Mark( const _TNode& n ); + virtual bool _CheckStopCondition( ); private: RegionGrowWithMultipleThresholds( const Self& ); // Not impl. void operator=( const Self& ); // Not impl. protected: - double m_DerivativeThreshold; + TThresholds m_Thresholds; + TPixel m_InsideValue; + TPixel m_OutsideValue; + double m_DifferenceThreshold; THistogram m_Histogram; + unsigned long m_TotalCount; + double m_LastDiff; + bool m_StopForced; + TPixel m_StopThreshold; }; } // ecapseman } // ecapseman +#ifndef ITK_MANUAL_INSTANTIATION #include +#endif // ITK_MANUAL_INSTANTIATION #endif // __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__H__