// ========================================================================= // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ========================================================================= #ifndef __RandomWalkLabelling__h__ #define __RandomWalkLabelling__h__ #include #include /** */ template< class _TRawImage, class _TCostsImage, class _TLabelsImage > class RandomWalkLabelling : public fpa::Filters::Image::RegionGrow< _TRawImage, _TLabelsImage, typename _TLabelsImage::PixelType > { public: typedef _TRawImage TRawImage; typedef _TCostsImage TCostsImage; typedef _TLabelsImage TLabelsImage; typedef typename TCostsImage::PixelType TScalar; typedef typename TLabelsImage::PixelType TLabel; typedef fpa::Filters::Image::RegionGrow< TRawImage, TLabelsImage, TLabel > Superclass; typedef RandomWalkLabelling Self; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef fpa::DataStructures::Image::Path< TRawImage::ImageDimension > TPath; typedef typename Superclass::TTraits TTraits; fpaTraitsMacro( typename TTraits ); public: itkNewMacro( Self ); itkTypeMacro( clab::RandomWalkLabelling, fpa::Filter::Image::RegionGrow ); itkGetConstMacro( InsideLabel, TLabel ); itkSetMacro( InsideLabel, TLabel ); itkGetConstMacro( LowerLabel, TLabel ); itkSetMacro( LowerLabel, TLabel ); itkGetConstMacro( UpperLabel, TLabel ); itkSetMacro( UpperLabel, TLabel ); itkGetConstMacro( Radius, double ); itkSetMacro( Radius, double ); itkGetConstMacro( LowerThreshold, double ); itkSetMacro( LowerThreshold, double ); itkGetConstMacro( UpperThreshold, double ); itkSetMacro( UpperThreshold, double ); itkGetConstMacro( MaxCost, TScalar ); itkSetMacro( MaxCost, TScalar ); fpaFilterInputMacro( InputCosts, TCostsImage ); fpaFilterInputMacro( InputPath, TPath ); public: void SetInputImage( const TRawImage* i ); TLabelsImage* GetOutputLabels( ); const TLabelsImage* GetOutputLabels( ) const; TLabel GetOutsideLabel( ) const; void SetOutsideLabel( const TLabel& v ); protected: RandomWalkLabelling( ); virtual ~RandomWalkLabelling( ); virtual void _PrepareSeeds( const itk::DataObject* reference ) override; virtual void _PostComputeOutputValue( TNode& n ) override; virtual void _Reinitialize( ) override; private: // Purposely not implemented RandomWalkLabelling( const Self& other ); Self& operator=( const Self& other ); protected: TLabel m_InsideLabel; TLabel m_LowerLabel; TLabel m_UpperLabel; double m_Radius; double m_LowerThreshold; double m_UpperThreshold; TScalar m_MaxCost; unsigned long m_CurrIdx; }; #ifndef ITK_MANUAL_INSTANTIATION # include "RandomWalkLabelling.hxx" #endif // ITK_MANUAL_INSTANTIATION #endif // __RandomWalkLabelling__h__ // eof - $RCSfile$