]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/SeedsInterface.h
...
[FrontAlgorithms.git] / lib / fpa / Base / SeedsInterface.h
index a994125e3ef46445dd744a5257c0def6013dfe27..e9c67c3306362f1af8883948445c342129c64654 100644 (file)
@@ -6,23 +6,53 @@
 #ifndef __fpa__Base__SeedsInterface__h__
 #define __fpa__Base__SeedsInterface__h__
 
-#include <itkProcessObject.h>
+#include <functional>
 #include <set>
 
+#include <itkConceptChecking.h>
+#include <itkProcessObject.h>
+
 namespace fpa
 {
   namespace Base
   {
     /**
      */
-    template< class _TVertex, class _TCompare >
+    template< class _TVertex, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare = std::greater< _TVertex > >
     class SeedsInterface
     {
     public:
-      typedef _TVertex  TVertex;
-      typedef _TCompare TCompare;
+      itkConceptMacro(
+        Check_TFrontId,
+        ( itk::Concept::IsUnsignedInteger< _TFrontId > )
+        );
+
+    public:
+      typedef _TVertex       TVertex;
+      typedef _TInputValue   TInputValue;
+      typedef _TOutputValue  TOutputValue;
+      typedef _TFrontId      TFrontId;
+      typedef _TCompare      TCompare;
       typedef SeedsInterface Self;
-      typedef std::set< TVertex, TCompare > TSeeds;
+
+      struct TNode
+      {
+        TVertex  Vertex;
+        TVertex  Parent;
+        TFrontId FrontId;
+
+        // Hack to hide the fact that seed values need to be initialized
+        mutable TOutputValue Value;
+      };
+      struct TNodeCompare
+      {
+        bool operator()( const TNode& a, const TNode& b ) const
+          {
+            TCompare cmp;
+            return( cmp( a.Vertex, b.Vertex ) );
+          }
+      };
+      typedef std::set< TNode, TNodeCompare > TSeeds;
 
     public:
       unsigned int GetNumberOfSeeds( ) const;
@@ -30,15 +60,15 @@ namespace fpa
       typename TSeeds::const_iterator BeginSeeds( ) const;
       typename TSeeds::const_iterator EndSeeds( ) const;
 
-      void AddSeed( const TVertex& seed );
-      void RemoveSeed( const TVertex& seed );
-      void ClearSeeds( );
+      virtual void AddSeed( const TVertex& seed );
+      virtual void RemoveSeed( const TVertex& seed );
+      virtual void ClearSeeds( );
 
     protected:
       SeedsInterface( itk::ProcessObject* filter );
       virtual ~SeedsInterface( );
 
-    private:
+    protected:
       TSeeds m_Seeds;
       itk::ProcessObject* m_Filter;
     };