]> Creatis software - FrontAlgorithms.git/blobdiff - libs/fpa/Base/Dijkstra.h
...
[FrontAlgorithms.git] / libs / fpa / Base / Dijkstra.h
index 2c49c06b3ff9b79201c0c55dd83568fd03a0c042..d231c7c41da897886b69c63d97f0fca117908646 100644 (file)
@@ -7,6 +7,8 @@
 #define __fpa__Base__Dijkstra__h__
 
 #include <itkFunctionBase.h>
+#include <fpa/Base/MinimumSpanningTree.h>
+#include <fpa/Base/Functors/VertexParentBase.h>
 
 namespace fpa
 {
@@ -14,7 +16,7 @@ namespace fpa
   {
     /**
      */
-    template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+    template< class _TFilter, class _TMarksInterface, class _TSeedsInterface, class _TMST >
     class Dijkstra
       : public _TFilter,
         public _TMarksInterface,
@@ -25,6 +27,7 @@ namespace fpa
       typedef _TFilter                        Superclass;
       typedef _TMarksInterface                TMarksInterface;
       typedef _TSeedsInterface                TSeedsInterface;
+      typedef _TMST                           TMST;
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
@@ -34,7 +37,7 @@ namespace fpa
       typedef typename Superclass::TVertices    TVertices;
 
       typedef itk::FunctionBase< TInputValue, TOutputValue > TIntensityFunctor;
-      typedef itk::FunctionBase< TVertex, TOutputValue >     TVertexFunctor;
+      typedef fpa::Base::Functors::VertexParentBase< TVertex, TOutputValue > TVertexFunctor;
 
     protected:
       struct _TNode
@@ -42,15 +45,17 @@ namespace fpa
         TVertex Vertex;
         TVertex Parent;
         TOutputValue Cost;
-        _TNode( const TVertex& v, const TVertex& p )
+        unsigned long FrontId;
+        _TNode( const TVertex& v, const TVertex& p, const unsigned long& fId )
           {
             this->Vertex = v;
             this->Parent = p;
+            this->FrontId = fId;
             this->Cost = TOutputValue( 0 );
           }
         bool operator<( const _TNode& b ) const
           {
-            return( this->Cost < b.Cost );
+            return( b.Cost < this->Cost );
           }
       };
 
@@ -58,6 +63,9 @@ namespace fpa
       itkTypeMacro( Dijkstra, TFilter );
 
     public:
+      TMST* GetMinimumSpanningTree( );
+      const TMST* GetMinimumSpanningTree( ) const;
+
       const TIntensityFunctor* GetIntensityFunctor( ) const;
       const TVertexFunctor* GetVertexFunctor( ) const;
 
@@ -77,6 +85,7 @@ namespace fpa
     protected:
       typename TIntensityFunctor::Pointer m_IntensityFunctor;
       typename TVertexFunctor::Pointer m_VertexFunctor;
+      unsigned long m_MSTIndex;
     };
 
   } // ecapseman