1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Filters__RandomWalker__hxx__
6 #define __fpa__Filters__RandomWalker__hxx__
10 // -------------------------------------------------------------------------
11 template< class _TDataInterface >
12 void fpa::Filters::RandomWalker< _TDataInterface >::
13 SetWeightFunction( TScalarWeight* p )
15 if( this->m_ScalarWeight.GetPointer( ) != p )
17 this->_Deassociate( this->m_ScalarWeight );
18 this->m_ScalarWeight = p;
19 this->_Associate( this->m_ScalarWeight );
25 // -------------------------------------------------------------------------
26 template< class _TDataInterface >
27 void fpa::Filters::RandomWalker< _TDataInterface >::
28 SetWeightFunction( TVertexWeight* p )
30 if( this->m_VertexWeight.GetPointer( ) != p )
32 this->_Deassociate( this->m_VertexWeight );
33 this->m_VertexWeight = p;
34 this->_Associate( this->m_VertexWeight );
40 // -------------------------------------------------------------------------
41 template< class _TDataInterface >
42 fpa::Filters::RandomWalker< _TDataInterface >::
46 this->SetInitValue( TCost( 0 ) );
47 this->SetFillValue( std::numeric_limits< TCost >::max( ) );
50 fpa::Functors::RegionGrow::Tautology< TInputValue >::New( )
55 // -------------------------------------------------------------------------
56 template< class _TDataInterface >
57 fpa::Filters::RandomWalker< _TDataInterface >::
62 // -------------------------------------------------------------------------
63 template< class _TDataInterface >
64 void fpa::Filters::RandomWalker< _TDataInterface >::
65 _PostComputeOutputValue( TNode& n )
67 // Nothing to do with this algorithm
70 // -------------------------------------------------------------------------
71 template< class _TDataInterface >
72 void fpa::Filters::RandomWalker< _TDataInterface >::
73 _PreComputeOutputValue( TNode& n )
75 if( this->m_VertexWeight.IsNotNull( ) )
77 TCost c = this->m_VertexWeight->Evaluate( n.Vertex, n.Parent );
78 if( this->m_ScalarWeight.IsNotNull( ) )
79 c = this->m_ScalarWeight->Evaluate( c );
80 n.Value = c + this->_GetOutputValue( n.Parent );
83 n.Value = TCost( -1 );
86 #endif // __fpa__Filters__RandomWalker__hxx__