1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Filters__RegionGrow__hxx__
6 #define __fpa__Filters__RegionGrow__hxx__
9 #include <fpa/Functors/RegionGrow/Tautology.h>
11 // -------------------------------------------------------------------------
12 template< class _TDataInterface >
13 void fpa::Filters::RegionGrow< _TDataInterface >::
14 SetPredicate( TScalarPredicate* p )
16 if( this->m_ScalarPredicate.GetPointer( ) != p )
18 this->_Deassociate( this->m_ScalarPredicate );
19 this->m_ScalarPredicate = p;
20 this->_Associate( this->m_ScalarPredicate );
26 // -------------------------------------------------------------------------
27 template< class _TDataInterface >
28 void fpa::Filters::RegionGrow< _TDataInterface >::
29 SetPredicate( TVertexPredicate* p )
31 if( this->m_VertexPredicate.GetPointer( ) != p )
33 this->_Deassociate( this->m_VertexPredicate );
34 this->m_VertexPredicate = p;
35 this->_Associate( this->m_VertexPredicate );
41 // -------------------------------------------------------------------------
42 template< class _TDataInterface >
43 typename fpa::Filters::RegionGrow< _TDataInterface >::
44 TOutputValue fpa::Filters::RegionGrow< _TDataInterface >::
45 GetOutsideValue( ) const
47 return( this->GetInitValue( ) );
50 // -------------------------------------------------------------------------
51 template< class _TDataInterface >
52 void fpa::Filters::RegionGrow< _TDataInterface >::
53 SetOutsideValue( const TOutputValue& v )
55 this->SetInitValue( v );
58 // -------------------------------------------------------------------------
59 template< class _TDataInterface >
60 fpa::Filters::RegionGrow< _TDataInterface >::
64 this->SetOutsideValue( TOutputValue( 0 ) );
65 this->SetFillValue( TOutputValue( 0 ) );
66 this->m_InsideValue = std::numeric_limits< TOutputValue >::max( );
68 fpa::Functors::RegionGrow::Tautology< TInputValue >::New( )
72 // -------------------------------------------------------------------------
73 template< class _TDataInterface >
74 fpa::Filters::RegionGrow< _TDataInterface >::
79 // -------------------------------------------------------------------------
80 template< class _TDataInterface >
81 void fpa::Filters::RegionGrow< _TDataInterface >::
82 _PostComputeOutputValue( TNode& n )
84 TInputValue value = this->_GetInputValue( n.Vertex );
86 if( this->m_ScalarPredicate.IsNotNull( ) )
87 inside = this->m_ScalarPredicate->Evaluate( value );
88 if( this->m_VertexPredicate.IsNotNull( ) )
89 inside &= this->m_VertexPredicate->Evaluate( n.Vertex, n.Parent );
92 n.Value = this->GetOutsideValue( );
96 n.Value = this->GetInsideValue( );
99 // -------------------------------------------------------------------------
100 template< class _TDataInterface >
101 void fpa::Filters::RegionGrow< _TDataInterface >::
102 _PreComputeOutputValue( TNode& n )
104 // Nothing to do with this algorithm
107 #endif // __fpa__Filters__RegionGrow__hxx__