-// -------------------------------------------------------------------------
-template< class I, class O >
-void fpa::Image::Dijkstra< I, O >::
-_AfterGenerateData( )
-{
- this->Superclass::_AfterGenerateData( );
- this->GetMinimumSpanningTree( )->SetCollisions( this->m_Collisions );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-void fpa::Image::Dijkstra< I, O >::
-_InitResults( )
-{
- this->Superclass::_InitResults( );
- this->GetOutput( )->FillBuffer( TResult( 0 ) );
+ TCostFunction* cost =
+ dynamic_cast< TCostFunction* >( this->GetCostFunction( ) );
+ if( cost == NULL )
+ itkExceptionMacro( << "CostFunction not well defined." );
+ cost->SetImage( this->GetInput( ) );