1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __RandomWalkLabelling__h__
5 #define __RandomWalkLabelling__h__
7 #include <fpa/DataStructures/Image/Path.h>
8 #include <fpa/Filters/Image/RegionGrow.h>
12 template< class _TRawImage, class _TCostsImage, class _TLabelsImage >
13 class RandomWalkLabelling
14 : public fpa::Filters::Image::RegionGrow< _TRawImage, _TLabelsImage, typename _TLabelsImage::PixelType >
17 typedef _TRawImage TRawImage;
18 typedef _TCostsImage TCostsImage;
19 typedef _TLabelsImage TLabelsImage;
20 typedef typename TCostsImage::PixelType TScalar;
21 typedef typename TLabelsImage::PixelType TLabel;
23 typedef fpa::Filters::Image::RegionGrow< TRawImage, TLabelsImage, TLabel > Superclass;
24 typedef RandomWalkLabelling Self;
25 typedef itk::SmartPointer< Self > Pointer;
26 typedef itk::SmartPointer< const Self > ConstPointer;
28 typedef fpa::DataStructures::Image::Path< TRawImage::ImageDimension > TPath;
30 typedef typename Superclass::TTraits TTraits;
31 fpaTraitsMacro( typename TTraits );
35 itkTypeMacro( clab::RandomWalkLabelling, fpa::Filter::Image::RegionGrow );
37 itkGetConstMacro( InsideLabel, TLabel );
38 itkSetMacro( InsideLabel, TLabel );
40 itkGetConstMacro( LowerLabel, TLabel );
41 itkSetMacro( LowerLabel, TLabel );
43 itkGetConstMacro( UpperLabel, TLabel );
44 itkSetMacro( UpperLabel, TLabel );
46 itkGetConstMacro( Radius, double );
47 itkSetMacro( Radius, double );
49 itkGetConstMacro( LowerThreshold, double );
50 itkSetMacro( LowerThreshold, double );
52 itkGetConstMacro( UpperThreshold, double );
53 itkSetMacro( UpperThreshold, double );
55 itkGetConstMacro( MaxCost, TScalar );
56 itkSetMacro( MaxCost, TScalar );
58 fpaFilterInputMacro( InputCosts, TCostsImage );
59 fpaFilterInputMacro( InputPath, TPath );
62 void SetInputImage( const TRawImage* i );
64 TLabelsImage* GetOutputLabels( );
65 const TLabelsImage* GetOutputLabels( ) const;
67 TLabel GetOutsideLabel( ) const;
68 void SetOutsideLabel( const TLabel& v );
71 RandomWalkLabelling( );
72 virtual ~RandomWalkLabelling( );
74 virtual void _PrepareSeeds( const itk::DataObject* reference ) override;
75 virtual void _PostComputeOutputValue( TNode& n ) override;
76 virtual void _Reinitialize( ) override;
79 // Purposely not implemented
80 RandomWalkLabelling( const Self& other );
81 Self& operator=( const Self& other );
89 double m_LowerThreshold;
90 double m_UpperThreshold;
94 unsigned long m_CurrIdx;
97 #ifndef ITK_MANUAL_INSTANTIATION
98 # include "RandomWalkLabelling.hxx"
99 #endif // ITK_MANUAL_INSTANTIATION
100 #endif // __RandomWalkLabelling__h__