]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Filters/Mori.h
...
[FrontAlgorithms.git] / lib / fpa / Filters / Mori.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Filters__Mori__h__
6 #define __fpa__Filters__Mori__h__
7
8 #include <fpa/Config.h>
9 #include <fpa/Common/PeakDetector.h>
10 #include <fpa/Filters/QueueAlgorithm.h>
11 #include <fpa/Functors/RegionGrow/BinaryThreshold.h>
12
13 namespace fpa
14 {
15   namespace Filters
16   {
17     /**
18      */
19     template< class _TDataInterface >
20     class Mori
21       : public fpa::Filters::QueueAlgorithm< _TDataInterface >
22     {
23     public:
24       typedef _TDataInterface TDataInterface;
25       typedef fpa::Filters::QueueAlgorithm< TDataInterface > Superclass;
26       typedef Mori                                           Self;
27       typedef itk::SmartPointer< Self >                      Pointer;
28       typedef itk::SmartPointer< const Self >                ConstPointer;
29
30       typedef typename TDataInterface::TTraits TTraits;
31       fpaTraitsMacro( typename TTraits );
32
33       typedef std::set< TInputValue >   TThresholds;
34       typedef fpa::Common::PeakDetector TPeakDetector;
35       typedef TPeakDetector::TPeak      TPeak;
36       typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TPredicate;
37
38     public:
39       itkTypeMacro( fpa::Filters::Mori, fpa::Filters::QueueAlgorithm );
40
41       itkGetConstMacro( InsideValue, TOutputValue );
42       itkSetMacro( InsideValue, TOutputValue );
43
44       itkGetConstMacro( MinimumThreshold, TInputValue );
45       itkSetMacro( MinimumThreshold, TInputValue );
46
47     public:
48       TOutputValue GetOutsideValue( ) const;
49       void SetOutsideValue( const TOutputValue& v );
50
51       unsigned long GetSignalKernelSize( ) const;
52       void SetSignalKernelSize( unsigned long k );
53
54       double GetSignalThreshold( ) const;
55       void SetSignalThreshold( double t );
56
57       double GetSignalInfluence( ) const;
58       void SetSignalInfluence( double i );
59
60       void ClearThresholds( );
61       void AddThreshold( const TInputValue& thr );
62       void SetThresholds(
63         const TInputValue& lower,
64         const TInputValue& upper,
65         const TInputValue& delta
66         );
67       const TThresholds& GetThresholds( ) const;
68       unsigned long GetNumberOfEvaluatedThresholds( ) const;
69       TInputValue GetOptimumThreshold( ) const;
70       void GetSignalValues(
71         unsigned long i, double& x, double& y, TPeak& p
72         ) const;
73
74     protected:
75       Mori( );
76       virtual ~Mori( );
77
78       // Pipeline related methods
79       virtual void _BeforeGenerateData( ) override;
80
81       // Algoritm related methods
82       virtual void _PostComputeOutputValue( TNode& n ) override;
83       virtual void _PreComputeOutputValue( TNode& n ) override;
84       virtual void _Reinitialize( ) override;
85
86     private:
87       Mori( const Self& other );
88       Self& operator=( const Self& other );
89
90     protected:
91       typename TPredicate::Pointer m_Predicate;
92
93       TOutputValue m_InsideValue;
94       TInputValue m_MinimumThreshold;
95       TThresholds m_Thresholds;
96       typename TThresholds::const_iterator m_CurrThr;
97       double m_CurrCount;
98
99       TPeakDetector m_PeakDetector;
100     };
101
102   } // ecapseman
103
104 } // ecapseman
105
106 #ifndef ITK_MANUAL_INSTANTIATION
107 #  include <fpa/Filters/Mori.hxx>
108 #endif // ITK_MANUAL_INSTANTIATION
109 #endif // __fpa__Filters__Mori__h__
110 // eof - $RCSfile$