]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/MinimumSpanningTree.h
...
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTree.h
index 0d26c20a0df5969835af9f320f11b5183f2a7123..a93157cac6acb00c3b4d524f66d12e66981af8db 100644 (file)
@@ -1,73 +1,63 @@
-#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 <vector>
-#include <itkImage.h>
 #include <fpa/Base/MinimumSpanningTree.h>
+#include <itkImage.h>
 
 namespace fpa
 {
   namespace Image
   {
-    template< unsigned int _NDim >
-    struct MinimumSpanningTreeData
-    {
-      typedef itk::Offset< _NDim > TOffset;
-      TOffset Parent;
-      short   FrontId;
-      double  GlobalCost;
-    };
-
     /**
      */
-    template< unsigned int _NDim >
+    template< unsigned int _VDim >
     class MinimumSpanningTree
-      : public fpa::Base::MinimumSpanningTree< itk::Image< MinimumSpanningTreeData< _NDim >, _NDim >, itk::Index< _NDim > >
+      : public fpa::Base::MinimumSpanningTree< itk::Index< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
     {
     public:
-      typedef MinimumSpanningTreeData< _NDim >                 TInfo;
-      typedef itk::Image< TInfo, _NDim >                       TBase;
-      typedef itk::Index< _NDim >                              TVertex;
-      typedef fpa::Base::MinimumSpanningTree< TBase, TVertex > Superclass;
-      typedef MinimumSpanningTree                              Self;
-      typedef itk::SmartPointer< Self >                        Pointer;
-      typedef itk::SmartPointer< const Self >                  ConstPointer;
+      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 typename Superclass::TVertices TVertices;
-      typedef typename Superclass::TPoint    TPoint;
-      typedef typename Superclass::TPoints   TPoints;
-      itkStaticConstMacro( Dimension, unsigned int, _NDim );
+      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, _TSuperclass );
+      itkTypeMacro(
+        fpa::Image::MinimumSpanningTree,
+        fpa::Base::MinimumSpanningTree
+        );
 
     public:
-      void CopyMetaData( itk::ImageBase< _NDim >* infoImage );
-      virtual void SetNode(
-        const TVertex& v,
-        const TVertex& p,
-        const short& fid,
-        const double& cost
-        ) override;
-      virtual void Clear( ) override;
-
-      virtual TPoints GetEuclideanPath( const TVertex& a ) const override;
-      virtual TPoints GetEuclideanPath(
-        const TVertex& a, const TVertex& b
-        ) const override;
-      virtual bool IsDefinedInEuclideanSpace( ) const override;
+      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 );
+        }
 
     protected:
-      MinimumSpanningTree( );
-      virtual ~MinimumSpanningTree( );
-
-      virtual bool _HasVertex( const TVertex& a ) const override;
-      virtual short _FrontId( const TVertex& a ) const override;
-      virtual void _Path( TVertices& path, const TVertex& a ) const override;
+      MinimumSpanningTree( )
+        : Superclass( )
+        { }
+      virtual ~MinimumSpanningTree( )
+        { }
 
     private:
-      // Purposely not implemented
       MinimumSpanningTree( const Self& other );
       Self& operator=( const Self& other );
     };
@@ -76,10 +66,6 @@ namespace fpa
 
 } // ecapseman
 
-#ifndef ITK_MANUAL_INSTANTIATION
-#include <fpa/Image/MinimumSpanningTree.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
+#endif // __fpa__Image__MinimumSpanningTree__h__
 
 // eof - $RCSfile$