#ifndef __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__HXX__
#define __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__HXX__
+#include <limits>
#include <fpa/Image/Functors/RegionGrowThresholdFunction.h>
// -------------------------------------------------------------------------
void fpa::Image::RegionGrowWithMultipleThresholds< I >::
AddThreshold( const TPixel& v )
{
- this->m_Histogram[ v ] = 0;
+ typedef
+ fpa::Image::Functors::RegionGrowThresholdFunction< I >
+ TFunction;
+ typename TFunction::Pointer function = TFunction::New( );
+
+ if( this->GetNumberOfMembershipFunctions( ) > 0 )
+ {
+ }
+ else
+ function->SetLowerThreshold( std::numeric_limits< TPixel >::min( ) );
+ std::cout
+ << typeid( TPixel ).name( ) << " "
+ << function->GetLowerThreshold( )
+ << std::endl;
+ function->SetUpperThreshold( v );
+ this->AddMembershipFunction( function );
/* TODO
- typedef
- fpa::Image::Functors::RegionGrowThresholdFunction< I >
- TFunction;
+ this->m_Histogram[ v ] = 0;
+
TFunction* function =
dynamic_cast< TFunction* >( this->GetMembershipFunction( ) );
if( function != NULL )
{
function->SetLowerThreshold( this->m_Histogram.begin( )->first );
- function->SetUpperThreshold( this->m_Histogram.rbegin( )->first );
} // fi
+ this->Modified( );
*/
- this->Modified( );
}
// -------------------------------------------------------------------------
: Superclass( ),
m_DerivativeThreshold( double( 3 ) )
{
- typedef
- fpa::Image::Functors::RegionGrowThresholdFunction< I >
- TFunction;
- typename TFunction::Pointer function = TFunction::New( );
- this->SetMembershipFunction( function );
+ /* TODO
+ typedef
+ fpa::Image::Functors::RegionGrowThresholdFunction< I >
+ TFunction;
+ typename TFunction::Pointer function = TFunction::New( );
+ this->SetMembershipFunction( function );
+ */
}
// -------------------------------------------------------------------------
{
bool ret = this->Superclass::_UpdateResult( n );
- if( ret )
- {
- TPixel v = TPixel( this->_Cost( n.Vertex, n.Vertex ) );
+ /* 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
+ 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( )
+{
+ std::cout << "**1" << std::endl;
+ const I* img = this->GetInput( );
+ std::cout << "**2" << std::endl;
+ typename TFunctions::iterator fIt = this->m_Functions.begin( );
+ for( ; fIt != this->m_Functions.end( ); ++fIt )
+ {
+ TMembershipFunction* f =
+ dynamic_cast< TMembershipFunction* >( fIt->GetPointer( ) );
+ if( f != NULL )
+ f->SetInputImage( this->GetInput( ) );
+
+ } // rof
+ this->Superclass::_BeforeLoop( );
+}
+
// -------------------------------------------------------------------------
template< class I >
void fpa::Image::RegionGrowWithMultipleThresholds< I >::