1 #ifndef __FPA__BASE__MINIMUMSPANNINGTREE__H__
2 #define __FPA__BASE__MINIMUMSPANNINGTREE__H__
7 #include <itkSimpleDataObjectDecorator.h>
8 #include <itkSmartPointer.h>
16 template< class V, class B >
17 class MinimumSpanningTree
18 : public itk::SimpleDataObjectDecorator< std::map< V, std::pair< V, short >, B > >
21 typedef std::pair< V, short > TNodeInfo;
22 typedef std::map< V, TNodeInfo, B > TDecorated;
23 typedef MinimumSpanningTree Self;
24 typedef itk::SimpleDataObjectDecorator< TDecorated > Superclass;
25 typedef itk::SmartPointer< Self > Pointer;
26 typedef itk::SmartPointer< const Self > ConstPointer;
29 typedef B TVertexCompare;
31 typedef std::vector< TVertex > TVertices;
32 typedef std::pair< TVertex, bool > TCollision;
33 typedef std::vector< TCollision > TCollisionsRow;
34 typedef std::vector< TCollisionsRow > TCollisions;
37 typedef std::vector< unsigned long > _TRow;
38 typedef std::vector< _TRow > _TMatrix;
42 itkTypeMacro( MinimumSpanningTree, itkSimpleDataObjectDecorator );
44 itkGetConstMacro( Collisions, TCollisions );
47 void SetCollisions( const TCollisions& collisions );
48 void SetParent( const TVertex& v, const TVertex& p, const short& fid )
50 this->Get( )[ v ] = TNodeInfo( p, fid );
55 this->Get( ).clear( );
56 this->m_Collisions.clear( );
57 this->m_FrontPaths.clear( );
59 virtual std::vector< V > GetPath( const V& a, const V& b ) const;
62 std::vector< typename I::PointType > GetPathFromImage(
63 const V& a, const V& b,
64 const I* image, unsigned int kernel = 0
68 MinimumSpanningTree( );
69 virtual ~MinimumSpanningTree( );
71 virtual void _Path( std::vector< V >& path, const V& a ) const;
74 // Purposely not implemented
75 MinimumSpanningTree( const Self& other );
76 Self& operator=( const Self& other );
79 TCollisions m_Collisions;
80 _TMatrix m_FrontPaths;
81 static const unsigned long INF_VALUE;
88 #include <fpa/Base/MinimumSpanningTree.hxx>
90 #endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__