]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/FastMarching.hxx
...
[FrontAlgorithms.git] / libs / fpa / Image / FastMarching.hxx
1 #ifndef __fpa__Image__FastMarching__hxx__
2 #define __fpa__Image__FastMarching__hxx__
3
4 #include <fpa/Image/Functors/VertexCost.h>
5
6 // -------------------------------------------------------------------------
7 template< class _TInputImage, class _TOutputImage >
8 fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
9 FastMarching( )
10   : Superclass( )
11 {
12   typedef fpa::Image::Functors::VertexCost< _TInputImage, TOutput > _TCost;
13   typename _TCost::Pointer cost = _TCost::New( );
14   this->SetVertexFunction( cost );
15   this->m_InitResult = std::numeric_limits< TOutput >::max( );
16 }
17
18 // -------------------------------------------------------------------------
19 template< class _TInputImage, class _TOutputImage >
20 fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
21 ~FastMarching( )
22 {
23 }
24
25 // -------------------------------------------------------------------------
26 template< class _TInputImage, class _TOutputImage >
27 typename fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
28 TFastMarchingNeighborhood
29 fpa::Image::FastMarching< _TInputImage, _TOutputImage >::
30 _FastMarchingNeighbors( const TVertex& v ) const
31 {
32   TFastMarchingNeighborhood neighs;
33   typename _TInputImage::SpacingType spac = this->GetInput( )->GetSpacing( );
34   for( unsigned int d = 0; d < _TInputImage::ImageDimension; ++d )
35   {
36     for( int i = -1; i <= 1; i += 2 )
37     {
38       TVertex n = v;
39       n[ d ] += i;
40       neighs.push_back( TFastMarchingNeighbor( n, spac[ d ] ) );
41
42     } // rof
43
44   } // rof
45   return( neighs );
46 }
47
48 #endif // __fpa__Image__FastMarching__hxx__
49
50 // eof - $RCSfile$