]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/Mori.h
...
[FrontAlgorithms.git] / lib / fpa / Base / Mori.h
index d1774d708dcc3da8aca409fd4018666d691b6fbf..27f6915a671a8893805afc193973e9eb491278fc 100644 (file)
@@ -3,19 +3,15 @@
 // @email florez-l@javeriana.edu.co
 // =========================================================================
 
-// https://stackoverflow.com/questions/22583391/peak-signal-detection-in-realtime-timeseries-data
-
-
 #ifndef __fpa__Base__Mori__h__
 #define __fpa__Base__Mori__h__
 
 #include <deque>
 #include <set>
-#include <vector>
 #include <itkConceptChecking.h>
 #include <itkFunctionBase.h>
 
-#include <fpa/Generic/PeakDetector.h>
+#include <ivq/ITK/PeakDetector.h>
 #include <fpa/Base/Functors/RegionGrow/BinaryThreshold.h>
 
 namespace fpa
@@ -43,10 +39,10 @@ namespace fpa
 
       typedef std::deque< TNode >     TQueue;
       typedef std::set< TInputValue > TThresholds;
-      typedef std::pair< TInputValue, unsigned long > TSignalData;
-      typedef std::vector< TSignalData >              TSignal;
 
-      typedef fpa::Generic::PeakDetector TPeakDetector;
+      typedef ivq::ITK::PeakDetector TPeakDetector;
+      typedef TPeakDetector::TPeak   TPeak;
+
       typedef fpa::Base::Functors::RegionGrow::BinaryThreshold< TInputValue > TPredicate;
 
     public:
@@ -56,19 +52,10 @@ namespace fpa
         );
 
       itkGetConstMacro( InsideValue, TOutputValue );
-      itkGetConstMacro( MinimumThreshold, TInputValue );
-
       itkSetMacro( InsideValue, TOutputValue );
-      itkSetMacro( MinimumThreshold, TInputValue );
-
-      itkGetConstReferenceMacro( Signal, TSignal );
-      itkGetConstMacro( SignalLag, unsigned long );
-      itkGetConstMacro( SignalThreshold, double );
-      itkGetConstMacro( SignalInfluence, double );
 
-      itkSetMacro( SignalLag, unsigned long );
-      itkSetMacro( SignalThreshold, double );
-      itkSetMacro( SignalInfluence, double );
+      itkGetConstMacro( MinimumThreshold, TInputValue );
+      itkSetMacro( MinimumThreshold, TInputValue );
 
     public:
       virtual itk::ModifiedTimeType GetMTime( ) const override;
@@ -76,6 +63,14 @@ namespace fpa
       TOutputValue GetOutsideValue( ) const;
       void SetOutsideValue( const TOutputValue& v );
 
+      unsigned long GetSignalKernelSize( ) const;
+      double GetSignalThreshold( ) const;
+      double GetSignalInfluence( ) const;
+
+      void SetSignalKernelSize( unsigned long k );
+      void SetSignalThreshold( double t );
+      void SetSignalInfluence( double i );
+
       void ClearThresholds( );
       void AddThreshold( const TInputValue& thr );
       void SetThresholds(
@@ -83,8 +78,12 @@ namespace fpa
         const TInputValue& end,
         const TInputValue& delta
         );
+      const TThresholds& GetThresholds( ) const;
       unsigned long GetNumberOfEvaluatedThresholds( ) const;
       TInputValue GetOptimumThreshold( ) const;
+      void GetSignalValues(
+        unsigned long i, double& x, double& y, TPeak& p
+        ) const;
 
     protected:
       Mori( );
@@ -107,27 +106,17 @@ namespace fpa
 
     protected:
       typename TPredicate::Pointer m_Predicate;
-      TThresholds m_Thresholds;
-      typename TThresholds::const_iterator m_CurrentThreshold;
-      TQueue m_Queues[ 2 ];
-      unsigned int m_CurrentQueue;
-      unsigned long m_Count;
 
-      TPeakDetector m_PeakDetector;
+      TOutputValue m_InsideValue;
+      TInputValue  m_MinimumThreshold;
+      TThresholds  m_Thresholds;
+      typename TThresholds::const_iterator m_CurrThr;
 
-      TSignal m_Signal;
-      unsigned long m_SignalLag;
-      double m_SignalThreshold;
-      double m_SignalInfluence;
-      std::vector< double > m_FilteredSignal;
-      std::vector< double > m_SignalAverages;
-      std::vector< double > m_SignalDeviations;
-      std::vector< short >  m_SignalPeaks;
-      double m_CurrentAverage;
-      double m_CurrentVariance;
+      TQueue       m_Queues[ 2 ];
+      unsigned int m_CurrQueue;
+      double       m_CurrCount;
 
-      TInputValue  m_MinimumThreshold;
-      TOutputValue m_InsideValue;
+      TPeakDetector m_PeakDetector;
     };
 
   } // ecapseman