1 #ifndef __FPA__BASE__IMAGESKELETON__HXX__
2 #define __FPA__BASE__IMAGESKELETON__HXX__
4 // -------------------------------------------------------------------------
5 template< class _TMST >
6 void fpa::Base::ImageSkeleton< _TMST >::
7 AddBranch( const TVertex& a, const TVertex& b )
9 if( this->m_MinimumSpanningTree.IsNull( ) )
12 // Check if the branch already exists
14 auto arIt = this->Get( ).find( a );
15 if( arIt != this->Get( ).end( ) )
16 found = ( arIt->second.find( b ) != arIt->second.end( ) );
21 auto vertices = this->m_MinimumSpanningTree->GetPath( a, b );
22 typename TPath::Pointer path = TPath::New( );
23 for( auto vIt = vertices.begin( ); vIt != vertices.end( ); ++vIt )
24 path->AddVertex( *vIt );
26 // Assign path vertices
27 path->SetReferenceImage( this->m_MinimumSpanningTree );
28 this->Get( )[ a ][ b ] = path;
30 // Create symmetric path
31 this->AddBranch( b, a );
34 // -------------------------------------------------------------------------
35 template< class _TMST >
36 const typename fpa::Base::ImageSkeleton< _TMST >::
37 TPath* fpa::Base::ImageSkeleton< _TMST >::
38 GetBranch( const TVertex& a, const TVertex& b ) const
40 if( this->m_MinimumSpanningTree.IsNull( ) )
43 auto aIt = this->Get( ).find( a );
44 if( aIt != this->Get( ).end( ) )
46 auto bIt = aIt->second.find( b );
47 if( bIt != aIt->second.end( ) )
48 return( bIt->second.GetPointer( ) );
56 // -------------------------------------------------------------------------
57 template< class _TMST >
58 fpa::Base::ImageSkeleton< _TMST >::
64 // -------------------------------------------------------------------------
65 template< class _TMST >
66 fpa::Base::ImageSkeleton< _TMST >::
71 #endif // __FPA__BASE__IMAGESKELETON__HXX__