X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FMinimumSpanningTree.h;h=03940f140a18300af6866b9b9b1ffbb519600f48;hb=86a6d5df2aa1aa5292a5fa851d98bfc13939bdf3;hp=bc9ce93c0cfa603c45197ea2c19a51fee154ea01;hpb=8fafb83c41ab35dfc25eb637170882a612924433;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/MinimumSpanningTree.h b/lib/fpa/Base/MinimumSpanningTree.h index bc9ce93..03940f1 100644 --- a/lib/fpa/Base/MinimumSpanningTree.h +++ b/lib/fpa/Base/MinimumSpanningTree.h @@ -1,11 +1,10 @@ -#ifndef __FPA__BASE__MINIMUMSPANNINGTREE__H__ -#define __FPA__BASE__MINIMUMSPANNINGTREE__H__ +#ifndef __fpa__Base__MinimumSpanningTree__h__ +#define __fpa__Base__MinimumSpanningTree__h__ -#include +#include #include #include -#include -#include +#include namespace fpa { @@ -13,7 +12,7 @@ namespace fpa { /** */ - template< class _TSuperclass, class _TVertex > + template< class _TVertex, class _TPath, class _TSuperclass > class MinimumSpanningTree : public _TSuperclass { @@ -23,15 +22,11 @@ namespace fpa 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 _TPath TPath; + typedef std::pair< _TVertex, bool > TCollision; + typedef std::vector< TCollision > TCollisionsRow; + typedef std::vector< TCollisionsRow > TCollisions; protected: typedef std::vector< unsigned long > _TRow; @@ -40,53 +35,36 @@ namespace fpa public: itkTypeMacro( MinimumSpanningTree, _TSuperclass ); - itkBooleanMacro( FillNodeQueue ); - - itkGetConstReferenceMacro( Collisions, TCollisions ); - itkGetConstReferenceMacro( NodeQueue, TNodeQueue ); - itkGetConstMacro( FillNodeQueue, bool ); - - itkSetMacro( FillNodeQueue, bool ); - public: + const TCollisions& GetCollisions( ) const; 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; + void ClearSeeds( ); + void AddSeed( const _TVertex& seed ); - virtual void SetNode( - const TVertex& v, - const TVertex& p, - const short& fid, - const double& cost - ); - virtual void Clear( ); + virtual _TVertex GetParent( const _TVertex& v ) const = 0; + virtual void SetParent( const _TVertex& v, const _TVertex& p ) = 0; + + virtual void GetPath( + typename _TPath::Pointer& path, const _TVertex& a + ) const; + virtual void GetPath( + typename _TPath::Pointer& path, 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 + // Purposely not defined 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 +72,9 @@ namespace fpa } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION -#include +# include #endif // ITK_MANUAL_INSTANTIATION -#endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__ +#endif // __fpa__Base__MinimumSpanningTree__h__ // eof - $RCSfile$