#ifndef __FPA__BASE__IMAGESKELETON__HXX__ #define __FPA__BASE__IMAGESKELETON__HXX__ // ------------------------------------------------------------------------- template< class _TMST > void fpa::Base::ImageSkeleton< _TMST >:: AddBranch( const TVertex& a, const TVertex& b ) { if( this->m_MinimumSpanningTree.IsNull( ) ) return; // Check if the branch already exists bool found = false; auto arIt = this->Get( ).find( a ); if( arIt != this->Get( ).end( ) ) found = ( arIt->second.find( b ) != arIt->second.end( ) ); if( found ) return; // Create path auto vertices = this->m_MinimumSpanningTree->GetPath( a, b ); typename TPath::Pointer path = TPath::New( ); for( auto vIt = vertices.begin( ); vIt != vertices.end( ); ++vIt ) path->AddVertex( *vIt ); // Assign path vertices path->SetReferenceImage( this->m_MinimumSpanningTree ); this->Get( )[ a ][ b ] = path; // Create symmetric path this->AddBranch( b, a ); } // ------------------------------------------------------------------------- template< class _TMST > const typename fpa::Base::ImageSkeleton< _TMST >:: TPath* fpa::Base::ImageSkeleton< _TMST >:: GetBranch( const TVertex& a, const TVertex& b ) const { if( this->m_MinimumSpanningTree.IsNull( ) ) return( NULL ); auto aIt = this->Get( ).find( a ); if( aIt != this->Get( ).end( ) ) { auto bIt = aIt->second.find( b ); if( bIt != aIt->second.end( ) ) return( bIt->second.GetPointer( ) ); else return( NULL ); } else return( NULL ); } // ------------------------------------------------------------------------- template< class _TMST > fpa::Base::ImageSkeleton< _TMST >:: ImageSkeleton( ) : Superclass( ) { } // ------------------------------------------------------------------------- template< class _TMST > fpa::Base::ImageSkeleton< _TMST >:: ~ImageSkeleton( ) { } #endif // __FPA__BASE__IMAGESKELETON__HXX__ // eof - $RCSfile$