]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/DataStructures/Skeleton.hxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpExtensions / DataStructures / Skeleton.hxx
1 #ifndef __cpExtensions__DataStructures__Skeleton__hxx__
2 #define __cpExtensions__DataStructures__Skeleton__hxx__
3
4 // -------------------------------------------------------------------------
5 template< unsigned int _VDim >
6 void cpExtensions::DataStructures::Skeleton< _VDim >::
7 AddBranch( TPath* path )
8 {
9   // Check inputs
10   if( path == NULL )
11     return;
12   unsigned long size = path->GetSize( );
13   if( size == 0 )
14     return;
15   TIndex a = path->GetVertex( 0 );
16   TIndex b = path->GetVertex( size - 1 );
17   if( this->HasEdge( a, b ) )
18     return;
19
20   // Add path
21   this->SetVertex( a, a );
22   this->SetVertex( b, b );
23   this->AddEdge( a, b, path );
24   this->AddEdge( b, a, path );
25   // TODO: this->Modified( );
26 }
27
28 // -------------------------------------------------------------------------
29 template< unsigned int _VDim >
30 const typename cpExtensions::DataStructures::Skeleton< _VDim >::
31 TPath* cpExtensions::DataStructures::Skeleton< _VDim >::
32 GetBranch( const TIndex& a, const TIndex& b ) const
33 {
34   static const TPath* null_path = NULL;
35   if( this->HasEdge( a, b ) )
36     return( this->GetEdges( a, b ).front( ) );
37   else
38     return( null_path );
39 }
40
41 // -------------------------------------------------------------------------
42 template< unsigned int _VDim >
43 cpExtensions::DataStructures::Skeleton< _VDim >::
44 Skeleton( )
45   : Superclass( )
46 {
47 }
48
49 // -------------------------------------------------------------------------
50 template< unsigned int _VDim >
51 cpExtensions::DataStructures::Skeleton< _VDim >::
52 ~Skeleton( )
53 {
54 }
55
56 #endif // __cpExtensions__DataStructures__Skeleton__hxx__
57
58 // eof - $RCSfile$