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;
32 // -------------------------------------------------------------------------
33 template< class _TMST >
34 const typename fpa::Base::ImageSkeleton< _TMST >::
35 TPath* fpa::Base::ImageSkeleton< _TMST >::
36 GetBranch( const TVertex& a, const TVertex& b ) const
38 auto aIt = this->Get( ).find( a );
39 if( aIt != this->Get( ).end( ) )
41 auto bIt = aIt->second.find( b );
42 if( bIt != aIt->second.end( ) )
43 return( bIt->second.GetPointer( ) );
51 // -------------------------------------------------------------------------
52 template< class _TMST >
53 fpa::Base::ImageSkeleton< _TMST >::
59 // -------------------------------------------------------------------------
60 template< class _TMST >
61 fpa::Base::ImageSkeleton< _TMST >::
66 #endif // __FPA__BASE__IMAGESKELETON__HXX__