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