]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/Dijkstra.h
...
[FrontAlgorithms.git] / lib / fpa / Base / Dijkstra.h
index 69fe86a798289509fb31557b6927c90dbbd64466..e711f4f56c844cde21766d47a6c2e789683737a4 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <vector>
 #include <fpa/Base/Algorithm.h>
+#include <fpa/Base/MinimumSpanningTree.h>
 
 namespace fpa
 {
@@ -11,16 +12,17 @@ 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 S  Space type where vertices are.
-     * @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 S, 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, S, VC, B >
     {
@@ -30,12 +32,12 @@ namespace fpa
       typedef itk::SmartPointer< Self >        Pointer;
       typedef itk::SmartPointer< const Self >  ConstPointer;
 
-      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::TMinimumSpanningTree TMinimumSpanningTree;
+      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;
       typedef typename Superclass::TStartLoopEvent TStartLoopEvent;
@@ -72,8 +74,16 @@ namespace fpa
       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( );
@@ -81,10 +91,13 @@ namespace fpa
 
       virtual TResult _Cost( const TVertex& v, const TVertex& p ) const = 0;
 
+      virtual void _BeforeGenerateData( );
+
       // Results-related abstract methods
       virtual bool _ComputeNeighborResult(
         TResult& result, const TVertex& neighbor, const TVertex& parent
         ) const;
+      virtual void _SetResult( const TVertex& v, const _TNode& n );
 
       // Queue-related abstract methods
       virtual bool _IsQueueEmpty( ) const;
@@ -99,14 +112,18 @@ namespace fpa
 
     protected:
       bool m_LocalCosts;
+      bool m_FillNodeQueue;
       _TQueue m_Queue;
+      unsigned int m_MSTIdx;
     };
 
   } // ecapseman
 
 } // ecapseman
 
+#ifndef ITK_MANUAL_INSTANTIATION
 #include <fpa/Base/Dijkstra.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
 
 #endif // __FPA__BASE__DIJKSTRA__H__