]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Filters/RandomWalker.h
...
[FrontAlgorithms.git] / lib / fpa / Filters / RandomWalker.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Filters__RandomWalker__h__
6 #define __fpa__Filters__RandomWalker__h__
7
8 #include <itkFunctionBase.h>
9 #include <fpa/Config.h>
10 #include <fpa/Filters/PriorityQueueAlgorithm.h>
11 #include <fpa/Functors/VertexFunction.h>
12
13 namespace fpa
14 {
15   namespace Filters
16   {
17     /**
18      */
19     template< class _TDataInterface >
20     class RandomWalker
21       : public fpa::Filters::PriorityQueueAlgorithm< _TDataInterface >
22     {
23     public:
24       typedef _TDataInterface TDataInterface;
25       typedef fpa::Filters::PriorityQueueAlgorithm< TDataInterface > Superclass;
26       typedef RandomWalker                    Self;
27       typedef itk::SmartPointer< Self >       Pointer;
28       typedef itk::SmartPointer< const Self > ConstPointer;
29
30       typedef typename TDataInterface::TTraits TTraits;
31       fpaTraitsMacro( typename TTraits );
32       typedef TOutputValue TCost;
33       typedef TMark        TLabel;
34
35       typedef itk::FunctionBase< TCost, TCost >               TScalarWeight;
36       typedef fpa::Functors::VertexFunction< TVertex, TCost > TVertexWeight;
37
38     public:
39       itkTypeMacro(
40         fpa::Filters::RandomWalker, fpa::Filters::PriorityQueueAlgorithm
41         );
42
43       itkGetConstObjectMacro( ScalarWeight, TScalarWeight );
44       itkGetObjectMacro( ScalarWeight, TScalarWeight );
45
46       itkGetConstObjectMacro( VertexWeight, TVertexWeight );
47       itkGetObjectMacro( VertexWeight, TVertexWeight );
48
49     public:
50       void SetWeightFunction( TScalarWeight* p );
51       void SetWeightFunction( TVertexWeight* p );
52
53     protected:
54       RandomWalker( );
55       virtual ~RandomWalker( );
56
57       virtual void _PostComputeOutputValue( TNode& n ) override;
58       virtual void _PreComputeOutputValue( TNode& n ) override;
59
60     private:
61       RandomWalker( const Self& other );
62       Self& operator=( const Self& other );
63
64     protected:
65       typename TScalarWeight::Pointer m_ScalarWeight;
66       typename TVertexWeight::Pointer m_VertexWeight;
67     };
68
69   } // ecapseman
70
71 } // ecapseman
72
73 #ifndef ITK_MANUAL_INSTANTIATION
74 #  include <fpa/Filters/RandomWalker.hxx>
75 #endif // ITK_MANUAL_INSTANTIATION
76 #endif // __fpa__Filters__RandomWalker__h__
77 // eof - $RCSfile$