-#ifndef __FPA__IMAGE__DIJKSTRA__HXX__
-#define __FPA__IMAGE__DIJKSTRA__HXX__
+#ifndef __fpa__Image__Dijkstra__hxx__
+#define __fpa__Image__Dijkstra__hxx__
+
+#include <fpa/Image/Functors/SimpleDijkstraCost.h>
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
Dijkstra( )
- : Superclass( ),
- m_UseImageSpacing( false )
+ : Superclass( )
{
+ typedef
+ fpa::Image::Functors::SimpleDijkstraCost< _TInputImage, TOutput >
+ _TCost;
+
+ typename _TCost::Pointer cost = _TCost::New( );
+ this->SetCostFunction( cost );
}
-
+
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-typename fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
-TScalar fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
-_Cost( const TVertex& a, const TVertex& b ) const
+void fpa::Image::Dijkstra< _TInputImage, _TOutputImage >::
+_BeforeGenerateData( )
{
- auto input = this->GetInput( );
- TScalar coeff = TScalar( 1 );
- if( this->m_UseImageSpacing )
- {
- typename _TInputImage::PointType pa, pb;
- input->TransformIndexToPhysicalPoint( a, pa );
- input->TransformIndexToPhysicalPoint( b, pb );
- coeff = TScalar( pa.EuclideanDistanceTo( pb ) );
-
- } // fi
- TScalar va = TScalar( input->GetPixel( a ) );
- return( va * coeff );
+ 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__
+#endif // __fpa__Image__Dijkstra__hxx__
// eof - $RCSfile$