]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/DataStructures/MinimumSpanningTree.h
475ecdd061d1a2a2043535306f3058faa8daac44
[FrontAlgorithms.git] / lib / fpa / DataStructures / MinimumSpanningTree.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__DataStructures__MinimumSpanningTree__h__
6 #define __fpa__DataStructures__MinimumSpanningTree__h__
7
8 #include <vector>
9
10 namespace fpa
11 {
12   namespace DataStructures
13   {
14     /**
15      */
16     template< class _TVertex, class _Superclass >
17     class MinimumSpanningTree
18       : public _Superclass
19     {
20     public:
21       typedef MinimumSpanningTree             Self;
22       typedef _Superclass                     Superclass;
23       typedef itk::SmartPointer< Self >       Pointer;
24       typedef itk::SmartPointer< const Self > ConstPointer;
25
26       typedef _TVertex                      TVertex;
27       typedef std::pair< TVertex, bool >    TCollision;
28       typedef std::vector< TCollision >     TCollisionsRow;
29       typedef std::vector< TCollisionsRow > TCollisions;
30       typedef std::vector< TVertex >        TVertices;
31
32     protected:
33       typedef std::vector< unsigned long > _TRow;
34       typedef std::vector< _TRow >         _TMatrix;
35
36     public:
37       itkTypeMacro( fpa::Base::MinimumSpanningTree, _Superclass );
38
39     public:
40       const TCollisions& GetCollisions( ) const;
41       void SetCollisions( const TCollisions& collisions );
42
43       void ClearSeeds( );
44       void AddSeed( const TVertex& seed );
45
46       virtual TVertex GetParent( const TVertex& v ) const = 0;
47       virtual void SetParent( const TVertex& v, const TVertex& p ) = 0;
48
49       virtual TVertices GetPath( const TVertex& a ) const;
50       virtual TVertices GetPath( const TVertex& a, const TVertex& b ) const;
51
52     protected:
53       MinimumSpanningTree( );
54       virtual ~MinimumSpanningTree( );
55
56     private:
57       MinimumSpanningTree( const Self& other );
58       Self& operator=( const Self& other );
59
60     protected:
61       TCollisions m_Collisions;
62       _TMatrix    m_FrontPaths;
63       std::vector< TVertex > m_Seeds;
64     };
65
66   } // ecapseman
67
68 } // ecapseman
69
70 #ifndef ITK_MANUAL_INSTANTIATION
71 #  include <fpa/DataStructures/MinimumSpanningTree.hxx>
72 #endif // ITK_MANUAL_INSTANTIATION
73 #endif // __fpa__DataStructures__MinimumSpanningTree__h__
74
75 // eof - $RCSfile$