1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__DataStructures__Image__Skeleton__hxx__
6 #define __fpa__DataStructures__Image__Skeleton__hxx__
8 // -------------------------------------------------------------------------
9 template< unsigned int _VDim >
10 void fpa::DataStructures::Image::Skeleton< _VDim >::
11 AddBranch( TPath* path )
16 unsigned long size = path->GetSize( );
19 TIndex a = path->GetVertex( 0 );
20 TIndex b = path->GetVertex( size - 1 );
21 if( this->HasEdge( a, b ) )
25 this->SetVertex( a, a );
26 this->SetVertex( b, b );
27 this->AddEdge( a, b, path );
28 this->AddEdge( b, a, path );
32 // -------------------------------------------------------------------------
33 template< unsigned int _VDim >
34 const typename fpa::DataStructures::Image::Skeleton< _VDim >::
35 TPath* fpa::DataStructures::Image::Skeleton< _VDim >::
36 GetBranch( const TIndex& a, const TIndex& b ) const
38 static const TPath* null_path = NULL;
39 if( this->HasEdge( a, b ) )
40 return( this->GetEdges( a, b ).front( ) );
45 // -------------------------------------------------------------------------
46 template< unsigned int _VDim >
47 std::vector< typename fpa::DataStructures::Image::Skeleton< _VDim >::TIndex >
48 fpa::DataStructures::Image::Skeleton< _VDim >::
51 std::vector< TIndex > res;
52 typename Superclass::TMatrix::const_iterator mIt = this->BeginEdgesRows( );
53 for( ; mIt != this->EndEdgesRows( ); ++mIt )
55 unsigned long count = mIt->second.size( );
57 res.push_back( mIt->first );
63 // -------------------------------------------------------------------------
64 template< unsigned int _VDim >
65 std::vector< typename fpa::DataStructures::Image::Skeleton< _VDim >::TIndex >
66 fpa::DataStructures::Image::Skeleton< _VDim >::
67 GetBifurcations( ) const
69 std::vector< TIndex > res;
70 typename Superclass::TMatrix::const_iterator mIt = this->BeginEdgesRows( );
71 for( ; mIt != this->EndEdgesRows( ); ++mIt )
73 unsigned long count = mIt->second.size( );
75 res.push_back( mIt->first );
81 // -------------------------------------------------------------------------
82 template< unsigned int _VDim >
83 fpa::DataStructures::Image::Skeleton< _VDim >::
89 // -------------------------------------------------------------------------
90 template< unsigned int _VDim >
91 fpa::DataStructures::Image::Skeleton< _VDim >::
96 #endif // __fpa__DataStructures__Image__Skeleton__hxx__