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