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::TSpace TSpace;
35 typedef typename Superclass::TMinimumSpanningTree TMinimumSpanningTree;
36 typedef typename Superclass::TCostFunction TCostFunction;
37 typedef typename Superclass::TConversionFunction TConversionFunction;
38 typedef typename Superclass::_TVertices TVertices;
40 typedef typename Superclass::TStartEvent TStartEvent;
41 typedef typename Superclass::TStartLoopEvent TStartLoopEvent;
42 typedef typename Superclass::TEndEvent TEndEvent;
43 typedef typename Superclass::TEndLoopEvent TEndLoopEvent;
44 typedef typename Superclass::TAliveEvent TAliveEvent;
45 typedef typename Superclass::TFrontEvent TFrontEvent;
46 typedef typename Superclass::TFreezeEvent TFreezeEvent;
49 Superclass::TStartBacktrackingEvent TStartBacktrackingEvent;
51 Superclass::TEndBacktrackingEvent TEndBacktrackingEvent;
53 Superclass::TBacktrackingEvent TBacktrackingEvent;
55 typedef unsigned short TLabel;
56 typedef itk::Image< TLabel, I::ImageDimension > TLabelImage;
59 UniqueValuesContainer< TVertex, TVertexCompare > TUniqueVertices;
61 MatrixValuesContainer< TVertex, TLabel, TVertexCompare > TBranches;
64 typedef typename Superclass::_TVertices _TVertices;
65 typedef typename Superclass::_TCollision _TCollision;
66 typedef typename Superclass::_TCollisionsRow _TCollisionsRow;
67 typedef typename Superclass::_TCollisions _TCollisions;
68 typedef typename Superclass::_TNode _TNode;
69 typedef typename Superclass::_TNodes _TNodes;
71 typedef typename I::PixelType _TPixel;
72 typedef typename I::RegionType _TRegion;
73 typedef typename I::SizeType _TSize;
75 typedef std::pair< TResult, TVertex > _TCandidate;
76 typedef std::multimap< TResult, TVertex > _TCandidates;
80 itkTypeMacro( DijkstraWithEndPointDetection, Dijkstra );
82 itkBooleanMacro( CorrectSeeds );
83 itkBooleanMacro( CorrectEndPoints );
85 itkGetConstMacro( CorrectSeeds, bool );
86 itkGetConstMacro( CorrectEndPoints, bool );
87 itkGetConstMacro( SafetyNeighborhoodSize, unsigned int );
89 itkGetConstMacro( NumberOfBranches, unsigned long );
91 itkSetMacro( CorrectSeeds, bool );
92 itkSetMacro( CorrectEndPoints, bool );
93 itkSetMacro( SafetyNeighborhoodSize, unsigned int );
96 TLabelImage* GetLabelImage( );
97 const TLabelImage* GetLabelImage( ) const;
98 void GraftLabelImage( itk::DataObject* obj );
100 TUniqueVertices* GetEndPoints( );
101 const TUniqueVertices* GetEndPoints( ) const;
102 void GraftEndPoints( itk::DataObject* obj );
104 TUniqueVertices* GetBifurcations( );
105 const TUniqueVertices* GetBifurcations( ) const;
106 void GraftBifurcations( itk::DataObject* obj );
108 TBranches* GetBranches( );
109 const TBranches* GetBranches( ) const;
110 void GraftBranches( itk::DataObject* obj );
113 DijkstraWithEndPointDetection( );
114 virtual ~DijkstraWithEndPointDetection( );
116 virtual void _BeforeGenerateData( );
117 virtual void _AfterGenerateData( );
118 virtual void _SetResult( const TVertex& v, const _TNode& n );
120 void _EndPointsAndBifurcations( );
121 void _FindBranches( );
124 _TRegion _Region( const TVertex& c, const double& r );
127 TVertex _MaxInRegion(
128 const _T* image, const TVertex& v, const double& r
132 // Purposely not implemented
133 DijkstraWithEndPointDetection( const Self& other );
134 Self& operator=( const Self& other );
137 unsigned int m_LabelImageIndex;
138 unsigned int m_BifurcationsIndex;
139 unsigned int m_EndPointsIndex;
140 unsigned int m_BranchesIndex;
143 bool m_CorrectEndPoints;
144 unsigned int m_SafetyNeighborhoodSize;
146 _TCandidates m_Candidates;
147 unsigned long m_NumberOfBranches;
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include <fpa/Image/DijkstraWithEndPointDetection.hxx>
156 #endif // ITK_MANUAL_INSTANTIATION
158 #endif // __FPA__IMAGE__DIJKSTRAWITHENDPOINTDETECTION__H__