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 _TLabelsImage >
13 class RandomWalkLabelling
14 : public fpa::Filters::Image::RegionGrow< _TRawImage, _TLabelsImage, typename _TLabelsImage::PixelType >
17 typedef _TRawImage TRawImage;
18 typedef _TLabelsImage TLabelsImage;
19 typedef typename TLabelsImage::PixelType TLabel;
21 typedef fpa::Filters::Image::RegionGrow< TRawImage, TLabelsImage, TLabel > Superclass;
22 typedef RandomWalkLabelling Self;
23 typedef itk::SmartPointer< Self > Pointer;
24 typedef itk::SmartPointer< const Self > ConstPointer;
26 typedef fpa::DataStructures::Image::Path< TRawImage::ImageDimension > TPath;
28 typedef typename Superclass::TTraits TTraits;
29 fpaTraitsMacro( typename TTraits );
33 itkTypeMacro( clab::RandomWalkLabelling, fpa::Filter::Image::RegionGrow );
35 itkGetConstMacro( InsideLabel, TLabel );
36 itkSetMacro( InsideLabel, TLabel );
38 itkGetConstMacro( LowerLabel, TLabel );
39 itkSetMacro( LowerLabel, TLabel );
41 itkGetConstMacro( UpperLabel, TLabel );
42 itkSetMacro( UpperLabel, TLabel );
44 itkGetConstMacro( Radius, double );
45 itkSetMacro( Radius, double );
47 itkGetConstMacro( LowerThreshold, double );
48 itkSetMacro( LowerThreshold, double );
50 itkGetConstMacro( UpperThreshold, double );
51 itkSetMacro( UpperThreshold, double );
53 fpaFilterInputMacro( InputMarks, TLabelsImage );
54 fpaFilterInputMacro( InputPath, TPath );
57 void SetInputImage( const TRawImage* i );
59 TLabelsImage* GetOutputLabels( );
60 const TLabelsImage* GetOutputLabels( ) const;
62 TLabel GetOutsideLabel( ) const;
63 void SetOutsideLabel( const TLabel& v );
66 RandomWalkLabelling( );
67 virtual ~RandomWalkLabelling( );
69 virtual void _PrepareSeeds( const itk::DataObject* reference ) override;
70 virtual void _PostComputeOutputValue( TNode& n ) override;
71 virtual void _Reinitialize( ) override;
74 // Purposely not implemented
75 RandomWalkLabelling( const Self& other );
76 Self& operator=( const Self& other );
84 double m_LowerThreshold;
85 double m_UpperThreshold;
87 unsigned long m_CurrIdx;
90 #ifndef ITK_MANUAL_INSTANTIATION
91 # include "RandomWalkLabelling.hxx"
92 #endif // ITK_MANUAL_INSTANTIATION
93 #endif // __RandomWalkLabelling__h__