]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/DijkstraWithSphereBacktracking.h
Gaussian model estimator debugged
[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 unsigned short                         TMark;
32       typedef itk::Image< TMark, I::ImageDimension > TMarkImage;
33
34       typedef typename Superclass::TTraits::TVertexCmp   TVertexCmp;
35       typedef std::pair< TVertex, TMark >                TTreeNode;
36       typedef std::map< TVertex, TTreeNode, TVertexCmp > TTree;
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( FullTree, TTree );
56       itkGetConstMacro( ReducedTree, TTree );
57       itkGetConstMacro( EndPoints, TVertices );
58       itkGetConstMacro( BifurcationPoints, TVertices );
59       itkGetConstMacro( NumberOfBranches, TMark );
60
61     public:
62       TMarkImage* GetOutputMarkImage( );
63       const TMarkImage* GetOutputMarkImage( ) const;
64
65     protected:
66       DijkstraWithSphereBacktracking( );
67       virtual ~DijkstraWithSphereBacktracking( );
68
69       virtual void _BeforeMainLoop( );
70       virtual void _AfterMainLoop( );
71       virtual bool _UpdateNeigh( _TNode& nn, const _TNode& n );
72       virtual bool _UpdateResult( _TNode& n );
73
74       _TRegion _Region( const TVertex& c, const double& r );
75
76     private:
77       DijkstraWithSphereBacktracking( const Self& other );
78       Self& operator=( const Self& other );
79
80     protected:
81       _TCandidates m_Candidates;
82       TTree        m_FullTree;
83       TTree        m_ReducedTree;
84       TVertices    m_BifurcationPoints;
85       TVertices    m_EndPoints;
86       TMark        m_NumberOfBranches;
87     };
88
89   } // ecapseman
90
91 } // ecapseman
92
93 #include <fpa/Image/DijkstraWithSphereBacktracking.hxx>
94
95 #endif // __FPA__IMAGE__DIJKSTRAWITHSPHEREBACKTRACKING__H__
96
97 // eof - $RCSfile$