X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffpa%2FBase%2FDijkstra.h;h=115447be0e37bc2809091ac405a45d032088fc74;hb=4dc9dddd928daeb91104d5c18fa73a02975cedeb;hp=cfa06b30698344b1ccacb33b47376861a0508f3c;hpb=6fcc9fc78c44fa789bf092e2897cb6b391259b42;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/Dijkstra.h b/lib/fpa/Base/Dijkstra.h index cfa06b3..115447b 100644 --- a/lib/fpa/Base/Dijkstra.h +++ b/lib/fpa/Base/Dijkstra.h @@ -3,6 +3,7 @@ #include #include +#include namespace fpa { @@ -11,27 +12,31 @@ namespace fpa /** * Dijkstra is a front propagation algorithm that minimizes costs * - * @param V Vertex type. - * @param C Vertex value type. - * @param R Result value type. - * @param VC Vertex lexicographical compare. - * @param B Base class for this algorithm. It should be any itk-based - * filter (itk::ProcessObject). + * @param V Vertex type. + * @param C Vertex value type. + * @param R Result value type. + * @param S Space type where vertices are. + * @param VC Vertex lexicographical compare. + * @param MST Minimum spanning tree type. + * @param B Base class for this algorithm. It should be any itk-based + * filter (itk::ProcessObject). * */ - template< class V, class C, class R, class VC, class B > + template< class V, class C, class R, class S, class VC, class MST, class B > class Dijkstra - : public Algorithm< V, C, R, VC, B > + : public Algorithm< V, C, R, S, VC, B > { public: typedef Dijkstra Self; - typedef Algorithm< V, C, R, VC, B > Superclass; + typedef Algorithm< V, C, R, S, VC, B > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; + typedef MST TMinimumSpanningTree; typedef typename Superclass::TVertex TVertex; typedef typename Superclass::TValue TValue; typedef typename Superclass::TResult TResult; + typedef typename Superclass::TSpace TSpace; typedef typename Superclass::TVertexCompare TVertexCompare; typedef typename Superclass::TStartEvent TStartEvent; @@ -68,22 +73,37 @@ namespace fpa public: itkTypeMacro( Dijkstra, Algorithm ); + itkBooleanMacro( LocalCosts ); + itkBooleanMacro( FillNodeQueue ); + itkGetConstMacro( LocalCosts, bool ); + itkGetConstMacro( FillNodeQueue, bool ); + itkSetMacro( LocalCosts, bool ); + itkSetMacro( FillNodeQueue, bool ); + + public: + TMinimumSpanningTree* GetMinimumSpanningTree( ); + const TMinimumSpanningTree* GetMinimumSpanningTree( ) const; + void GraftMinimumSpanningTree( itk::DataObject* obj ); + protected: Dijkstra( ); virtual ~Dijkstra( ); virtual TResult _Cost( const TVertex& v, const TVertex& p ) const = 0; + virtual void _BeforeGenerateData( ) ITK_OVERRIDE; + // Results-related abstract methods virtual bool _ComputeNeighborResult( TResult& result, const TVertex& neighbor, const TVertex& parent - ) const; + ) const ITK_OVERRIDE; + virtual void _SetResult( const TVertex& v, const _TNode& n ) ITK_OVERRIDE; // Queue-related abstract methods - virtual bool _IsQueueEmpty( ) const; - virtual void _QueuePush( const TVertex& v, const _TNode& n ); - virtual void _QueuePop( TVertex& v, _TNode& n ); - virtual void _QueueClear( ); + virtual bool _IsQueueEmpty( ) const ITK_OVERRIDE; + virtual void _QueuePush( const TVertex& v, const _TNode& n ) ITK_OVERRIDE; + virtual void _QueuePop( TVertex& v, _TNode& n ) ITK_OVERRIDE; + virtual void _QueueClear( ) ITK_OVERRIDE; private: // Purposely not implemented @@ -91,14 +111,19 @@ namespace fpa Self& operator=( const Self& other ); protected: + bool m_LocalCosts; + bool m_FillNodeQueue; _TQueue m_Queue; + unsigned int m_MSTIdx; }; } // ecapseman } // ecapseman +#ifndef ITK_MANUAL_INSTANTIATION #include +#endif // ITK_MANUAL_INSTANTIATION #endif // __FPA__BASE__DIJKSTRA__H__