]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/MinimumSpanningTree.h
Refactoring: gaussian model estimator
[FrontAlgorithms.git] / lib / fpa / Base / MinimumSpanningTree.h
1 #ifndef __FPA__BASE__MINIMUMSPANNINGTREE__H__
2 #define __FPA__BASE__MINIMUMSPANNINGTREE__H__
3
4 #include <vector>
5 #include <itkSmartPointer.h>
6
7 namespace fpa
8 {
9   namespace Base
10   {
11     /**
12      */
13     template< class V, class C, class B >
14     class MinimumSpanningTree
15       : public B
16     {
17     public:
18       typedef MinimumSpanningTree             Self;
19       typedef B                               Superclass;
20       typedef itk::SmartPointer< Self >       Pointer;
21       typedef itk::SmartPointer< const Self > ConstPointer;
22
23       typedef V TVertex;
24       typedef C TCollisions;
25
26     protected:
27       typedef std::vector< unsigned long > _TRow;
28       typedef std::vector< _TRow >         _TMatrix;
29
30     public:
31       itkTypeMacro( MinimumSpanningTree, B );
32
33       itkGetConstMacro( Collisions, TCollisions );
34
35     public:
36       void SetCollisions( const TCollisions& collisions );
37
38       virtual void GetPath(
39         std::vector< V >& path, const V& a, const V& b
40         ) const;
41
42     protected:
43       MinimumSpanningTree( );
44       virtual ~MinimumSpanningTree( );
45
46       virtual void _Path( std::vector< V >& path, const V& a ) const;
47       virtual long _FrontId( const V& v ) const = 0;
48       virtual V _Parent( const V& v ) const = 0;
49
50     private:
51       // Purposely not implemented
52       MinimumSpanningTree( const Self& other );
53       Self& operator=( const Self& other );
54
55     protected:
56       TCollisions m_Collisions;
57       _TMatrix    m_FrontPaths;
58       static const unsigned long INF_VALUE;
59     };
60
61   } // ecapseman
62
63 } // ecapseman
64
65 #include <fpa/Base/MinimumSpanningTree.hxx>
66
67 #endif // __FPA__BASE__MINIMUMSPANNINGTREE__H__
68
69 // eof - $RCSfile$