]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/DijkstraWithEndPointDetection.h
881b8f8e56fb4bfd8824fa9e02a96fd4cea828a4
[FrontAlgorithms.git] / lib / fpa / Image / DijkstraWithEndPointDetection.h
1 #ifndef __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__
2 #define __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__
3
4 #include <itkImage.h>
5 #include <fpa/Image/Dijkstra.h>
6
7 namespace fpa
8 {
9   namespace Image
10   {
11     /**
12      * @param I Input image type
13      * @param O Output image type
14      */
15     template< class I, class O >
16     class DijkstraWithEndPointDetection
17       : public Dijkstra< I, O >
18     {
19     public:
20       typedef DijkstraWithEndPointDetection   Self;
21       typedef Dijkstra< I, O >                Superclass;
22       typedef itk::SmartPointer< Self >       Pointer;
23       typedef itk::SmartPointer< const Self > ConstPointer;
24
25       typedef typename Superclass::TInputImage         TInputImage;
26       typedef typename Superclass::TOutputImage        TOutputImage;
27       typedef typename Superclass::TVertex             TVertex;
28       typedef typename Superclass::TVertexCompare      TVertexCompare;
29       typedef typename Superclass::TValue              TValue;
30       typedef typename Superclass::TResult             TResult;
31       typedef typename Superclass::TCostFunction       TCostFunction;
32       typedef typename Superclass::TConversionFunction TConversionFunction;
33       typedef typename Superclass::_TVertices          TVertices;
34
35       typedef typename Superclass::TStartEvent     TStartEvent;
36       typedef typename Superclass::TStartLoopEvent TStartLoopEvent;
37       typedef typename Superclass::TEndEvent       TEndEvent;
38       typedef typename Superclass::TEndLoopEvent   TEndLoopEvent;
39       typedef typename Superclass::TAliveEvent     TAliveEvent;
40       typedef typename Superclass::TFrontEvent     TFrontEvent;
41       typedef typename Superclass::TFreezeEvent    TFreezeEvent;
42
43       typedef typename Superclass::TStartBacktrackingEvent TStartBacktrackingEvent;
44       typedef typename Superclass::TEndBacktrackingEvent TEndBacktrackingEvent;
45       typedef typename Superclass::TBacktrackingEvent TBacktrackingEvent;
46
47       typedef unsigned short                          TLabel;
48       typedef itk::Image< TLabel, I::ImageDimension > TLabelImage;
49
50     protected:
51       typedef typename Superclass::_TVertices      _TVertices;
52       typedef typename Superclass::_TCollision     _TCollision;
53       typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
54       typedef typename Superclass::_TCollisions    _TCollisions;
55       typedef typename Superclass::_TNode          _TNode;
56       typedef typename Superclass::_TNodes         _TNodes;
57
58       typedef typename I::PixelType  _TPixel;
59       typedef typename I::RegionType _TRegion;
60       typedef typename I::SizeType   _TSize;
61
62       typedef std::pair< TResult, TVertex >     _TCandidate;
63       typedef std::multimap< TResult, TVertex > _TCandidates;
64
65     public:
66       itkNewMacro( Self );
67       itkTypeMacro( DijkstraWithEndPointDetection, Dijkstra );
68
69       itkGetConstMacro( EndPoints, TVertices );
70       itkGetConstMacro( BifurcationPoints, TVertices );
71       itkGetConstMacro( NumberOfBranches, unsigned long );
72
73     public:
74       TLabelImage* GetLabelImage( );
75       const TLabelImage* GetLabelImage( ) const;
76       void GraftLabelImage( itk::DataObject* obj );
77
78     protected:
79       DijkstraWithEndPointDetection( );
80       virtual ~DijkstraWithEndPointDetection( );
81
82       virtual void _BeforeGenerateData( );
83       virtual void _AfterGenerateData( );
84       virtual void _SetResult( const TVertex& v, const _TNode& n );
85
86       _TRegion _Region( const TVertex& c, const double& r );
87
88     private:
89       // Purposely not implemented
90       DijkstraWithEndPointDetection( const Self& other );
91       Self& operator=( const Self& other );
92
93     protected:
94       unsigned int m_LabelImageIndex;
95
96       _TCandidates  m_Candidates;
97       TVertices     m_BifurcationPoints;
98       TVertices     m_EndPoints;
99       unsigned long m_NumberOfBranches;
100     };
101
102   } // ecapseman
103
104 } // ecapseman
105
106 #include <fpa/Image/DijkstraWithEndPointDetection.hxx>
107
108 #endif // __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__
109
110 // eof - $RCSfile$