]> Creatis software - FrontAlgorithms.git/blob - appli/CTArteries/algorithms/RandomWalkLabelling.h
...
[FrontAlgorithms.git] / appli / CTArteries / algorithms / RandomWalkLabelling.h
1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __RandomWalkLabelling__h__
5 #define __RandomWalkLabelling__h__
6
7 #include <fpa/DataStructures/Image/Path.h>
8 #include <fpa/Filters/Image/RegionGrow.h>
9
10 /**
11  */
12 template< class _TRawImage, class _TLabelsImage >
13 class RandomWalkLabelling
14   : public fpa::Filters::Image::RegionGrow< _TRawImage, _TLabelsImage, typename _TLabelsImage::PixelType >
15 {
16 public:
17   typedef _TRawImage   TRawImage;
18   typedef _TLabelsImage TLabelsImage;
19   typedef typename TLabelsImage::PixelType TLabel;
20
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;
25
26   typedef fpa::DataStructures::Image::Path< TRawImage::ImageDimension > TPath;
27
28   typedef typename Superclass::TTraits TTraits;
29   fpaTraitsMacro( typename TTraits );
30
31 public:
32   itkNewMacro( Self );
33   itkTypeMacro( clab::RandomWalkLabelling, fpa::Filter::Image::RegionGrow );
34
35   itkGetConstMacro( InsideLabel, TLabel );
36   itkSetMacro( InsideLabel, TLabel );
37
38   itkGetConstMacro( LowerLabel, TLabel );
39   itkSetMacro( LowerLabel, TLabel );
40
41   itkGetConstMacro( UpperLabel, TLabel );
42   itkSetMacro( UpperLabel, TLabel );
43
44   itkGetConstMacro( Radius, double );
45   itkSetMacro( Radius, double );
46
47   itkGetConstMacro( LowerThreshold, double );
48   itkSetMacro( LowerThreshold, double );
49
50   itkGetConstMacro( UpperThreshold, double );
51   itkSetMacro( UpperThreshold, double );
52
53   fpaFilterInputMacro( InputMarks, TLabelsImage );
54   fpaFilterInputMacro( InputPath, TPath );
55
56 public:
57   void SetInputImage( const TRawImage* i );
58
59   TLabelsImage* GetOutputLabels( );
60   const TLabelsImage* GetOutputLabels( ) const;
61
62   TLabel GetOutsideLabel( ) const;
63   void SetOutsideLabel( const TLabel& v );
64
65 protected:
66   RandomWalkLabelling( );
67   virtual ~RandomWalkLabelling( );
68
69   virtual void _PrepareSeeds( const itk::DataObject* reference ) override;
70   virtual void _PostComputeOutputValue( TNode& n ) override;
71   virtual void _Reinitialize( ) override;
72
73 private:
74   // Purposely not implemented
75   RandomWalkLabelling( const Self& other );
76   Self& operator=( const Self& other );
77
78 protected:
79   TLabel m_InsideLabel;
80   TLabel m_LowerLabel;
81   TLabel m_UpperLabel;
82
83   double m_Radius;
84   double m_LowerThreshold;
85   double m_UpperThreshold;
86
87   unsigned long m_CurrIdx;
88 };
89
90 #ifndef ITK_MANUAL_INSTANTIATION
91 #  include "RandomWalkLabelling.hxx"
92 #endif // ITK_MANUAL_INSTANTIATION
93 #endif // __RandomWalkLabelling__h__
94
95 // eof - $RCSfile$