// ========================================================================= // @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( ) { return( 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 { return( 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( ) { this->Superclass::_AfterGenerateData( ); TMST* mst = this->GetMinimumSpanningTree( ); mst->ClearSeeds( ); mst->SetCollisions( this->m_Collisions ); const TSeeds& seeds = this->GetSeeds( ); typename TSeeds::const_iterator sIt = seeds.begin( ); for( ; sIt != seeds.end( ); ++sIt ) { if( sIt->IsUnified ) mst->AddSeed( sIt->Vertex ); } // rof } // ------------------------------------------------------------------------- template< class _TAlgorithm, class _TMST > void fpa::Base::Dijkstra< _TAlgorithm, _TMST >:: _UpdateOutputValue( TNode& n ) { this->Superclass::_UpdateOutputValue( n ); this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent ); } #endif // __fpa__Base__Dijkstra__hxx__ // eof - $RCSfile$