]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/DataStructures/Image/MinimumSpanningTree.hxx
...
[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 GetPath( typename TPath::Pointer& path, const TVertex& a ) const
29 {
30   TVertices v = this->GetAxis( a );
31   if( path.IsNull( ) )
32     path = TPath::New( );
33   path->SetReferenceImage( this );
34   typename TVertices::const_iterator vIt = v.begin( );
35   for( ; vIt != v.end( ); ++vIt )
36     path->AddVertex( *vIt );
37 }
38
39 // -------------------------------------------------------------------------
40 template< unsigned int _VDim >
41 void fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
42 GetPath(
43   typename TPath::Pointer& path, const TVertex& a, const TVertex& b
44   ) const
45 {
46   TVertices v = this->GetAxis( a, b );
47   if( path.IsNull( ) )
48     path = TPath::New( );
49   path->SetReferenceImage( this );
50   typename TVertices::const_iterator vIt = v.begin( );
51   for( ; vIt != v.end( ); ++vIt )
52     path->AddVertex( *vIt );
53 }
54
55 // -------------------------------------------------------------------------
56 template< unsigned int _VDim >
57 fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
58 MinimumSpanningTree( )
59   : Superclass( )
60 {
61 }
62
63 // -------------------------------------------------------------------------
64 template< unsigned int _VDim >
65 fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
66 ~MinimumSpanningTree( )
67 {
68 }
69
70 #endif // __fpa__DataStructures__Image__MinimumSpanningTree__hxx__
71 // eof - $RCSfile$