]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/MinimumSpanningTree.h
...
[FrontAlgorithms.git] / lib / fpa / Base / MinimumSpanningTree.h
index 0c2b720d8c52f275407cbcc7e58d757324de5cc5..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 <utility>
 #include <vector>
-#include <itkSimpleDataObjectDecorator.h>
-#include <itkSmartPointer.h>
 
 namespace fpa
 {
@@ -13,80 +14,64 @@ namespace fpa
   {
     /**
      */
-    template< class V, class B >
+    template< class _TVertex, class _Superclass >
     class MinimumSpanningTree
-      : public itk::SimpleDataObjectDecorator< std::map< V, std::pair< V, short >, B > >
+      : public _Superclass
     {
     public:
-      typedef std::pair< V, short >                        TNodeInfo;
-      typedef std::map< V, TNodeInfo, B >                  TDecorated;
-      typedef MinimumSpanningTree                          Self;
-      typedef itk::SimpleDataObjectDecorator< TDecorated > Superclass;
-      typedef itk::SmartPointer< Self >                    Pointer;
-      typedef itk::SmartPointer< const Self >              ConstPointer;
-
-      typedef V TVertex;
-      typedef B TVertexCompare;
+      typedef MinimumSpanningTree             Self;
+      typedef _Superclass                     Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef std::vector< TVertex >        TVertices;
+      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:
-      itkNewMacro( Self );
-      itkTypeMacro( MinimumSpanningTree, itkSimpleDataObjectDecorator );
-
-      itkGetConstMacro( Collisions, TCollisions );
+      itkTypeMacro( fpa::Base::MinimumSpanningTree, _Superclass );
 
     public:
+      const TCollisions& GetCollisions( ) const;
       void SetCollisions( const TCollisions& collisions );
-      void SetParent( const TVertex& v, const TVertex& p, const short& fid )
-        {
-          this->Get( )[ v ] = TNodeInfo( p, fid );
-          this->Modified( );
-        }
-      void Clear( )
-        {
-          this->Get( ).clear( );
-          this->m_Collisions.clear( );
-          this->m_FrontPaths.clear( );
-        }
-      virtual std::vector< V > GetPath( const V& a, const V& b ) const;
-
-      template< class I >
-      std::vector< typename I::PointType > GetPathFromImage(
-        const V& a, const V& b,
-        const I* image, unsigned int kernel = 0
-        ) const;
+
+      void ClearSeeds( );
+      void AddSeed( const TVertex& seed );
+
+      virtual TVertex GetParent( const TVertex& v ) const = 0;
+      virtual void SetParent( const TVertex& v, const TVertex& p ) = 0;
+
+      virtual TVertices GetPath( const TVertex& a ) const;
+      virtual TVertices GetPath( const TVertex& a, const TVertex& b ) const;
 
     protected:
       MinimumSpanningTree( );
       virtual ~MinimumSpanningTree( );
 
-      virtual void _Path( std::vector< V >& path, const V& a ) const;
-
     private:
-      // Purposely not implemented
       MinimumSpanningTree( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
       TCollisions m_Collisions;
       _TMatrix    m_FrontPaths;
-      static const unsigned long INF_VALUE;
+      std::vector< TVertex > m_Seeds;
     };
 
   } // ecapseman
 
 } // ecapseman
 
-#include <fpa/Base/MinimumSpanningTree.hxx>
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Base/MinimumSpanningTree.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__
+#endif // __fpa__Base__MinimumSpanningTree__h__
 
 // eof - $RCSfile$