]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Common/PeakDetector.cxx
...
[FrontAlgorithms.git] / lib / fpa / Common / PeakDetector.cxx
diff --git a/lib/fpa/Common/PeakDetector.cxx b/lib/fpa/Common/PeakDetector.cxx
deleted file mode 100644 (file)
index 0a53e1e..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-#include <fpa/Common/PeakDetector.h>
-#include <cmath>
-
-// -------------------------------------------------------------------------
-fpa::Common::PeakDetector::
-PeakDetector( )
-  : m_K( 3 ),
-    m_T( 3.5 ),
-    m_I( 0.5 )
-{
-}
-
-// -------------------------------------------------------------------------
-fpa::Common::PeakDetector::
-~PeakDetector( )
-{
-}
-
-// -------------------------------------------------------------------------
-unsigned long fpa::Common::PeakDetector::
-GetKernelSize( ) const
-{
-  return( this->m_K );
-}
-
-// -------------------------------------------------------------------------
-double fpa::Common::PeakDetector::
-GetThreshold( ) const
-{
-  return( this->m_T );
-}
-
-// -------------------------------------------------------------------------
-double fpa::Common::PeakDetector::
-GetInfluence( ) const
-{
-  return( this->m_I );
-}
-
-// -------------------------------------------------------------------------
-void fpa::Common::PeakDetector::
-SetKernelSize( unsigned long k )
-{
-  this->m_K = k;
-  this->Clear( );
-}
-
-// -------------------------------------------------------------------------
-void fpa::Common::PeakDetector::
-SetThreshold( double t )
-{
-  this->m_T = t;
-  this->Clear( );
-}
-
-// -------------------------------------------------------------------------
-void fpa::Common::PeakDetector::
-SetInfluence( double i )
-{
-  this->m_I = i;
-  this->Clear( );
-}
-
-// -------------------------------------------------------------------------
-void fpa::Common::PeakDetector::
-Clear( )
-{
-  this->m_X.clear( );
-  this->m_Y.clear( );
-  this->m_YF.clear( );
-  this->m_Avg.clear( );
-  this->m_STD.clear( );
-  this->m_Peaks.clear( );
-  this->m_MeanAndVar.Clear( );
-}
-
-// -------------------------------------------------------------------------
-const std::vector< double >& fpa::Common::PeakDetector::
-GetXValues( ) const
-{
-  return( this->m_X );
-}
-
-// -------------------------------------------------------------------------
-const std::vector< double >& fpa::Common::PeakDetector::
-GetYValues( ) const
-{
-  return( this->m_Y );
-}
-
-// -------------------------------------------------------------------------
-const std::vector< double >& fpa::Common::PeakDetector::
-GetFilteredYValues( ) const
-{
-  return( this->m_YF );
-}
-
-// -------------------------------------------------------------------------
-const std::vector< double >& fpa::Common::PeakDetector::
-GetAverages( ) const
-{
-  return( this->m_Avg );
-}
-
-// -------------------------------------------------------------------------
-const std::vector< double >& fpa::Common::PeakDetector::
-GetDeviations( ) const
-{
-  return( this->m_STD );
-}
-
-// -------------------------------------------------------------------------
-const std::vector< fpa::Common::PeakDetector::TPeak >& fpa::Common::
-PeakDetector::GetPeaks( ) const
-{
-  return( this->m_Peaks );
-}
-
-// -------------------------------------------------------------------------
-unsigned long fpa::Common::PeakDetector::
-GetNumberOfSamples( ) const
-{
-  return( this->m_X.size( ) );
-}
-
-// -------------------------------------------------------------------------
-fpa::Common::PeakDetector::
-TPeak fpa::Common::PeakDetector::
-AddValue( double x, double y )
-{
-  this->m_X.push_back( x );
-  this->m_Y.push_back( y );
-
-  if( this->m_YF.size( ) < this->m_K )
-  {
-    this->m_YF.push_back( y );
-    this->m_Avg.push_back( double( 0 ) );
-    this->m_STD.push_back( double( 0 ) );
-    this->m_Peaks.push_back( Self::NoPeak );
-
-    this->m_MeanAndVar.AddValue( y );
-    if( this->m_YF.size( ) == this->m_K )
-    {
-      this->m_Avg.push_back( this->m_MeanAndVar.GetMean( ) );
-      this->m_STD.push_back( this->m_MeanAndVar.GetDeviation( ) );
-
-    } // fi
-  }
-  else
-  {
-    unsigned long i = this->m_X.size( ) - 1;
-    if(
-      ( std::fabs( y - this->m_Avg[ i - 1 ] ) ) >
-      ( this->m_T * this->m_STD[ i - 1 ] )
-      )
-    {
-      this->m_Peaks.push_back(
-        ( y > this->m_Avg[ i - 1 ] )? Self::PosPeak: Self::NegPeak
-        );
-      this->m_YF.push_back(
-        ( this->m_I * y ) +
-        ( ( double( 1 ) - this->m_I ) * this->m_YF[ i - 1 ] )
-        );
-    }
-    else
-    {
-      this->m_Peaks.push_back( Self::NoPeak );
-      this->m_YF.push_back( y );
-
-    } // fi
-
-    this->m_MeanAndVar.Clear( );
-    unsigned long k = 0;
-    for( unsigned long j = i - this->m_K; j <= i; ++j, ++k )
-      this->m_MeanAndVar.AddValue( this->m_YF[ j ] );
-    this->m_Avg.push_back( this->m_MeanAndVar.GetMean( ) );
-    this->m_STD.push_back( this->m_MeanAndVar.GetDeviation( ) );
-
-  } // fi
-  return( this->m_Peaks.back( ) );
-}
-
-// eof - $RCSfile$