]> 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 _TCostsImage, 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 _TCostsImage  TCostsImage;
19   typedef _TLabelsImage TLabelsImage;
20   typedef typename TCostsImage::PixelType  TScalar;
21   typedef typename TLabelsImage::PixelType TLabel;
22
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;
27
28   typedef fpa::DataStructures::Image::Path< TRawImage::ImageDimension > TPath;
29
30   typedef typename Superclass::TTraits TTraits;
31   fpaTraitsMacro( typename TTraits );
32
33 public:
34   itkNewMacro( Self );
35   itkTypeMacro( clab::RandomWalkLabelling, fpa::Filter::Image::RegionGrow );
36
37   itkGetConstMacro( InsideLabel, TLabel );
38   itkSetMacro( InsideLabel, TLabel );
39
40   itkGetConstMacro( LowerLabel, TLabel );
41   itkSetMacro( LowerLabel, TLabel );
42
43   itkGetConstMacro( UpperLabel, TLabel );
44   itkSetMacro( UpperLabel, TLabel );
45
46   itkGetConstMacro( Radius, double );
47   itkSetMacro( Radius, double );
48
49   itkGetConstMacro( LowerThreshold, double );
50   itkSetMacro( LowerThreshold, double );
51
52   itkGetConstMacro( UpperThreshold, double );
53   itkSetMacro( UpperThreshold, double );
54
55   itkGetConstMacro( MaxCost, TScalar );
56   itkSetMacro( MaxCost, TScalar );
57
58   fpaFilterInputMacro( InputCosts, TCostsImage );
59   fpaFilterInputMacro( InputPath, TPath );
60
61 public:
62   void SetInputImage( const TRawImage* i );
63
64   TLabelsImage* GetOutputLabels( );
65   const TLabelsImage* GetOutputLabels( ) const;
66
67   TLabel GetOutsideLabel( ) const;
68   void SetOutsideLabel( const TLabel& v );
69
70 protected:
71   RandomWalkLabelling( );
72   virtual ~RandomWalkLabelling( );
73
74   virtual void _PrepareSeeds( const itk::DataObject* reference ) override;
75   virtual void _PostComputeOutputValue( TNode& n ) override;
76   virtual void _Reinitialize( ) override;
77
78 private:
79   // Purposely not implemented
80   RandomWalkLabelling( const Self& other );
81   Self& operator=( const Self& other );
82
83 protected:
84   TLabel m_InsideLabel;
85   TLabel m_LowerLabel;
86   TLabel m_UpperLabel;
87
88   double m_Radius;
89   double m_LowerThreshold;
90   double m_UpperThreshold;
91
92   TScalar m_MaxCost;
93
94   unsigned long m_CurrIdx;
95 };
96
97 #ifndef ITK_MANUAL_INSTANTIATION
98 #  include "RandomWalkLabelling.hxx"
99 #endif // ITK_MANUAL_INSTANTIATION
100 #endif // __RandomWalkLabelling__h__
101
102 // eof - $RCSfile$