]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/DijkstraWithSphereBacktracking.h
0cc0c4f637b7fabc5c6808db06bc0f25bfd26381
[FrontAlgorithms.git] / lib / fpa / Image / DijkstraWithSphereBacktracking.h
1 #ifndef __FPA__IMAGE__DIJKSTRAWITHSPHEREBACKTRACKING__H__
2 #define __FPA__IMAGE__DIJKSTRAWITHSPHEREBACKTRACKING__H__
3
4 #include <map>
5 #include <deque>
6 #include <utility>
7 #include <fpa/Image/Dijkstra.h>
8
9 namespace fpa
10 {
11   namespace Image
12   {
13     /**
14      * @param I Input image type
15      */
16     template< class I, class C >
17     class DijkstraWithSphereBacktracking
18       : public fpa::Image::Dijkstra< I, C >
19     {
20     public:
21       typedef DijkstraWithSphereBacktracking  Self;
22       typedef fpa::Image::Dijkstra< I, C >    Superclass;
23       typedef itk::SmartPointer< Self >       Pointer;
24       typedef itk::SmartPointer< const Self > ConstPointer;
25
26       typedef typename Superclass::TCost          TCost;
27       typedef typename Superclass::TVertex        TVertex;
28       typedef typename Superclass::InputImageType TImage;
29       typedef std::deque< TVertex >               TVertices;
30
31       typedef typename Superclass::TTraits::TVertexCmp TVertexCmp;
32       typedef std::map< TVertex, TVertex, TVertexCmp > TTree;
33
34       typedef typename Superclass::TEndEvent             TEndEvent;
35       typedef typename Superclass::TBacktrackingEvent    TBacktrackingEvent;
36       typedef typename Superclass::TEndBacktrackingEvent TEndBacktrackingEvent;
37
38     protected:
39       typedef std::pair< TCost, TVertex >     _TCandidate;
40       typedef std::multimap< TCost, TVertex > _TCandidates;
41       typedef typename Superclass::_TNode     _TNode;
42
43       typedef typename I::PixelType  _TPixel;
44       typedef typename I::RegionType _TRegion;
45       typedef typename I::SizeType   _TSize;
46
47     public:
48       itkNewMacro( Self );
49       itkTypeMacro( DijkstraWithSphereBacktracking, Dijkstra );
50
51       itkGetConstMacro( FinalTree, TTree );
52       itkGetConstMacro( EndPoints, TVertices );
53
54     protected:
55       DijkstraWithSphereBacktracking( );
56       virtual ~DijkstraWithSphereBacktracking( );
57
58       virtual void _BeforeMainLoop( );
59       virtual void _AfterMainLoop( );
60       virtual bool _UpdateNeigh( _TNode& nn, const _TNode& n );
61       virtual bool _UpdateResult( _TNode& n );
62
63       _TRegion _Region( const TVertex& c, const double& r );
64
65     private:
66       DijkstraWithSphereBacktracking( const Self& other );
67       Self& operator=( const Self& other );
68
69     protected:
70       _TCandidates m_Candidates;
71       TTree        m_FinalTree;
72       TVertices    m_EndPoints;
73     };
74
75   } // ecapseman
76
77 } // ecapseman
78
79 #include <fpa/Image/DijkstraWithSphereBacktracking.hxx>
80
81 #endif // __FPA__IMAGE__DIJKSTRAWITHSPHEREBACKTRACKING__H__
82
83 // eof - $RCSfile$