1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
6 #ifndef __fpa__Base__Dijkstra__hxx__
7 #define __fpa__Base__Dijkstra__hxx__
9 // -------------------------------------------------------------------------
10 template< class _TAlgorithm, class _TMST >
11 typename fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
12 TMST* fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
13 GetMinimumSpanningTree( )
16 dynamic_cast< TMST* >(
17 this->itk::ProcessObject::GetOutput( this->m_MSTIdx )
22 // -------------------------------------------------------------------------
23 template< class _TAlgorithm, class _TMST >
24 const typename fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
25 TMST* fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
26 GetMinimumSpanningTree( ) const
29 dynamic_cast< const TMST* >(
30 this->itk::ProcessObject::GetOutput( this->m_MSTIdx )
35 // -------------------------------------------------------------------------
36 template< class _TAlgorithm, class _TMST >
37 fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
41 this->m_MSTIdx = this->GetNumberOfRequiredOutputs( );
42 this->itk::ProcessObject::SetNumberOfRequiredOutputs( this->m_MSTIdx + 1 );
43 this->SetNthOutput( this->m_MSTIdx, TMST::New( ) );
46 // -------------------------------------------------------------------------
47 template< class _TAlgorithm, class _TMST >
48 fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
53 // -------------------------------------------------------------------------
54 template< class _TAlgorithm, class _TMST >
55 void fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
58 this->Superclass::_AfterGenerateData( );
60 TMST* mst = this->GetMinimumSpanningTree( );
62 mst->SetCollisions( this->m_Collisions );
64 TSeeds seeds = this->GetSeeds( );
65 typename TSeeds::const_iterator sIt = seeds.begin( );
66 for( ; sIt != seeds.end( ); ++sIt )
69 mst->AddSeed( sIt->Vertex );
74 // -------------------------------------------------------------------------
75 template< class _TAlgorithm, class _TMST >
76 void fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
77 _UpdateOutputValue( const TNode& n )
79 this->Superclass::_UpdateOutputValue( n );
80 this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent );
83 #endif // __fpa__Base__Dijkstra__hxx__