// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Base__Dijkstra__hxx__ #define __fpa__Base__Dijkstra__hxx__ // ------------------------------------------------------------------------- template< class _TAlgorithm, class _TMST > typename fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: TMST* fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: GetMinimumSpanningTree( ) { dynamic_cast< TMST* >( this->itk::ProcessObject::GetOutput( this->m_MSTIdx ) ); } // ------------------------------------------------------------------------- template< class _TAlgorithm, class _TMST > const typename fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: TMST* fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: GetMinimumSpanningTree( ) const { dynamic_cast< const TMST* >( this->itk::ProcessObject::GetOutput( this->m_MSTIdx ) ); } // ------------------------------------------------------------------------- template< class _TAlgorithm, class _TMST > fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: Dijkstra( ) : Superclass( ) { this->m_MSTIdx = this->GetNumberOfRequiredOutputs( ); this->itk::ProcessObject::SetNumberOfRequiredOutputs( this->m_MSTIdx + 1 ); this->SetNthOutput( this->m_MSTIdx, TMST::New( ) ); } // ------------------------------------------------------------------------- template< class _TAlgorithm, class _TMST > fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: ~Dijkstra( ) { } // ------------------------------------------------------------------------- template< class _TAlgorithm, class _TMST > void fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: _AfterGenerateData( ) { typedef typename Superclass::TSeedsInterface::TSeeds::iterator _TIt; this->Superclass::_AfterGenerateData( ); TMST* mst = this->GetMinimumSpanningTree( ); mst->ClearSeeds( ); mst->SetCollisions( this->m_Collisions ); for( _TIt sIt = this->BeginSeeds( ); sIt != this->EndSeeds( ); ++sIt ) mst->AddSeed( sIt->Vertex ); } // ------------------------------------------------------------------------- template< class _TAlgorithm, class _TMST > void fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: _UpdateOutputValue( const TNode& n ) { this->Superclass::_UpdateOutputValue( n ); this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent ); } #endif // __fpa__Base__Dijkstra__hxx__ // eof - $RCSfile$