-#ifndef __FPA__IMAGE__DIJKSTRA__HXX__
-#define __FPA__IMAGE__DIJKSTRA__HXX__
+#ifndef __fpa__Image__Dijkstra__hxx__
+#define __fpa__Image__Dijkstra__hxx__
-#include <limits>
+#include <fpa/Image/Functors/SimpleDijkstraCost.h>
// -------------------------------------------------------------------------
-template< class I, class O >
-fpa::Image::Dijkstra< I, O >::
+template< class _TInputImage, class _TOutputImage >
+fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
Dijkstra( )
: Superclass( )
{
- this->m_CostFunction = TCostFunction::New( );
-}
+ typedef
+ fpa::Image::Functors::SimpleDijkstraCost< _TInputImage, TOutput >
+ _TCost;
-// -------------------------------------------------------------------------
-template< class I, class O >
-fpa::Image::Dijkstra< I, O >::
-~Dijkstra( )
-{
+ typename _TCost::Pointer cost = _TCost::New( );
+ this->SetCostFunction( cost );
}
// -------------------------------------------------------------------------
-template< class I, class O >
-typename fpa::Image::Dijkstra< I, O >::
-TResult fpa::Image::Dijkstra< I, O >::
-_Cost( const TVertex& v, const TVertex& p ) const
+template< class _TInputImage, class _TOutputImage >
+fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
+~Dijkstra( )
{
- if( this->_HasEdge( v, p ) )
- {
- TResult c = this->m_CostFunction->Evaluate( v, p );
- if( this->m_ConversionFunction.IsNotNull( ) )
- c = this->m_ConversionFunction->Evaluate( c );
- return( c );
- }
- else
- return( std::numeric_limits< TResult >::max( ) );
}
// -------------------------------------------------------------------------
-template< class I, class O >
-void fpa::Image::Dijkstra< I, O >::
+template< class _TInputImage, class _TOutputImage >
+void fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
_BeforeGenerateData( )
{
this->Superclass::_BeforeGenerateData( );
- this->m_CostFunction->SetInputImage( this->GetInput( ) );
-}
-// -------------------------------------------------------------------------
-template< class I, class O >
-void fpa::Image::Dijkstra< I, O >::
-_InitResults( )
-{
- this->Superclass::_InitResults( );
- this->GetOutput( )->FillBuffer( std::numeric_limits< TResult >::max( ) );
+ TCostFunction* cost =
+ dynamic_cast< TCostFunction* >( this->GetCostFunction( ) );
+ if( cost == NULL )
+ itkExceptionMacro( << "CostFunction not well defined." );
+ cost->SetImage( this->GetInput( ) );
}
-#endif // __FPA__IMAGE__DIJKSTRA__HXX__
+#endif // __fpa__Image__Dijkstra__hxx__
// eof - $RCSfile$