]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/DijkstraWithSphereBacktracking.h
Even more tests
[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 unsigned short                         TMark;
35       typedef itk::Image< TMark, I::ImageDimension > TMarkImage;
36
37
38       typedef typename Superclass::TEndEvent             TEndEvent;
39       typedef typename Superclass::TBacktrackingEvent    TBacktrackingEvent;
40       typedef typename Superclass::TEndBacktrackingEvent TEndBacktrackingEvent;
41
42     protected:
43       typedef std::pair< TCost, TVertex >     _TCandidate;
44       typedef std::multimap< TCost, TVertex > _TCandidates;
45       typedef typename Superclass::_TNode     _TNode;
46
47       typedef typename I::PixelType  _TPixel;
48       typedef typename I::RegionType _TRegion;
49       typedef typename I::SizeType   _TSize;
50
51     public:
52       itkNewMacro( Self );
53       itkTypeMacro( DijkstraWithSphereBacktracking, Dijkstra );
54
55       itkGetConstMacro( FinalTree, TTree );
56       itkGetConstMacro( EndPoints, TVertices );
57       itkGetConstMacro( BifurcationPoints, TVertices );
58       itkGetConstMacro( NumberOfBranches, TMark );
59
60     public:
61       TMarkImage* GetOutputMarkImage( );
62       const TMarkImage* GetOutputMarkImage( ) const;
63
64     protected:
65       DijkstraWithSphereBacktracking( );
66       virtual ~DijkstraWithSphereBacktracking( );
67
68       virtual void _BeforeMainLoop( );
69       virtual void _AfterMainLoop( );
70       virtual bool _UpdateNeigh( _TNode& nn, const _TNode& n );
71       virtual bool _UpdateResult( _TNode& n );
72
73       _TRegion _Region( const TVertex& c, const double& r );
74
75     private:
76       DijkstraWithSphereBacktracking( const Self& other );
77       Self& operator=( const Self& other );
78
79     protected:
80       _TCandidates m_Candidates;
81       TTree        m_FinalTree;
82       TVertices    m_BifurcationPoints;
83       TVertices    m_EndPoints;
84       TMark        m_NumberOfBranches;
85     };
86
87   } // ecapseman
88
89 } // ecapseman
90
91 #include <fpa/Image/DijkstraWithSphereBacktracking.hxx>
92
93 #endif // __FPA__IMAGE__DIJKSTRAWITHSPHEREBACKTRACKING__H__
94
95 // eof - $RCSfile$