]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/MinimumSpanningTree.h
...
[FrontAlgorithms.git] / lib / fpa / Base / MinimumSpanningTree.h
index bc9ce93c0cfa603c45197ea2c19a51fee154ea01..35cb6e4c0488616d700ab6c49547f93e146910a6 100644 (file)
@@ -1,11 +1,12 @@
-#ifndef __FPA__BASE__MINIMUMSPANNINGTREE__H__
-#define __FPA__BASE__MINIMUMSPANNINGTREE__H__
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__MinimumSpanningTree__h__
+#define __fpa__Base__MinimumSpanningTree__h__
 
-#include <map>
 #include <vector>
-#include <utility>
-#include <itkPoint.h>
-#include <itkSmartPointer.h>
 
 namespace fpa
 {
@@ -13,80 +14,54 @@ namespace fpa
   {
     /**
      */
-    template< class _TSuperclass, class _TVertex >
+    template< class _TVertex, class _Superclass >
     class MinimumSpanningTree
-      : public _TSuperclass
+      : public _Superclass
     {
     public:
       typedef MinimumSpanningTree             Self;
-      typedef _TSuperclass                    Superclass;
+      typedef _Superclass                     Superclass;
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef _TVertex                       TVertex;
-      typedef std::vector< TVertex >         TVertices;
-      typedef std::pair< TVertex, bool >     TCollision;
-      typedef std::vector< TCollision >      TCollisionsRow;
-      typedef std::vector< TCollisionsRow >  TCollisions;
-
-      typedef itk::Point< double, TVertex::Dimension > TPoint;
-      typedef std::vector< TPoint >                    TPoints;
-      typedef std::multimap< double, TVertex >         TNodeQueue;
+      typedef _TVertex                      TVertex;
+      typedef std::pair< TVertex, bool >    TCollision;
+      typedef std::vector< TCollision >     TCollisionsRow;
+      typedef std::vector< TCollisionsRow > TCollisions;
+      typedef std::vector< TVertex >        TVertices;
 
     protected:
       typedef std::vector< unsigned long > _TRow;
       typedef std::vector< _TRow >         _TMatrix;
 
     public:
-      itkTypeMacro( MinimumSpanningTree, _TSuperclass );
+      itkTypeMacro( fpa::Base::MinimumSpanningTree, _Superclass );
 
-      itkBooleanMacro( FillNodeQueue );
+    public:
+      const TCollisions& GetCollisions( ) const;
+      void SetCollisions( const TCollisions& collisions );
 
-      itkGetConstReferenceMacro( Collisions, TCollisions );
-      itkGetConstReferenceMacro( NodeQueue, TNodeQueue );
-      itkGetConstMacro( FillNodeQueue, bool );
+      void ClearSeeds( );
+      void AddSeed( const TVertex& seed );
 
-      itkSetMacro( FillNodeQueue, bool );
+      virtual TVertex GetParent( const TVertex& v ) const = 0;
+      virtual void SetParent( const TVertex& v, const TVertex& p ) = 0;
 
-    public:
-      void SetCollisions( const TCollisions& collisions );
-      TVertices GetPath( const TVertex& a ) const;
-      TVertices GetPath( const TVertex& a, const TVertex& b ) const;
-
-      virtual TPoints GetEuclideanPath( const TVertex& a ) const;
-      virtual TPoints GetEuclideanPath(
-        const TVertex& a, const TVertex& b
-        ) const;
-      virtual bool IsDefinedInEuclideanSpace( ) const;
-
-      virtual void SetNode(
-        const TVertex& v,
-        const TVertex& p,
-        const short& fid,
-        const double& cost
-        );
-      virtual void Clear( );
+      virtual TVertices GetPath( const TVertex& a ) const;
+      virtual TVertices GetPath( const TVertex& a, const TVertex& b ) const;
 
     protected:
       MinimumSpanningTree( );
       virtual ~MinimumSpanningTree( );
 
-      virtual bool _HasVertex( const TVertex& a ) const = 0;
-      virtual short _FrontId( const TVertex& a ) const = 0;
-      virtual void _Path( TVertices& path, const TVertex& a ) const = 0;
-
     private:
-      // Purposely not implemented
       MinimumSpanningTree( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
       TCollisions m_Collisions;
       _TMatrix    m_FrontPaths;
-      TNodeQueue  m_NodeQueue;
-      bool        m_FillNodeQueue;
-
-      static const unsigned long INF_VALUE;
+      std::vector< TVertex > m_Seeds;
     };
 
   } // ecapseman
@@ -94,9 +69,9 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#include <fpa/Base/MinimumSpanningTree.hxx>
+#  include <fpa/Base/MinimumSpanningTree.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__
+#endif // __fpa__Base__MinimumSpanningTree__h__
 
 // eof - $RCSfile$