]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/DijkstraWithEndPointDetection.h
ecf197d94be5acd803ab41196f4ef848f884e73e
[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::TValue              TValue;
29       typedef typename Superclass::TResult             TResult;
30       typedef typename Superclass::TCostFunction       TCostFunction;
31       typedef typename Superclass::TConversionFunction TConversionFunction;
32       typedef typename Superclass::_TVertices          TVertices;
33
34       typedef typename Superclass::TStartEvent     TStartEvent;
35       typedef typename Superclass::TStartLoopEvent TStartLoopEvent;
36       typedef typename Superclass::TEndEvent       TEndEvent;
37       typedef typename Superclass::TEndLoopEvent   TEndLoopEvent;
38       typedef typename Superclass::TAliveEvent     TAliveEvent;
39       typedef typename Superclass::TFrontEvent     TFrontEvent;
40       typedef typename Superclass::TFreezeEvent    TFreezeEvent;
41
42       typedef typename Superclass::TStartBacktrackingEvent TStartBacktrackingEvent;
43       typedef typename Superclass::TEndBacktrackingEvent TEndBacktrackingEvent;
44       typedef typename Superclass::TBacktrackingEvent TBacktrackingEvent;
45
46       typedef unsigned short                          TLabel;
47       typedef itk::Image< TLabel, I::ImageDimension > TLabelImage;
48
49     protected:
50       typedef typename Superclass::_TVertices      _TVertices;
51       typedef typename Superclass::_TCollision     _TCollision;
52       typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
53       typedef typename Superclass::_TCollisions    _TCollisions;
54       typedef typename Superclass::_TNode          _TNode;
55       typedef typename Superclass::_TNodes         _TNodes;
56
57       typedef typename I::PixelType  _TPixel;
58       typedef typename I::RegionType _TRegion;
59       typedef typename I::SizeType   _TSize;
60
61       typedef std::pair< TResult, TVertex >     _TCandidate;
62       typedef std::multimap< TResult, TVertex > _TCandidates;
63
64     public:
65       itkNewMacro( Self );
66       itkTypeMacro( DijkstraWithEndPointDetection, Dijkstra );
67
68       itkGetConstMacro( EndPoints, TVertices );
69       itkGetConstMacro( BifurcationPoints, TVertices );
70       itkGetConstMacro( NumberOfBranches, unsigned long );
71
72     public:
73       TLabelImage* GetLabelImage( );
74       const TLabelImage* GetLabelImage( ) const;
75       void GraftLabelImage( itk::DataObject* obj );
76
77     protected:
78       DijkstraWithEndPointDetection( );
79       virtual ~DijkstraWithEndPointDetection( );
80
81       virtual void _BeforeGenerateData( );
82       virtual void _AfterGenerateData( );
83       virtual void _SetResult( const TVertex& v, const _TNode& n );
84
85       _TRegion _Region( const TVertex& c, const double& r );
86
87     private:
88       // Purposely not implemented
89       DijkstraWithEndPointDetection( const Self& other );
90       Self& operator=( const Self& other );
91
92     protected:
93       unsigned int m_LabelImageIndex;
94
95       _TCandidates  m_Candidates;
96       TVertices     m_BifurcationPoints;
97       TVertices     m_EndPoints;
98       unsigned long m_NumberOfBranches;
99     };
100
101   } // ecapseman
102
103 } // ecapseman
104
105 #include <fpa/Image/DijkstraWithEndPointDetection.hxx>
106
107 #endif // __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__
108
109 // eof - $RCSfile$