]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/MinimumSpanningTree.h
...
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTree.h
index 652547d62debf33c7ecb79d27d809f5f54efb4a6..a93157cac6acb00c3b4d524f66d12e66981af8db 100644 (file)
@@ -1,8 +1,13 @@
-#ifndef __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
-#define __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__MinimumSpanningTree__h__
+#define __fpa__Image__MinimumSpanningTree__h__
 
-#include <itkImage.h>
 #include <fpa/Base/MinimumSpanningTree.h>
+#include <itkImage.h>
 
 namespace fpa
 {
@@ -10,35 +15,49 @@ namespace fpa
   {
     /**
      */
-    template< class V, class N, class C, unsigned int D, unsigned long L >
+    template< unsigned int _VDim >
     class MinimumSpanningTree
-      : public fpa::Base::MinimumSpanningTree< V, C, itk::Image< N, D > >
+      : public fpa::Base::MinimumSpanningTree< itk::Index< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
     {
     public:
-      typedef fpa::Base::MinimumSpanningTree< V, C, itk::Image< N, D > > Superclass;
+      typedef itk::Index< _VDim > TVertex;
+      typedef itk::Image< itk::Offset< _VDim >, _VDim > TBaseImage;
+
       typedef MinimumSpanningTree             Self;
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
+      typedef fpa::Base::MinimumSpanningTree< TVertex, TBaseImage > Superclass;
 
-      typedef V TVertex;
-      typedef C TCollisions;
-
-    protected:
-      typedef N _TNode;
+      typedef typename Superclass::TCollision     TCollision;
+      typedef typename Superclass::TCollisionsRow TCollisionsRow;
+      typedef typename Superclass::TCollisions    TCollisions;
+      typedef typename Superclass::TVertices      TVertices;
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( MinimumSpanningTree, fpa_Base_MinimumSpanningTree );
+      itkTypeMacro(
+        fpa::Image::MinimumSpanningTree,
+        fpa::Base::MinimumSpanningTree
+        );
 
-    protected:
-      MinimumSpanningTree( );
-      virtual ~MinimumSpanningTree( );
+    public:
+      virtual TVertex GetParent( const TVertex& v ) const override
+        {
+          return( v + this->GetPixel( v ) );
+        }
+      virtual void SetParent( const TVertex& v, const TVertex& p ) override
+        {
+          this->SetPixel( v, p - v );
+        }
 
-      virtual long _FrontId( const V& v ) const;
-      virtual V _Parent( const V& v ) const;
+    protected:
+      MinimumSpanningTree( )
+        : Superclass( )
+        { }
+      virtual ~MinimumSpanningTree( )
+        { }
 
     private:
-      // Purposely not implemented
       MinimumSpanningTree( const Self& other );
       Self& operator=( const Self& other );
     };
@@ -47,8 +66,6 @@ namespace fpa
 
 } // ecapseman
 
-#include <fpa/Image/MinimumSpanningTree.hxx>
-
-#endif // __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
+#endif // __fpa__Image__MinimumSpanningTree__h__
 
 // eof - $RCSfile$