X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FMinimumSpanningTree.h;h=03940f140a18300af6866b9b9b1ffbb519600f48;hb=2b43395480bf95d0b399ded56aa272768bbc074a;hp=9adcd6d2e1cc44d7cd57f66cbbf45dbd2f956e26;hpb=6fcc9fc78c44fa789bf092e2897cb6b391259b42;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/MinimumSpanningTree.h b/lib/fpa/Base/MinimumSpanningTree.h index 9adcd6d..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 +#include namespace fpa { @@ -13,67 +12,69 @@ namespace fpa { /** */ - template< class V, class C, class VC > + template< class _TVertex, class _TPath, class _TSuperclass > class MinimumSpanningTree - : public itk::SimpleDataObjectDecorator< std::map< V, std::pair< V, short >, VC > > + : public _TSuperclass { public: - typedef std::pair< V, short > TNodeInfo; - typedef std::map< V, TNodeInfo, VC > TDecorated; - typedef MinimumSpanningTree Self; - typedef itk::SimpleDataObjectDecorator< TDecorated > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; + typedef MinimumSpanningTree Self; + typedef _TSuperclass Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; - typedef V TVertex; - typedef C TCollisions; - typedef VC TVertexCompare; + 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; typedef std::vector< _TRow > _TMatrix; public: - itkNewMacro( Self ); - itkTypeMacro( MinimumSpanningTree, B ); - - itkGetConstMacro( Collisions, TCollisions ); + itkTypeMacro( MinimumSpanningTree, _TSuperclass ); 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 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 void GetPath( + typename _TPath::Pointer& path, const _TVertex& a + ) const; virtual void GetPath( - std::vector< V >& path, const V& a, const V& b + typename _TPath::Pointer& path, 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 + // Purposely not defined 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 +#ifndef ITK_MANUAL_INSTANTIATION +# include +#endif // ITK_MANUAL_INSTANTIATION -#endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__ +#endif // __fpa__Base__MinimumSpanningTree__h__ // eof - $RCSfile$