]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Filters/Mori.h
...
[FrontAlgorithms.git] / lib / fpa / Filters / Mori.h
diff --git a/lib/fpa/Filters/Mori.h b/lib/fpa/Filters/Mori.h
new file mode 100644 (file)
index 0000000..14e8c53
--- /dev/null
@@ -0,0 +1,110 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Mori__h__
+#define __fpa__Filters__Mori__h__
+
+#include <fpa/Config.h>
+#include <fpa/Common/PeakDetector.h>
+#include <fpa/Filters/QueueAlgorithm.h>
+#include <fpa/Functors/RegionGrow/BinaryThreshold.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TDataInterface >
+    class Mori
+      : public fpa::Filters::QueueAlgorithm< _TDataInterface >
+    {
+    public:
+      typedef _TDataInterface TDataInterface;
+      typedef fpa::Filters::QueueAlgorithm< TDataInterface > Superclass;
+      typedef Mori                                           Self;
+      typedef itk::SmartPointer< Self >                      Pointer;
+      typedef itk::SmartPointer< const Self >                ConstPointer;
+
+      typedef typename TDataInterface::TTraits TTraits;
+      fpaTraitsMacro( typename TTraits );
+
+      typedef std::set< TInputValue >   TThresholds;
+      typedef fpa::Common::PeakDetector TPeakDetector;
+      typedef TPeakDetector::TPeak      TPeak;
+      typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TPredicate;
+
+    public:
+      itkTypeMacro( fpa::Filters::Mori, fpa::Filters::QueueAlgorithm );
+
+      itkGetConstMacro( InsideValue, TOutputValue );
+      itkSetMacro( InsideValue, TOutputValue );
+
+      itkGetConstMacro( MinimumThreshold, TInputValue );
+      itkSetMacro( MinimumThreshold, TInputValue );
+
+    public:
+      TOutputValue GetOutsideValue( ) const;
+      void SetOutsideValue( const TOutputValue& v );
+
+      unsigned long GetSignalKernelSize( ) const;
+      void SetSignalKernelSize( unsigned long k );
+
+      double GetSignalThreshold( ) const;
+      void SetSignalThreshold( double t );
+
+      double GetSignalInfluence( ) const;
+      void SetSignalInfluence( double i );
+
+      void ClearThresholds( );
+      void AddThreshold( const TInputValue& thr );
+      void SetThresholds(
+        const TInputValue& lower,
+        const TInputValue& upper,
+        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( );
+      virtual ~Mori( );
+
+      // Pipeline related methods
+      virtual void _BeforeGenerateData( ) override;
+
+      // Algoritm related methods
+      virtual void _PostComputeOutputValue( TNode& n ) override;
+      virtual void _PreComputeOutputValue( TNode& n ) override;
+      virtual void _Reinitialize( ) override;
+
+    private:
+      Mori( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      typename TPredicate::Pointer m_Predicate;
+
+      TOutputValue m_InsideValue;
+      TInputValue m_MinimumThreshold;
+      TThresholds m_Thresholds;
+      typename TThresholds::const_iterator m_CurrThr;
+      double m_CurrCount;
+
+      TPeakDetector m_PeakDetector;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/Mori.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Filters__Mori__h__
+// eof - $RCSfile$