]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Dijkstra.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Dijkstra.hxx
index 4f7b60beee216b3700d416017c4105395246a8dc..1f21dc4335cddbe310c8fe5ef0e9d6ee65c1f9f2 100644 (file)
@@ -1,59 +1,26 @@
-#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/VertexCost.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::VertexCost< _TInputImage, TOutput > _TCost;
+  typename _TCost::Pointer cost = _TCost::New( );
+  this->SetVertexFunction( cost );
 }
 
 // -------------------------------------------------------------------------
-template< class I, class O >
-fpa::Image::Dijkstra< I, O >::
+template< class _TInputImage, class _TOutputImage >
+fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
 ~Dijkstra( )
 {
 }
 
-// -------------------------------------------------------------------------
-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
-{
-  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 >::
-_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( TResult( 0 ) );
-}
-
-#endif // __FPA__IMAGE__DIJKSTRA__HXX__
+#endif // __fpa__Image__Dijkstra__hxx__
 
 // eof - $RCSfile$