]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/MinimumSpanningTree.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTree.hxx
1 #ifndef __fpa__Image__MinimumSpanningTree__hxx__
2 #define __fpa__Image__MinimumSpanningTree__hxx__
3
4 // -------------------------------------------------------------------------
5 template< unsigned int _VDim >
6 typename fpa::Image::MinimumSpanningTree< _VDim >::
7 TVertex fpa::Image::MinimumSpanningTree< _VDim >::
8 GetParent( const TVertex& v ) const
9 {
10   TVertex p = v + this->GetPixel( v );
11   return( p );
12 }
13
14 // -------------------------------------------------------------------------
15 template< unsigned int _VDim >
16 void fpa::Image::MinimumSpanningTree< _VDim >::
17 SetParent( const TVertex& v, const TVertex& p )
18 {
19   this->SetPixel( v, p - v );
20 }
21
22 // -------------------------------------------------------------------------
23 template< unsigned int _VDim >
24 typename fpa::Image::MinimumSpanningTree< _VDim >::
25 TPoints fpa::Image::MinimumSpanningTree< _VDim >::
26 GetEuclideanPath( const TVertex& a ) const
27 {
28   TVertices path = this->GetPath( a );
29   TPoints points;
30   for( auto v = path.begin( ); v != path.end( ); ++v )
31   {
32     TPoint p;
33     this->TransformIndexToPhysicalPoint( *v, p );
34     points.push_back( p );
35
36   } // rof
37   return( points );
38 }
39
40 // -------------------------------------------------------------------------
41 template< unsigned int _VDim >
42 typename fpa::Image::MinimumSpanningTree< _VDim >::
43 TPoints fpa::Image::MinimumSpanningTree< _VDim >::
44 GetEuclideanPath( const TVertex& a, const TVertex& b ) const
45 {
46   TVertices path = this->GetPath( a, b );
47   TPoints points;
48   for( auto v = path.begin( ); v != path.end( ); ++v )
49   {
50     TPoint p;
51     this->TransformIndexToPhysicalPoint( *v, p );
52     points.push_back( p );
53
54   } // rof
55   return( points );
56 }
57
58 // -------------------------------------------------------------------------
59 template< unsigned int _VDim >
60 fpa::Image::MinimumSpanningTree< _VDim >::
61 MinimumSpanningTree( )
62   : Superclass( )
63 {
64 }
65
66 // -------------------------------------------------------------------------
67 template< unsigned int _VDim >
68 fpa::Image::MinimumSpanningTree< _VDim >::
69 ~MinimumSpanningTree( )
70 {
71 }
72
73 #endif // __fpa__Image__MinimumSpanningTree__hxx__
74
75 // eof - $RCSfile$