]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/MinimumSpanningTree.hxx
...
[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   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::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   path = TPolyLineParametricPath::New( );
52   path->SetReferenceImage( this );
53   typename TVertices::const_iterator vIt = v.begin( );
54   for( ; vIt != v.end( ); ++vIt )
55     path->AddVertex( *vIt );
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$