]> Creatis software - cpPlugins.git/blob - lib/ivq/ITK/ThresholdFunction.h
690043cbd2a53e2d9d79d7db56de8fdd959afbf3
[cpPlugins.git] / lib / ivq / ITK / ThresholdFunction.h
1 /* =======================================================================
2  * @author: Leonardo Florez-Valencia
3  * @email: florez-l@javeriana.edu.co
4  * =======================================================================
5  */
6
7 #ifndef __ivq__ITK__ThresholdFunction__h__
8 #define __ivq__ITK__ThresholdFunction__h__
9
10 #include <set>
11
12 #include <itkFunctionBase.h>
13
14 namespace ivq
15 {
16   namespace ITK
17   {
18     /**
19      */
20     template< class _TIn, class _TOut >
21     class ThresholdFunction
22       : public itk::FunctionBase< _TIn, _TOut >
23     {
24     public:
25       typedef ThresholdFunction                Self;
26       typedef itk::FunctionBase< _TIn, _TOut > Superclass;
27       typedef itk::SmartPointer< Self >        Pointer;
28       typedef itk::SmartPointer< const Self >  ConstPointer;
29
30       typedef typename Superclass::InputType  TInput;
31       typedef typename Superclass::OutputType TOutput;
32
33     public:
34       itkNewMacro( Self );
35       itkTypeMacro( ivq::ITK::ThresholdFunction, itk::FunctionBase );
36
37       itkBooleanMacro( Strict );
38       itkBooleanMacro( Binary );
39
40       itkGetConstMacro( LowerThreshold, _TIn );
41       itkGetConstMacro( UpperThreshold, _TIn );
42       itkGetConstMacro( Strict, bool );
43       itkGetConstMacro( Binary, bool );
44       itkGetConstMacro( InsideValue, _TOut );
45       itkGetConstMacro( OutsideValue, _TOut );
46
47       itkSetMacro( LowerThreshold, _TIn );
48       itkSetMacro( UpperThreshold, _TIn );
49       itkSetMacro( Strict, bool );
50       itkSetMacro( Binary, bool );
51       itkSetMacro( InsideValue, _TOut );
52       itkSetMacro( OutsideValue, _TOut );
53
54     public:
55       void SetBetween( const _TIn& lower, const _TIn& upper );
56       void SetBelow( const _TIn& value );
57       void SetAbove( const _TIn& value );
58
59       virtual _TOut Evaluate( const _TIn& in ) const override;
60
61     protected:
62       ThresholdFunction( );
63       virtual ~ThresholdFunction( );
64
65     private:
66       // Purposely not implemented
67       ThresholdFunction( const Self& other );
68       Self& operator=( const Self& other );
69
70     protected:
71       _TIn  m_LowerThreshold;
72       _TIn  m_UpperThreshold;
73       bool  m_Strict;
74       bool  m_Binary;
75       _TOut m_InsideValue;
76       _TOut m_OutsideValue;
77     };
78
79   } // ecapseman
80
81 } // ecapseman
82
83 #ifndef ITK_MANUAL_INSTANTIATION
84 #  include <ivq/ITK/ThresholdFunction.hxx>
85 #endif // ITK_MANUAL_INSTANTIATION
86
87 #endif // __ivq__ITK__ThresholdFunction__h__
88
89 // eof - $RCSfile$