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__
8 // -------------------------------------------------------------------------
9 template< class _TDataInterface >
10 void fpa::Filters::RandomWalker< _TDataInterface >::
11 SetWeightFunction( TScalarWeight* p )
13 if( this->m_ScalarWeight.GetPointer( ) != p )
15 this->_Deassociate( this->m_ScalarWeight );
16 this->m_ScalarWeight = p;
17 this->_Associate( this->m_ScalarWeight );
23 // -------------------------------------------------------------------------
24 template< class _TDataInterface >
25 void fpa::Filters::RandomWalker< _TDataInterface >::
26 SetWeightFunction( TVertexWeight* p )
28 if( this->m_VertexWeight.GetPointer( ) != p )
30 this->_Deassociate( this->m_VertexWeight );
31 this->m_VertexWeight = p;
32 this->_Associate( this->m_VertexWeight );
38 // -------------------------------------------------------------------------
39 template< class _TDataInterface >
40 fpa::Filters::RandomWalker< _TDataInterface >::
44 this->SetInitValue( TCost( 0 ) );
47 fpa::Functors::RegionGrow::Tautology< TInputValue >::New( )
52 // -------------------------------------------------------------------------
53 template< class _TDataInterface >
54 fpa::Filters::RandomWalker< _TDataInterface >::
59 // -------------------------------------------------------------------------
60 template< class _TDataInterface >
61 void fpa::Filters::RandomWalker< _TDataInterface >::
62 _PostComputeOutputValue( TNode& n )
64 // Nothing to do with this algorithm
67 // -------------------------------------------------------------------------
68 template< class _TDataInterface >
69 void fpa::Filters::RandomWalker< _TDataInterface >::
70 _PreComputeOutputValue( TNode& n )
72 if( this->m_VertexWeight.IsNotNull( ) )
74 TCost c = this->m_VertexWeight->Evaluate( n.Vertex, n.Parent );
75 if( this->m_ScalarWeight.IsNotNull( ) )
76 c = this->m_ScalarWeight->Evaluate( c );
77 n.Value = c + this->_GetOutputValue( n.Parent );
80 n.Value = TCost( -1 );
83 #endif // __fpa__Filters__RandomWalker__hxx__