]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/MinimumSpanningTree.h
...
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTree.h
1 #ifndef __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
2 #define __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
3
4 #include <vector>
5 #include <itkImage.h>
6 #include <fpa/Base/MinimumSpanningTree.h>
7
8 namespace fpa
9 {
10   namespace Image
11   {
12     template< unsigned int _NDim >
13     struct MinimumSpanningTreeData
14     {
15       typedef itk::Offset< _NDim > TOffset;
16       TOffset Parent;
17       short   FrontId;
18       double  GlobalCost;
19     };
20
21     /**
22      */
23     template< unsigned int _NDim >
24     class MinimumSpanningTree
25       : public fpa::Base::MinimumSpanningTree< itk::Image< MinimumSpanningTreeData< _NDim >, _NDim >, itk::Index< _NDim > >
26     {
27     public:
28       typedef MinimumSpanningTreeData< _NDim >                 TInfo;
29       typedef itk::Image< TInfo, _NDim >                       TBase;
30       typedef itk::Index< _NDim >                              TVertex;
31       typedef fpa::Base::MinimumSpanningTree< TBase, TVertex > Superclass;
32       typedef MinimumSpanningTree                              Self;
33       typedef itk::SmartPointer< Self >                        Pointer;
34       typedef itk::SmartPointer< const Self >                  ConstPointer;
35
36       typedef typename Superclass::TVertices TVertices;
37       typedef typename Superclass::TPoint    TPoint;
38       typedef typename Superclass::TPoints   TPoints;
39       itkStaticConstMacro( Dimension, unsigned int, _NDim );
40
41     public:
42       itkNewMacro( Self );
43       itkTypeMacro( MinimumSpanningTree, _TSuperclass );
44
45     public:
46       void CopyMetaData( itk::ImageBase< _NDim >* infoImage );
47       virtual void SetNode(
48         const TVertex& v,
49         const TVertex& p,
50         const short& fid,
51         const double& cost
52         ) override;
53       virtual void Clear( ) override;
54
55       virtual TPoints GetEuclideanPath( const TVertex& a ) const override;
56       virtual TPoints GetEuclideanPath(
57         const TVertex& a, const TVertex& b
58         ) const override;
59       virtual bool IsDefinedInEuclideanSpace( ) const override;
60
61     protected:
62       MinimumSpanningTree( );
63       virtual ~MinimumSpanningTree( );
64
65       virtual bool _HasVertex( const TVertex& a ) const override;
66       virtual short _FrontId( const TVertex& a ) const override;
67       virtual void _Path( TVertices& path, const TVertex& a ) const override;
68
69     private:
70       // Purposely not implemented
71       MinimumSpanningTree( const Self& other );
72       Self& operator=( const Self& other );
73     };
74
75   } // ecapseman
76
77 } // ecapseman
78
79 #ifndef ITK_MANUAL_INSTANTIATION
80 #include <fpa/Image/MinimumSpanningTree.hxx>
81 #endif // ITK_MANUAL_INSTANTIATION
82
83 #endif // __FPA__IMAGE__MINIMUMSPANNINGTREE__H__
84
85 // eof - $RCSfile$