X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FDijkstraBase.hxx;fp=lib%2Ffpa%2FBase%2FDijkstraBase.hxx;h=0000000000000000000000000000000000000000;hb=3c639e5da479c7216a0a302ffa156ac6762caeed;hp=d04ecf56e7bba0299b5190043b423fbc3f0e232b;hpb=5bf766068f54d061d3816f4950a076c3cf3a4d8b;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/DijkstraBase.hxx b/lib/fpa/Base/DijkstraBase.hxx deleted file mode 100644 index d04ecf5..0000000 --- a/lib/fpa/Base/DijkstraBase.hxx +++ /dev/null @@ -1,111 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= - -#ifndef __fpa__Base__DijkstraBase__hxx__ -#define __fpa__Base__DijkstraBase__hxx__ - -#include -#include - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -itk::ModifiedTimeType fpa::Base::DijkstraBase< _TAlgorithm >:: -GetMTime( ) const -{ - itk::ModifiedTimeType t = this->Superclass::GetMTime( ); - if( this->m_WeightFunction.IsNotNull( ) ) - { - itk::ModifiedTimeType q = this->m_WeightFunction->GetMTime( ); - t = ( q < t )? q: t; - - } // fi - return( t ); -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -fpa::Base::DijkstraBase< _TAlgorithm >:: -DijkstraBase( ) - : Superclass( ) -{ - this->SetInitValue( std::numeric_limits< TOutputValue >::max( ) ); -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -fpa::Base::DijkstraBase< _TAlgorithm >:: -~DijkstraBase( ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -void fpa::Base::DijkstraBase< _TAlgorithm >:: -_ComputeOutputValue( TNode& n ) -{ - TOutputValue c = this->m_WeightFunction->Evaluate( n.Vertex, n.Parent ); - n.Value = c + this->_GetOutputValue( n.Parent ); -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -void fpa::Base::DijkstraBase< _TAlgorithm >:: -_QueueClear( ) -{ - this->m_Queue.clear( ); -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -typename fpa::Base::DijkstraBase< _TAlgorithm >:: -TNode fpa::Base::DijkstraBase< _TAlgorithm >:: -_QueuePop( ) -{ - std::pop_heap( - this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder - ); - TNode n = this->m_Queue.back( ); - this->m_Queue.pop_back( ); - return( n ); -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -void fpa::Base::DijkstraBase< _TAlgorithm >:: -_QueuePush( const TNode& node ) -{ - bool push_needed = ( node.Parent == node.Vertex ); - push_needed |= !( node.Value < this->_GetOutputValue( node.Parent ) ); - if( push_needed ) - { - this->m_Queue.push_back( node ); - std::push_heap( - this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder - ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -unsigned long fpa::Base::DijkstraBase< _TAlgorithm >:: -_QueueSize( ) const -{ - return( this->m_Queue.size( ) ); -} - -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -void fpa::Base::DijkstraBase< _TAlgorithm >:: -_PrepareSeeds( TNodes& nodes ) -{ - typename TNodes::iterator nIt = nodes.begin( ); - for( ; nIt != nodes.end( ); ++nIt ) - nIt->Value = TOutputValue( 0 ); -} - -#endif // __fpa__Base__DijkstraBase__hxx__ - -// eof - $RCSfile$