]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Base/Dijkstra.h
...
[FrontAlgorithms.git] / libs / fpa / Base / Dijkstra.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Base__Dijkstra__h__
7 #define __fpa__Base__Dijkstra__h__
8
9 #include <itkFunctionBase.h>
10
11 namespace fpa
12 {
13   namespace Base
14   {
15     /**
16      */
17     template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
18     class Dijkstra
19       : public _TFilter,
20         public _TMarksInterface,
21         public _TSeedsInterface
22     {
23     public:
24       typedef Dijkstra                        Self;
25       typedef _TFilter                        Superclass;
26       typedef _TMarksInterface                TMarksInterface;
27       typedef _TSeedsInterface                TSeedsInterface;
28       typedef itk::SmartPointer< Self >       Pointer;
29       typedef itk::SmartPointer< const Self > ConstPointer;
30
31       typedef typename Superclass::TInputValue  TInputValue;
32       typedef typename Superclass::TOutputValue TOutputValue;
33       typedef typename Superclass::TVertex      TVertex;
34       typedef typename Superclass::TVertices    TVertices;
35
36       typedef itk::FunctionBase< TInputValue, TOutputValue > TIntensityFunctor;
37       typedef itk::FunctionBase< TVertex, TOutputValue >     TVertexFunctor;
38
39     protected:
40       struct _TNode
41       {
42         TVertex Vertex;
43         TVertex Parent;
44         TOutputValue Cost;
45         _TNode( const TVertex& v, const TVertex& p )
46           {
47             this->Vertex = v;
48             this->Parent = p;
49             this->Cost = TOutputValue( 0 );
50           }
51         bool operator<( const _TNode& b ) const
52           {
53             return( this->Cost < b.Cost );
54           }
55       };
56
57     public:
58       itkTypeMacro( Dijkstra, TFilter );
59
60     public:
61       const TIntensityFunctor* GetIntensityFunctor( ) const;
62       const TVertexFunctor* GetVertexFunctor( ) const;
63
64       void SetFunctor( TIntensityFunctor* functor );
65       void SetFunctor( TVertexFunctor* functor );
66
67     protected:
68       Dijkstra( );
69       virtual ~Dijkstra( );
70
71       virtual void GenerateData( ) override;
72
73     private:
74       Dijkstra( const Self& other );
75       Self& operator=( const Self& other );
76
77     protected:
78       typename TIntensityFunctor::Pointer m_IntensityFunctor;
79       typename TVertexFunctor::Pointer m_VertexFunctor;
80     };
81
82   } // ecapseman
83
84 } // ecapseman
85
86 #ifndef ITK_MANUAL_INSTANTIATION
87 #  include <fpa/Base/Dijkstra.hxx>
88 #endif // ITK_MANUAL_INSTANTIATION
89
90 #endif // __fpa__Base__Dijkstra__h__
91
92 // eof - $RCSfile$