]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/TreeExtractor.h
ee6499bfee2380256b205372d7e6efff4fd11b7f
[FrontAlgorithms.git] / lib / fpa / Base / TreeExtractor.h
1 #ifndef __FPA__BASE__TREEEXTRACTOR__H__
2 #define __FPA__BASE__TREEEXTRACTOR__H__
3
4 #include <map>
5 #include <vector>
6
7 namespace fpa
8 {
9   namespace Base
10   {
11     /**
12      */
13     template< class A >
14     class TreeExtractor
15       : public A
16     {
17     public:
18       /// Standard class typdedefs
19       typedef TreeExtractor                   Self;
20       typedef A                               Superclass;
21       typedef itk::SmartPointer< Self >       Pointer;
22       typedef itk::SmartPointer< const Self > ConstPointer;
23
24       typedef A TAlgorithm;
25
26       typedef typename A::TCost                        TCost;
27       typedef typename A::TVertex                      TVertex;
28       typedef std::vector< TVertex >                   TVertices;
29       typedef typename A::TTraits::TVertexCmp          TVertexCmp;
30       typedef std::map< TVertex, TVertex, TVertexCmp > TTree;
31
32     protected:
33       typedef typename A::_TFrontId           _TFrontId;
34       typedef typename A::_TNode              _TNode;
35       typedef typename A::_TCollisionSitesRow _TCollisionSitesRow;
36       typedef typename A::_TCollisionSites    _TCollisionSites;
37       typedef std::vector< unsigned long >    _TRow;
38       typedef std::vector< _TRow >            _TMatrix;
39
40     public:
41       itkNewMacro( Self );
42       itkTypeMacro( TreeExtractor, TAlgorithm );
43
44       itkGetConstMacro( Root, TVertex );
45       itkGetConstMacro( Tree, TTree );
46       itkSetMacro( Root, TVertex );
47
48     public:
49       unsigned int AddLeaf( const TVertex& leaf );
50       unsigned int GetNumberOfLeafs( ) const;
51       const TVertex& GetLeaf( const unsigned int& id ) const;
52
53     protected:
54       TreeExtractor( );
55       virtual ~TreeExtractor( );
56
57       virtual void _BeforeMainLoop( );
58       virtual void _AfterMainLoop( );
59
60       TVertices _Path( const TVertex& s, const TVertex& e );
61
62     private:
63       // Purporsely not implemented
64       TreeExtractor( const Self& );
65       void operator=( const Self& );
66
67     protected:
68       TVertex   m_Root;
69       TVertices m_Leafs;
70       TTree     m_Tree;
71
72       _TMatrix m_FrontPaths;
73       static const unsigned long INF_VALUE;
74     };
75
76   } // ecapseman
77
78 } // ecapseman
79
80 #include <fpa/Base/TreeExtractor.hxx>
81
82 #endif // __FPA__BASE__TREEEXTRACTOR__H__
83
84 // eof - $RCSfile$