#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 aIt = this->Get( ).find( a ); if( aIt != this->Get( ).end( ) ) found = ( aIt->second.find( b ) != aIt->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 ); typedef typename TSkeleton::value_type _T1; typedef typename TSkeletonRow::value_type _T2; TSkeleton& sk = this->Get( ); auto sIt = sk.find( a ); if( sIt == sk.end( ) ) { sIt = sk.insert( _T1( a, TSkeletonRow( ) ) ).first; this->Modified( ); } // fi if( sIt->second.find( b ) == sIt->second.end( ) ) { sIt->second.insert( _T2( b, path ) ); this->Modified( ); } // fi } // ------------------------------------------------------------------------- template< class _TMST > const typename fpa::Base::ImageSkeleton< _TMST >:: TPath* fpa::Base::ImageSkeleton< _TMST >:: GetBranch( const TVertex& a, const TVertex& b ) const { 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$