]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/Dijkstra.h
...
[FrontAlgorithms.git] / lib / fpa / Base / Dijkstra.h
index 5633f221f5b3bddedda29ab40575c6bcba12f397..c93d575c927c176c41a79bdaf22755e8594ec130 100644 (file)
@@ -1,10 +1,12 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Base__Dijkstra__h__
 #define __fpa__Base__Dijkstra__h__
 
-#include <vector>
-#include <fpa/Config.h>
-#include <itkFunctionBase.h>
-#include <fpa/Base/DijkstraCostFunctionBase.h>
+#include <fpa/Base/DijkstraBase.h>
 
 namespace fpa
 {
@@ -12,72 +14,48 @@ namespace fpa
   {
     /**
      */
-    template< class _TSuperclass, class _TMST >
+    template< class _TAlgorithm, class _TMST >
     class Dijkstra
-      : public _TSuperclass
+      : public fpa::Base::DijkstraBase< _TAlgorithm >
     {
     public:
-      typedef Dijkstra                        Self;
-      typedef _TSuperclass                    Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
+      typedef Dijkstra                               Self;
+      typedef fpa::Base::DijkstraBase< _TAlgorithm > Superclass;
+      typedef itk::SmartPointer< Self >              Pointer;
+      typedef itk::SmartPointer< const Self >        ConstPointer;
 
       typedef _TMST TMST;
-      typedef typename Superclass::TOutput TOutput;
-      typedef typename Superclass::TVertex TVertex;
 
-      typedef itk::FunctionBase< TOutput, TOutput > TCostConversionFunction;
-      typedef DijkstraCostFunctionBase< TVertex, TOutput > TCostFunction;
+      typedef typename Superclass::TNode        TNode;
+      typedef typename Superclass::TNodes       TNodes;
+      typedef typename Superclass::TInputValue  TInputValue;
+      typedef typename Superclass::TOutputValue TOutputValue;
+      typedef typename Superclass::TFrontId     TFrontId;
+      typedef typename Superclass::TVertex      TVertex;
+      typedef typename Superclass::TSeeds       TSeeds;
 
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
-      struct _TQueueNodeCompare
-      {
-        bool operator( )( const _TQueueNode& a, const _TQueueNode& b )
-          {
-            return( b.Result < a.Result );
-          }
-      };
-      typedef std::vector< _TQueueNode > _TQueue;
+      typedef typename Superclass::TQueue          TQueue;
+      typedef typename Superclass::TQueueOrder     TQueueOrder;
+      typedef typename Superclass::TWeightFunction TWeightFunction;
 
     public:
-      itkTypeMacro( Dijkstra, Algorithm );
-
-      itkGetObjectMacro( CostFunction, TCostFunction );
-      itkGetObjectMacro( CostConversionFunction, TCostConversionFunction );
-      itkSetObjectMacro( CostFunction, TCostFunction );
-      itkSetObjectMacro( CostConversionFunction, TCostConversionFunction );
-
-    public:
-      _TMST* GetMinimumSpanningTree( );
-      const _TMST* GetMinimumSpanningTree( ) const;
+      TMST* GetMinimumSpanningTree( );
+      const TMST* GetMinimumSpanningTree( ) const;
 
     protected:
       Dijkstra( );
       virtual ~Dijkstra( );
 
-      virtual void _AfterGenerateData( ) fpa_OVERRIDE;
-
-      virtual void _UpdateResult( const _TQueueNode& n ) fpa_OVERRIDE;
-      virtual bool _UpdateValue(
-        _TQueueNode& v, const _TQueueNode& p
-        ) fpa_OVERRIDE;
-      virtual unsigned long _QueueSize( ) const fpa_OVERRIDE;
-      virtual void _QueueClear( ) fpa_OVERRIDE;
-      virtual void _QueuePush( const _TQueueNode& node ) fpa_OVERRIDE;
-      virtual _TQueueNode _QueuePop( ) fpa_OVERRIDE;
+      virtual void _AfterGenerateData( ) override;
+      virtual void _UpdateOutputValue( const TNode& n ) override;
 
     private:
-      // Purposely not defined
+      // Purposely not implemented.
       Dijkstra( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
-      _TQueue m_Queue;
-      typename TCostFunction::Pointer m_CostFunction;
-      typename TCostConversionFunction::Pointer m_CostConversionFunction;
-
-      unsigned long m_MSTIndex;
+      unsigned int m_MSTIdx;
     };
 
   } // ecapseman