1 #ifndef __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__
2 #define __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__
6 #include <fpa/Image/Dijkstra.h>
7 #include <fpa/Base/MatrixValuesContainer.h>
8 #include <fpa/Base/UniqueValuesContainer.h>
15 * @param I Input image type
16 * @param O Output image type
18 template< class I, class O >
19 class DijkstraWithEndPointDetection
20 : public Dijkstra< I, O >
23 typedef DijkstraWithEndPointDetection Self;
24 typedef Dijkstra< I, O > Superclass;
25 typedef itk::SmartPointer< Self > Pointer;
26 typedef itk::SmartPointer< const Self > ConstPointer;
28 typedef typename Superclass::TInputImage TInputImage;
29 typedef typename Superclass::TOutputImage TOutputImage;
30 typedef typename Superclass::TVertex TVertex;
31 typedef typename Superclass::TVertexCompare TVertexCompare;
32 typedef typename Superclass::TValue TValue;
33 typedef typename Superclass::TResult TResult;
34 typedef typename Superclass::TMinimumSpanningTree TMinimumSpanningTree;
35 typedef typename Superclass::TCostFunction TCostFunction;
36 typedef typename Superclass::TConversionFunction TConversionFunction;
37 typedef typename Superclass::_TVertices TVertices;
39 typedef typename Superclass::TStartEvent TStartEvent;
40 typedef typename Superclass::TStartLoopEvent TStartLoopEvent;
41 typedef typename Superclass::TEndEvent TEndEvent;
42 typedef typename Superclass::TEndLoopEvent TEndLoopEvent;
43 typedef typename Superclass::TAliveEvent TAliveEvent;
44 typedef typename Superclass::TFrontEvent TFrontEvent;
45 typedef typename Superclass::TFreezeEvent TFreezeEvent;
48 Superclass::TStartBacktrackingEvent TStartBacktrackingEvent;
50 Superclass::TEndBacktrackingEvent TEndBacktrackingEvent;
52 Superclass::TBacktrackingEvent TBacktrackingEvent;
54 typedef unsigned short TLabel;
55 typedef itk::Image< TLabel, I::ImageDimension > TLabelImage;
57 typedef fpa::Base::UniqueValuesContainer< TVertex, TVertexCompare > TUniqueVertices;
58 typedef fpa::Base::MatrixValuesContainer< TVertex, TLabel, TVertexCompare > TBranches;
61 typedef typename Superclass::_TVertices _TVertices;
62 typedef typename Superclass::_TCollision _TCollision;
63 typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
64 typedef typename Superclass::_TCollisions _TCollisions;
65 typedef typename Superclass::_TNode _TNode;
66 typedef typename Superclass::_TNodes _TNodes;
68 typedef typename I::PixelType _TPixel;
69 typedef typename I::RegionType _TRegion;
70 typedef typename I::SizeType _TSize;
72 typedef std::pair< TResult, TVertex > _TCandidate;
73 typedef std::multimap< TResult, TVertex > _TCandidates;
77 itkTypeMacro( DijkstraWithEndPointDetection, Dijkstra );
79 itkBooleanMacro( CorrectSeeds );
80 itkBooleanMacro( CorrectEndPoints );
82 itkGetConstMacro( CorrectSeeds, bool );
83 itkGetConstMacro( CorrectEndPoints, bool );
84 itkGetConstMacro( SafetyNeighborhoodSize, unsigned int );
86 itkGetConstMacro( NumberOfBranches, unsigned long );
88 itkSetMacro( CorrectSeeds, bool );
89 itkSetMacro( CorrectEndPoints, bool );
90 itkSetMacro( SafetyNeighborhoodSize, unsigned int );
93 TLabelImage* GetLabelImage( );
94 const TLabelImage* GetLabelImage( ) const;
95 void GraftLabelImage( itk::DataObject* obj );
97 TUniqueVertices* GetEndPoints( );
98 const TUniqueVertices* GetEndPoints( ) const;
99 void GraftEndPoints( itk::DataObject* obj );
101 TUniqueVertices* GetBifurcations( );
102 const TUniqueVertices* GetBifurcations( ) const;
103 void GraftBifurcations( itk::DataObject* obj );
105 TBranches* GetBranches( );
106 const TBranches* GetBranches( ) const;
107 void GraftBranches( itk::DataObject* obj );
110 DijkstraWithEndPointDetection( );
111 virtual ~DijkstraWithEndPointDetection( );
113 virtual void _BeforeGenerateData( );
114 virtual void _AfterGenerateData( );
115 virtual void _SetResult( const TVertex& v, const _TNode& n );
117 void _EndPointsAndBifurcations( );
118 void _FindBranches( );
121 _TRegion _Region( const TVertex& c, const double& r );
124 TVertex _MaxInRegion(
125 const _T* image, const TVertex& v, const double& r
129 // Purposely not implemented
130 DijkstraWithEndPointDetection( const Self& other );
131 Self& operator=( const Self& other );
134 unsigned int m_LabelImageIndex;
135 unsigned int m_BifurcationsIndex;
136 unsigned int m_EndPointsIndex;
137 unsigned int m_BranchesIndex;
140 bool m_CorrectEndPoints;
141 unsigned int m_SafetyNeighborhoodSize;
143 _TCandidates m_Candidates;
144 unsigned long m_NumberOfBranches;
151 #include <fpa/Image/DijkstraWithEndPointDetection.hxx>
153 #endif // __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__