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