]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Dijkstra.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Dijkstra.hxx
index 2831159ca2fc09943f17fc3f2747aa81b064a2e0..1f21dc4335cddbe310c8fe5ef0e9d6ee65c1f9f2 100644 (file)
@@ -1,12 +1,17 @@
 #ifndef __fpa__Image__Dijkstra__hxx__
 #define __fpa__Image__Dijkstra__hxx__
 
+#include <fpa/Image/Functors/VertexCost.h>
+
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage >
 fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
 Dijkstra( )
   : Superclass( )
 {
+  typedef fpa::Image::Functors::VertexCost< _TInputImage, TOutput > _TCost;
+  typename _TCost::Pointer cost = _TCost::New( );
+  this->SetVertexFunction( cost );
 }
 
 // -------------------------------------------------------------------------
@@ -16,20 +21,6 @@ fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
 {
 }
 
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage >
-void fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
-_BeforeGenerateData( )
-{
-  this->Superclass::_BeforeGenerateData( );
-
-  TCostFunction* cost =
-    dynamic_cast< TCostFunction* >( this->GetCostFunction( ) );
-  if( cost == NULL )
-    itkExceptionMacro( << "CostFunction not well defined." );
-  cost->SetImage( this->GetInput( ) );
-}
-
 #endif // __fpa__Image__Dijkstra__hxx__
 
 // eof - $RCSfile$