X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffpa%2FBase%2FMinimumSpanningTree.h;h=de22019b3e6595ebe9aa147c1aef692cad2e1c0d;hb=3f4722ccf68d830e26dac9b945925efa68e39e4c;hp=dc0c6d1fcea928411c34880564b8e929a78edd12;hpb=56b8bb48cc05a297a3faa264f8f2a88de21ef203;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/MinimumSpanningTree.h b/lib/fpa/Base/MinimumSpanningTree.h index dc0c6d1..de22019 100644 --- a/lib/fpa/Base/MinimumSpanningTree.h +++ b/lib/fpa/Base/MinimumSpanningTree.h @@ -1,11 +1,11 @@ -#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 +#include namespace fpa { @@ -13,79 +13,55 @@ namespace fpa { /** */ - template< class _TVertex, class _TScalar, class _TVertexCompare = std::less< _TVertex > > + template< class _TVertex, class _TSuperclass > class MinimumSpanningTree - : public itk::SimpleDataObjectDecorator< std::map< _TVertex, std::pair< _TVertex, std::pair< _TScalar, long > >, _TVertexCompare > > + : public _TSuperclass { public: - typedef std::pair< _TScalar, long > TData; - typedef std::pair< _TVertex, TData > TParent; - typedef std::map< _TVertex, TParent, _TVertexCompare > TContainer; - typedef itk::SimpleDataObjectDecorator< TContainer > Superclass; - typedef MinimumSpanningTree Self; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - typedef _TVertex TVertex; - typedef _TScalar TScalar; - typedef _TVertexCompare TVertexCompare; - - typedef std::vector< TVertex > TVertices; - typedef std::pair< TVertex, bool > TCollision; + typedef MinimumSpanningTree Self; + typedef _TSuperclass Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef _TVertex TVertex; + typedef std::deque< _TVertex > TVertices; + typedef std::pair< _TVertex, bool > TCollision; typedef std::vector< TCollision > TCollisionsRow; typedef std::vector< TCollisionsRow > TCollisions; - typedef std::multimap< double, _TVertex > TNodeQueue; - protected: - typedef std::vector< unsigned long > _TRow; - typedef std::vector< _TRow > _TMatrix; + typedef std::vector< unsigned long > _TRow; + typedef std::vector< _TRow > _TMatrix; public: - itkNewMacro( Self ); - itkTypeMacro( MinimumSpanningTree, itk::SimpleDataObjectDecorator ); - - itkBooleanMacro( FillNodeQueue ); - - itkGetConstReferenceMacro( Collisions, TCollisions ); - itkGetConstReferenceMacro( NodeQueue, TNodeQueue ); - itkGetConstMacro( FillNodeQueue, bool ); - - itkSetMacro( FillNodeQueue, bool ); + itkTypeMacro( MinimumSpanningTree, _TSuperclass ); 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 void SetNode( - const _TVertex& vertex, - const _TVertex& parent, - const long& fid = -1, - const _TScalar& result = _TScalar( 0 ) - ); - virtual void Clear( ); + 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 TVertices GetPath( const _TVertex& a ) const; + virtual TVertices GetPath( const _TVertex& a, const _TVertex& b ) const; protected: MinimumSpanningTree( ); virtual ~MinimumSpanningTree( ); - virtual bool _HasVertex( const _TVertex& a ) const; - virtual long _FrontId( const _TVertex& a ) const; - virtual void _Path( TVertices& path, const _TVertex& 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; - TNodeQueue m_NodeQueue; - bool m_FillNodeQueue; - - static const unsigned long INF_VALUE; + TVertices m_Seeds; }; } // ecapseman @@ -94,8 +70,8 @@ namespace fpa #ifndef ITK_MANUAL_INSTANTIATION # include -#endif +#endif // ITK_MANUAL_INSTANTIATION -#endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__ +#endif // __fpa__Base__MinimumSpanningTree__h__ // eof - $RCSfile$