]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Functors/SimpleDijkstraCost.hxx
25b8ff42aeea8498932f4b4411fe7aa6d9c5256d
[FrontAlgorithms.git] / lib / fpa / Image / Functors / SimpleDijkstraCost.hxx
1 #ifndef __fpa__Image__Functors__SimpleDijkstraCost__hxx__
2 #define __fpa__Image__Functors__SimpleDijkstraCost__hxx__
3
4 // -------------------------------------------------------------------------
5 template< class _TImage, class _TOutput >
6 typename fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
7 TOutput fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
8 Evaluate( const TIndex& a, const TIndex& b ) const
9 {
10   const _TImage* im =
11     dynamic_cast< const _TImage* >( this->m_Image.GetPointer( ) );
12   TOutput coeff = TOutput( 1 );
13   if( this->m_UseImageSpacing )
14   {
15     typename _TImage::PointType pa, pb;
16     im->TransformIndexToPhysicalPoint( a, pa );
17     im->TransformIndexToPhysicalPoint( b, pb );
18     coeff = TOutput( pa.EuclideanDistanceTo( pb ) );
19
20   } // fi
21   return( TOutput( im->GetPixel( a ) ) * coeff );
22 }
23
24 // -------------------------------------------------------------------------
25 template< class _TImage, class _TOutput >
26 fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
27 SimpleDijkstraCost( )
28   : Superclass( ),
29     m_UseImageSpacing( false )
30 {
31 }
32
33 // -------------------------------------------------------------------------
34 template< class _TImage, class _TOutput >
35 fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
36 ~SimpleDijkstraCost( )
37 {
38 }
39
40 #endif // __fpa__Image__Functors__SimpleDijkstraCost__hxx__
41
42 // eof - $RCSfile$