1 #ifndef __fpa__Image__MoriRegionGrow__hxx__
2 #define __fpa__Image__MoriRegionGrow__hxx__
4 // -------------------------------------------------------------------------
5 template< class _TInputImage, class _TOutputImage >
6 fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
11 this->m_Upper = std::numeric_limits< TPixel >::max( );
12 if( std::numeric_limits< TPixel >::is_integer )
13 this->m_Lower = std::numeric_limits< TPixel >::min( );
15 this->m_Lower = -this->m_Upper;
16 typename TBinThresholdFunction::Pointer functor =
17 TBinThresholdFunction::New( );
18 this->SetGrowFunction( functor );
21 // -------------------------------------------------------------------------
22 template< class _TInputImage, class _TOutputImage >
23 fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
28 // -------------------------------------------------------------------------
29 template< class _TInputImage, class _TOutputImage >
30 bool fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
31 _ContinueGenerateData( )
33 TBinThresholdFunction* functor =
34 dynamic_cast< TBinThresholdFunction* >( this->GetGrowFunction( ) );
35 TPixel u = functor->GetUpper( );
37 std::cout << long( u ) << " " << this->m_ActualCount << std::endl;
39 if( u < this->m_Upper )
42 if( u > this->m_Upper )
44 functor->SetUpper( u );
45 this->m_Queue = this->m_NextQueue;
46 while( this->m_NextQueue.size( ) > 0 )
47 this->m_NextQueue.pop( );
54 // -------------------------------------------------------------------------
55 template< class _TInputImage, class _TOutputImage >
56 void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
57 _BeforeGenerateData( )
59 this->Superclass::_BeforeGenerateData( );
61 while( this->m_NextQueue.size( ) > 0 )
62 this->m_NextQueue.pop( );
63 this->m_ActualCount = 0;
64 TBinThresholdFunction* functor =
65 dynamic_cast< TBinThresholdFunction* >( this->GetGrowFunction( ) );
66 functor->SetLower( this->m_Lower );
67 functor->SetUpper( this->m_Lower + this->m_Step );
70 // -------------------------------------------------------------------------
71 template< class _TInputImage, class _TOutputImage >
72 void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
75 this->Superclass::_AfterGenerateData( );
76 while( this->m_NextQueue.size( ) > 0 )
77 this->m_NextQueue.pop( );
80 // -------------------------------------------------------------------------
81 template< class _TInputImage, class _TOutputImage >
82 void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
85 this->Superclass::_BeforeLoop( );
88 // -------------------------------------------------------------------------
89 template< class _TInputImage, class _TOutputImage >
90 void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
93 this->Superclass::_AfterLoop( );
96 // -------------------------------------------------------------------------
97 template< class _TInputImage, class _TOutputImage >
98 bool fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
99 _UpdateValue( _TQueueNode& v, const _TQueueNode& p )
101 bool ret = this->Superclass::_UpdateValue( v, p );
104 v.Result = this->m_InsideValue;
105 this->m_NextQueue.push( v );
111 // -------------------------------------------------------------------------
112 template< class _TInputImage, class _TOutputImage >
113 void fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage >::
114 _UpdateResult( const _TQueueNode& n )
116 this->Superclass::_UpdateResult( n );
117 this->m_ActualCount += 1;
120 #endif // __fpa__Image__MoriRegionGrow__hxx__