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