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( )
15 dynamic_cast< TMST* >(
16 this->itk::ProcessObject::GetOutput( this->m_MSTIdx )
20 // -------------------------------------------------------------------------
21 template< class _TAlgorithm, class _TMST >
22 const typename fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
23 TMST* fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
24 GetMinimumSpanningTree( ) const
26 dynamic_cast< const TMST* >(
27 this->itk::ProcessObject::GetOutput( this->m_MSTIdx )
31 // -------------------------------------------------------------------------
32 template< class _TAlgorithm, class _TMST >
33 fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
37 this->m_MSTIdx = this->GetNumberOfRequiredOutputs( );
38 this->itk::ProcessObject::SetNumberOfRequiredOutputs( this->m_MSTIdx + 1 );
39 this->SetNthOutput( this->m_MSTIdx, TMST::New( ) );
42 // -------------------------------------------------------------------------
43 template< class _TAlgorithm, class _TMST >
44 fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
49 // -------------------------------------------------------------------------
50 template< class _TAlgorithm, class _TMST >
51 void fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
54 typedef typename Superclass::TSeedsInterface::TSeeds::iterator _TIt;
56 TMST* mst = this->GetMinimumSpanningTree( );
58 mst->SetCollisions( this->m_Collisions );
59 for( _TIt sIt = this->BeginSeeds( ); sIt != this->EndSeeds( ); ++sIt )
60 mst->AddSeed( sIt->Vertex );
63 // -------------------------------------------------------------------------
64 template< class _TAlgorithm, class _TMST >
65 void fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
66 _UpdateOutputValue( const TNode& n )
68 this->Superclass::_UpdateOutputValue( n );
69 this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent );
72 #endif // __fpa__Base__Dijkstra__hxx__