]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/MinimumSpanningTree.h
de22019b3e6595ebe9aa147c1aef692cad2e1c0d
[FrontAlgorithms.git] / lib / fpa / Base / MinimumSpanningTree.h
1 #ifndef __fpa__Base__MinimumSpanningTree__h__
2 #define __fpa__Base__MinimumSpanningTree__h__
3
4 #include <fpa/Config.h>
5 #include <deque>
6 #include <vector>
7 #include <utility>
8 #include <itkObject.h>
9
10 namespace fpa
11 {
12   namespace Base
13   {
14     /**
15      */
16     template< class _TVertex, class _TSuperclass >
17     class MinimumSpanningTree
18       : public _TSuperclass
19     {
20     public:
21       typedef MinimumSpanningTree             Self;
22       typedef _TSuperclass                    Superclass;
23       typedef itk::SmartPointer< Self >       Pointer;
24       typedef itk::SmartPointer< const Self > ConstPointer;
25
26       typedef _TVertex                      TVertex;
27       typedef std::deque< _TVertex >        TVertices;
28       typedef std::pair< _TVertex, bool >   TCollision;
29       typedef std::vector< TCollision >     TCollisionsRow;
30       typedef std::vector< TCollisionsRow > TCollisions;
31
32     protected:
33       typedef std::vector< unsigned long > _TRow;
34       typedef std::vector< _TRow >         _TMatrix;
35
36     public:
37       itkTypeMacro( MinimumSpanningTree, _TSuperclass );
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       // Purposely not defined
58       MinimumSpanningTree( const Self& other );
59       Self& operator=( const Self& other );
60
61     protected:
62       TCollisions m_Collisions;
63       _TMatrix    m_FrontPaths;
64       TVertices   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$