]> Creatis software - FrontAlgorithms.git/commitdiff
Filter updated
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 30 Jan 2015 21:10:05 +0000 (16:10 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Fri, 30 Jan 2015 21:10:05 +0000 (16:10 -0500)
lib/fpa/Image/RegionGrowWithMultipleThresholds.h
lib/fpa/Image/RegionGrowWithMultipleThresholds.hxx

index 11066fe6027eab286e91848eaa7476cb5aa4deb6..3efd87a7313547b97e2413205e73fd47ee42a213 100644 (file)
@@ -39,8 +39,9 @@ namespace fpa
     public:
       void AddThreshold( const TPixel& v );
       void AddThresholds(
-        const TPixel& t0, const TPixel& t1,
-        const unsigned int& samples
+        const TPixel& t0,
+        const TPixel& t1,
+        const unsigned int& s
         );
 
     protected:
index b4d433109c1e9f73277b1bab4bf83731eebca9a9..def89d95dc4dfac6c1d6de976b04b48ce31d81e6 100644 (file)
@@ -10,33 +10,30 @@ AddThreshold( const TPixel& v )
 {
   this->m_Histogram[ v ] = 0;
 
-  typedef
-    fpa::Image::Functors::RegionGrowThresholdFunction< I >
-    TFunction;
-  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
+  /* TODO
+     typedef
+     fpa::Image::Functors::RegionGrowThresholdFunction< I >
+     TFunction;
+     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( );
 }
 
 // -------------------------------------------------------------------------
 template< class I >
 void fpa::Image::RegionGrowWithMultipleThresholds< I >::
-AddThresholds(
-  const TPixel& t0,
-  const TPixel& t1,
-  const unsigned int& samples
-  )
+AddThresholds( const TPixel& t0, const TPixel& t1, const unsigned int& s )
 {
-  double off =
-    ( double( t1 ) - double( t0 ) ) / ( double( samples ) - double( 1 ) );
-  for( unsigned int s = 0; s < samples; s++ )
-    this->AddThreshold( TPixel( ( double( s ) * off ) + double( t0 ) ) );
+  double o = ( double( t1 ) - double( t0 ) ) / ( double( s ) - double( 1 ) );
+  for( unsigned int i = 0; i < s; i++ )
+    this->AddThreshold( TPixel( ( double( i ) * o ) + double( t0 ) ) );
 }
 
 // -------------------------------------------------------------------------
@@ -94,25 +91,26 @@ template< class I >
 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 )
-  {
+  /*
+    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;
+    << currIt->first  << " "
+    << currIt->second << " "
+    << d1 << " "
+    << ( d1 - prev_d1 ) << std::endl;
 
     prev_d1 = d1;
 
-  } // rof
-
+    } // rof
+  */
 
   /*
     double prev = double( 0 );