X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FDijkstra.hxx;h=2831159ca2fc09943f17fc3f2747aa81b064a2e0;hb=3f4722ccf68d830e26dac9b945925efa68e39e4c;hp=b81a533ba25d5dd139062e67114692c48bb34747;hpb=56b8bb48cc05a297a3faa264f8f2a88de21ef203;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/Dijkstra.hxx b/lib/fpa/Image/Dijkstra.hxx index b81a533..2831159 100644 --- a/lib/fpa/Image/Dijkstra.hxx +++ b/lib/fpa/Image/Dijkstra.hxx @@ -1,15 +1,14 @@ -#ifndef __FPA__IMAGE__DIJKSTRA__HXX__ -#define __FPA__IMAGE__DIJKSTRA__HXX__ +#ifndef __fpa__Image__Dijkstra__hxx__ +#define __fpa__Image__Dijkstra__hxx__ // ------------------------------------------------------------------------- template< class _TInputImage, class _TOutputImage > fpa::Image::Dijkstra< _TInputImage, _TOutputImage >:: Dijkstra( ) - : Superclass( ), - m_UseImageSpacing( false ) + : Superclass( ) { } - + // ------------------------------------------------------------------------- template< class _TInputImage, class _TOutputImage > fpa::Image::Dijkstra< _TInputImage, _TOutputImage >:: @@ -19,24 +18,18 @@ 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 ) ); + this->Superclass::_BeforeGenerateData( ); - } // fi - TScalar va = TScalar( input->GetPixel( a ) ); - return( va * coeff ); + 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$