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