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