#ifndef __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__H__ #define __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__H__ #include #include #include #include namespace fpa { namespace Image { /** * @param I Input image type */ template< class I > class RegionGrowWithMultipleThresholds : public RegionGrowWithMultipleCriteria< I > { public: 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 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; public: itkNewMacro( Self ); itkTypeMacro( RegionGrowWithMultipleThresholds, RegionGrow ); itkGetConstMacro( InsideValue, TPixel ); itkGetConstMacro( OutsideValue, TPixel ); itkGetConstMacro( DifferenceThreshold, double ); itkSetMacro( InsideValue, TPixel ); itkSetMacro( OutsideValue, TPixel ); itkSetMacro( DifferenceThreshold, double ); public: void AddThreshold( const TPixel& v ); void AddThresholds( const TPixel& t0, const TPixel& t1, const unsigned int& s ); protected: RegionGrowWithMultipleThresholds( ); virtual ~RegionGrowWithMultipleThresholds( ); 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: 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 #include #endif // __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__H__ // eof - $RCSfile$