: Superclass( ),
m_DerivativeThreshold( double( 3 ) )
{
- /* TODO
- typedef
- fpa::Image::Functors::RegionGrowThresholdFunction< I >
- TFunction;
- typename TFunction::Pointer function = TFunction::New( );
- this->SetMembershipFunction( function );
- */
}
// -------------------------------------------------------------------------
{
}
-// -------------------------------------------------------------------------
-template< class I >
-bool fpa::Image::RegionGrowWithMultipleThresholds< I >::
-_UpdateResult( _TNode& n )
-{
- bool ret = this->Superclass::_UpdateResult( n );
- std::cout << "Image:UpdateResult " << ret << std::endl;
-
-
- /* TODO
- if( ret )
- {
- TPixel v = TPixel( this->_Cost( n.Vertex, n.Vertex ) );
-
- typename THistogram::reverse_iterator hIt = this->m_Histogram.rbegin( );
- while( hIt != this->m_Histogram.rend( ) )
- {
- if( v <= hIt->first )
- {
- hIt->second += 1;
- hIt++;
- }
- else
- hIt = this->m_Histogram.rend( );
-
- } // elihw
- this->GetOutput( )->SetPixel( n.Vertex, v );
-
- } // fi
- */
- return( ret );
-}
-
// -------------------------------------------------------------------------
template< class I >
void fpa::Image::RegionGrowWithMultipleThresholds< I >::
-_BeforeLoop( )
+_BeforeMainLoop( )
{
const I* img = this->GetInput( );
this->ClearMembershipFunctions( );
typename TThresholds::const_iterator tIt = this->m_Thresholds.begin( );
- typename TThresholds::const_iterator prev_tIt = tIt;
- for( ++tIt; tIt != this->m_Thresholds.end( ); ++tIt, ++prev_tIt )
+ TPixel min_thr = *tIt;
+ for( ++tIt; tIt != this->m_Thresholds.end( ); ++tIt )
{
typename TFunction::Pointer function = TFunction::New( );
function->SetInputImage( img );
- function->SetLowerThreshold( *prev_tIt );
+ function->SetLowerThreshold( min_thr );
function->SetUpperThreshold( *tIt );
this->AddMembershipFunction( function );
- std::cout << *prev_tIt << " " << *tIt << std::endl;
} // rof
- this->Superclass::_BeforeLoop( );
+ this->Superclass::_BeforeMainLoop( );
}
// -------------------------------------------------------------------------
void fpa::Image::RegionGrowWithMultipleThresholds< I >::
_AfterLoop( )
{
- /*
- typename THistogram::iterator prevIt = this->m_Histogram.begin( );
- typename THistogram::iterator currIt = prevIt; currIt++;
- typename THistogram::iterator nextIt = currIt; nextIt++;
- double prev_d1 = double( 0 );
- for( ; nextIt != this->m_Histogram.end( ); ++prevIt, ++currIt, ++nextIt )
- {
- double d1 = double( nextIt->second ) - double( prevIt->second );
- d1 /= double( nextIt->first ) - double( prevIt->first );
-
- std::cout
- << currIt->first << " "
- << currIt->second << " "
- << d1 << " "
- << ( d1 - prev_d1 ) << std::endl;
-
- prev_d1 = d1;
-
- } // rof
- */
+ if( this->m_ActualFunction != this->m_Functions.end( ) )
+ {
+ TFunction* f =
+ dynamic_cast< TFunction* >( this->m_ActualFunction->GetPointer( ) );
+ // std::cout << f->GetUpperThreshold( ) << " " << this->m_Marks.size( ) << std::endl;
- /*
- double prev = double( 0 );
- while( hIt != this->m_Histogram.end( ) )
- {
- double curr = double( hIt->second );
- double deri = curr - prev;
+ } // fi
+ this->Superclass::_AfterLoop( );
+}
- if( hIt != this->m_Histogram.begin( ) )
- std::cout << hIt->first << " " << curr << " " << deri << std::endl;
+// -------------------------------------------------------------------------
+template< class I >
+void fpa::Image::RegionGrowWithMultipleThresholds< I >::
+_AfterMainLoop( )
+{
+ this->Superclass::_AfterMainLoop( );
+}
- prev = curr;
- hIt++;
+// -------------------------------------------------------------------------
+template< class I >
+bool fpa::Image::RegionGrowWithMultipleThresholds< I >::
+_UpdateResult( _TNode& n )
+{
+ #error ACA VOY -> explicar esto!!!! cambiar salida por una especie de curva de nivel
+ bool ret = this->Superclass::_UpdateResult( n );
+ if( this->m_ActualFunction != this->m_Functions.end( ) )
+ {
+ TFunction* f =
+ dynamic_cast< TFunction* >( this->m_ActualFunction->GetPointer( ) );
+ this->GetOutput( )->SetPixel( n.Vertex, f->GetUpperThreshold( ) );
- } // rof
- */
- this->Superclass::_AfterLoop( );
+ } // fi
+ return( ret );
}
-
#endif // __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__HXX__
// eof - $RCSfile$