]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/FastMarching.h
...
[FrontAlgorithms.git] / lib / fpa / Base / FastMarching.h
index 119d0f3ec9a5a374753b6ad100db27babcfe227d..acea8e7935e243f057dad6447d8126a6b9a7705e 100644 (file)
@@ -1,7 +1,7 @@
-#ifndef __FPA__BASE__FASTMARCHING__H__
-#define __FPA__BASE__FASTMARCHING__H__
+#ifndef __fpa__Base__FastMarching__h__
+#define __fpa__Base__FastMarching__h__
 
-#include <fpa/Base/Dijkstra.h>
+#include <fpa/Base/PriorityQueueAlgorithm.h>
 
 namespace fpa
 {
@@ -9,68 +9,51 @@ namespace fpa
   {
     /**
      */
-    template< class V, class C, class VV, class VC, class B >
+    template< class _TSuperclass >
     class FastMarching
-      : public Dijkstra< V, C, VV, VC, B >
+      : public fpa::Base::PriorityQueueAlgorithm< _TSuperclass >
     {
     public:
-      // Templated types
-      typedef V  TVertex;
-      typedef C  TCost;
-      typedef VV TVertexValue;
-      typedef B  TBaseFilter;
+      typedef FastMarching                                      Self;
+      typedef fpa::Base::PriorityQueueAlgorithm< _TSuperclass > Superclass;
+      typedef itk::SmartPointer< Self >                         Pointer;
+      typedef itk::SmartPointer< const Self >                   ConstPointer;
 
-      // Standard class typdedefs
-      typedef FastMarching                    Self;
-      typedef Dijkstra< V, C, VV, VC, B >     Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
+      typedef typename Superclass::TFrontId TFrontId;
+      typedef typename Superclass::TOutput  TOutput;
+      typedef typename Superclass::TVertex  TVertex;
 
-      typedef typename Superclass::TResult TResult;
-      typedef typename Superclass::TTraits TTraits;
+      typedef std::pair< TVertex, double >         TFastMarchingNeighbor;
+      typedef std::vector< TFastMarchingNeighbor > TFastMarchingNeighborhood;
 
     protected:
-      typedef typename Superclass::_TFrontId _TFrontId;
-      typedef typename Superclass::_TNode    _TNode;
-      typedef typename Superclass::_TNodes   _TNodes;
-      struct _TNodeEikonalSort
-      {
-        bool operator()( const _TNode& a, const _TNode& b ) const
-          { return( a.Result < b.Result ); }
-      };
+      typedef typename Superclass::_TQueueNode _TQueueNode;
 
     public:
-      itkTypeMacro( FastMarching, Dijkstra );
+      itkTypeMacro( FastMarching, Algorithm );
 
     protected:
       FastMarching( );
       virtual ~FastMarching( );
 
-      virtual bool _UpdateNeigh( _TNode& nn, const _TNode& n );
+      virtual TFastMarchingNeighborhood _FastMarchingNeighbors( const TVertex& v ) const = 0;
 
-      /**
-       * Eikonal solution method
-       *
-       * This method returns the computed time and a flag indicating if the
-       * determinant was valid.
-       */
-      bool _SolveEikonal( double& re, const _TNode& n, const double& F );
+      virtual bool _UpdateValue( _TQueueNode& v, const _TQueueNode& p ) override;
 
     private:
-      // Purposely not implemented
-      FastMarching( const Self& );
-      void operator=( const Self& );
-
-    protected:
-      static const double LargestValue;
+      // Purposely not defined
+      FastMarching( const Self& other );
+      Self& operator=( const Self& other );
     };
 
   } // ecapseman
 
 } // ecapseman
 
-#include <fpa/Base/FastMarching.hxx>
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Base/FastMarching.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __FPA__BASE__FASTMARCHING__H__
+#endif // __fpa__Base__FastMarching__h__
 
 // eof - $RCSfile$