1 #ifndef __FPA__BASE__EXTRACTBRANCHESFROMMINIMUMSPANNINGTREE__HXX__
2 #define __FPA__BASE__EXTRACTBRANCHESFROMMINIMUMSPANNINGTREE__HXX__
4 // -------------------------------------------------------------------------
6 const T* fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
10 dynamic_cast< const T* >( this->itk::ProcessObject::GetInput( 0 ) )
14 // -------------------------------------------------------------------------
16 void fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
17 SetInput( const T* tree )
19 this->itk::ProcessObject::SetNthInput( 0, const_cast< T* >( tree ) );
22 // -------------------------------------------------------------------------
24 typename fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
25 TBranches* fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
29 itkDynamicCastInDebugMode< TBranches* >( this->GetPrimaryOutput( ) )
33 // -------------------------------------------------------------------------
35 void fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
38 this->m_EndPoints.clear( );
42 // -------------------------------------------------------------------------
44 void fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
45 AddEndPoint( const TVertex& v )
47 if( this->m_EndPoints.find( v ) == this->m_EndPoints.end( ) )
49 std::cout << "Add " << v << std::endl;
51 this->m_EndPoints.insert( v );
57 // -------------------------------------------------------------------------
59 bool fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
60 HasEndPoint( const TVertex& v ) const
62 return( this->m_EndPoints.find( v ) != this->m_EndPoints.end( ) );
65 // -------------------------------------------------------------------------
67 unsigned long fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
68 GetNumberOfEndPoints( ) const
70 return( this->m_EndPoints.size( ) );
73 // -------------------------------------------------------------------------
75 fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
76 ExtractBranchesFromMinimumSpanningTree( )
79 this->itk::ProcessObject::SetNumberOfRequiredInputs( 1 );
81 typename TBranches::Pointer out =
82 static_cast< TBranches* >( this->MakeOutput( 0 ).GetPointer( ) );
83 this->itk::ProcessObject::SetNumberOfRequiredOutputs( 1 );
84 this->itk::ProcessObject::SetNthOutput( 0, out.GetPointer( ) );
87 // -------------------------------------------------------------------------
89 fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
90 ~ExtractBranchesFromMinimumSpanningTree( )
94 // -------------------------------------------------------------------------
96 void fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
99 const T* tree = this->GetInput( );
100 TBranches* branches = this->GetOutput( );
102 auto e0It = this->m_EndPoints.begin( );
103 for( ; e0It != this->m_EndPoints.end( ); ++e0It )
107 for( ; e1It != this->m_EndPoints.end( ); ++e1It )
109 std::cout << *e0It << " " << *e1It << std::endl;
110 // std::vector< TVertex > path = tree->GetPath( *e0It, *e1It );
119 // Purposely not implemented
120 ExtractBranchesFromMinimumSpanningTree( const Self& other );
121 Self& operator=( const Self& other );
124 TEndPoints m_EndPoints;
132 #endif // __FPA__BASE__EXTRACTBRANCHESFROMMINIMUMSPANNINGTREE__HXX__