1 #ifndef __FPA__BASE__MINIMUMSPANNINGTREE__H__
2 #define __FPA__BASE__MINIMUMSPANNINGTREE__H__
8 #include <itkSimpleDataObjectDecorator.h>
16 template< class _TVertex, class _TScalar, class _TVertexCompare = std::less< _TVertex > >
17 class MinimumSpanningTree
18 : public itk::SimpleDataObjectDecorator< std::map< _TVertex, std::pair< _TVertex, std::pair< _TScalar, long > >, _TVertexCompare > >
21 typedef std::pair< _TScalar, long > TData;
22 typedef std::pair< _TVertex, TData > TParent;
23 typedef std::map< _TVertex, TParent, _TVertexCompare > TContainer;
24 typedef itk::SimpleDataObjectDecorator< TContainer > Superclass;
25 typedef MinimumSpanningTree Self;
26 typedef itk::SmartPointer< Self > Pointer;
27 typedef itk::SmartPointer< const Self > ConstPointer;
29 typedef _TVertex TVertex;
30 typedef _TScalar TScalar;
31 typedef _TVertexCompare TVertexCompare;
33 typedef std::vector< TVertex > TVertices;
34 typedef std::pair< TVertex, bool > TCollision;
35 typedef std::vector< TCollision > TCollisionsRow;
36 typedef std::vector< TCollisionsRow > TCollisions;
38 typedef std::multimap< double, _TVertex > TNodeQueue;
41 typedef std::vector< unsigned long > _TRow;
42 typedef std::vector< _TRow > _TMatrix;
46 itkTypeMacro( MinimumSpanningTree, itk::SimpleDataObjectDecorator );
48 itkBooleanMacro( FillNodeQueue );
50 itkGetConstReferenceMacro( Collisions, TCollisions );
51 itkGetConstReferenceMacro( NodeQueue, TNodeQueue );
52 itkGetConstMacro( FillNodeQueue, bool );
54 itkSetMacro( FillNodeQueue, bool );
57 void SetCollisions( const TCollisions& collisions );
58 TVertices GetPath( const _TVertex& a ) const;
59 TVertices GetPath( const _TVertex& a, const _TVertex& b ) const;
62 const _TVertex& vertex,
63 const _TVertex& parent,
65 const _TScalar& result = _TScalar( 0 )
67 virtual void Clear( );
70 MinimumSpanningTree( );
71 virtual ~MinimumSpanningTree( );
73 virtual bool _HasVertex( const _TVertex& a ) const;
74 virtual long _FrontId( const _TVertex& a ) const;
75 virtual void _Path( TVertices& path, const _TVertex& a ) const;
78 // Purposely not implemented
79 MinimumSpanningTree( const Self& other );
80 Self& operator=( const Self& other );
83 TCollisions m_Collisions;
84 _TMatrix m_FrontPaths;
85 TNodeQueue m_NodeQueue;
88 static const unsigned long INF_VALUE;
95 #ifndef ITK_MANUAL_INSTANTIATION
96 # include <fpa/Base/MinimumSpanningTree.hxx>
99 #endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__