]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/MinimumSpanningTree.h
...
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTree.h
index 0d26c20a0df5969835af9f320f11b5183f2a7123..7d3941d23bbe57d904389af0161cffb74002f20a 100644 (file)
@@ -1,73 +1,53 @@
-#ifndef __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
-#define __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
+#ifndef __fpa__Image__MinimumSpanningTree__h__
+#define __fpa__Image__MinimumSpanningTree__h__
 
-#include <vector>
-#include <itkImage.h>
 #include <fpa/Base/MinimumSpanningTree.h>
+#include <cpExtensions/DataStructures/PolyLineParametricPath.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 >, cpExtensions::DataStructures::PolyLineParametricPath< _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 typename Superclass::TVertices TVertices;
-      typedef typename Superclass::TPoint    TPoint;
-      typedef typename Superclass::TPoints   TPoints;
-      itkStaticConstMacro( Dimension, unsigned int, _NDim );
+      typedef itk::Index< _VDim >                               TVertex;
+      typedef cpExtensions::DataStructures::PolyLineParametricPath< _VDim > TPath;
+      typedef itk::Offset< _VDim >                                     TOffset;
+      typedef itk::Image< TOffset, _VDim >                             TImage;
+      typedef fpa::Base::MinimumSpanningTree< TVertex, TPath, TImage > Superclass;
+      typedef MinimumSpanningTree                                      Self;
+      typedef itk::SmartPointer< Self >                                Pointer;
+      typedef itk::SmartPointer< const Self >                          ConstPointer;
 
     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 TVertex GetParent( const TVertex& v ) const override;
+      virtual void SetParent( const TVertex& v, const TVertex& p ) override;
 
-      virtual TPoints GetEuclideanPath( const TVertex& a ) const override;
-      virtual TPoints GetEuclideanPath(
-        const TVertex& a, const TVertex& b
+      virtual void GetPath(
+        typename TPath::Pointer& path, const TVertex& a
+        ) const override;
+      virtual void GetPath(
+        typename TPath::Pointer& path, const TVertex& a, const TVertex& b
         ) const override;
-      virtual bool IsDefinedInEuclideanSpace( ) const override;
 
     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;
-
     private:
-      // Purposely not implemented
+      // Purposely not defined
       MinimumSpanningTree( const Self& other );
       Self& operator=( const Self& other );
     };
@@ -77,9 +57,9 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#include <fpa/Image/MinimumSpanningTree.hxx>
+#  include <fpa/Image/MinimumSpanningTree.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
+#endif // __fpa__Image__MinimumSpanningTree__h__
 
 // eof - $RCSfile$