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 aIt = this->Get( ).find( a );
15 if( aIt != this->Get( ).end( ) )
16 found = ( aIt->second.find( b ) != aIt->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 );
29 typedef typename TSkeleton::value_type _T1;
30 typedef typename TSkeletonRow::value_type _T2;
32 TSkeleton& sk = this->Get( );
33 auto sIt = sk.find( a );
34 if( sIt == sk.end( ) )
36 sIt = sk.insert( _T1( a, TSkeletonRow( ) ) ).first;
40 if( sIt->second.find( b ) == sIt->second.end( ) )
42 sIt->second.insert( _T2( b, path ) );
48 // -------------------------------------------------------------------------
49 template< class _TMST >
50 const typename fpa::Base::ImageSkeleton< _TMST >::
51 TPath* fpa::Base::ImageSkeleton< _TMST >::
52 GetBranch( const TVertex& a, const TVertex& b ) const
54 auto aIt = this->Get( ).find( a );
55 if( aIt != this->Get( ).end( ) )
57 auto bIt = aIt->second.find( b );
58 if( bIt != aIt->second.end( ) )
59 return( bIt->second.GetPointer( ) );
67 // -------------------------------------------------------------------------
68 template< class _TMST >
69 fpa::Base::ImageSkeleton< _TMST >::
75 // -------------------------------------------------------------------------
76 template< class _TMST >
77 fpa::Base::ImageSkeleton< _TMST >::
82 #endif // __FPA__BASE__IMAGESKELETON__HXX__