]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Functors/SimpleDijkstraCost.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Functors / SimpleDijkstraCost.hxx
diff --git a/lib/fpa/Image/Functors/SimpleDijkstraCost.hxx b/lib/fpa/Image/Functors/SimpleDijkstraCost.hxx
new file mode 100644 (file)
index 0000000..25b8ff4
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef __fpa__Image__Functors__SimpleDijkstraCost__hxx__
+#define __fpa__Image__Functors__SimpleDijkstraCost__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TOutput >
+typename fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
+TOutput fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
+Evaluate( const TIndex& a, const TIndex& b ) const
+{
+  const _TImage* im =
+    dynamic_cast< const _TImage* >( this->m_Image.GetPointer( ) );
+  TOutput coeff = TOutput( 1 );
+  if( this->m_UseImageSpacing )
+  {
+    typename _TImage::PointType pa, pb;
+    im->TransformIndexToPhysicalPoint( a, pa );
+    im->TransformIndexToPhysicalPoint( b, pb );
+    coeff = TOutput( pa.EuclideanDistanceTo( pb ) );
+
+  } // fi
+  return( TOutput( im->GetPixel( a ) ) * coeff );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TOutput >
+fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
+SimpleDijkstraCost( )
+  : Superclass( ),
+    m_UseImageSpacing( false )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TOutput >
+fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >::
+~SimpleDijkstraCost( )
+{
+}
+
+#endif // __fpa__Image__Functors__SimpleDijkstraCost__hxx__
+
+// eof - $RCSfile$