]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/MoriFilterHelper.h
...
[FrontAlgorithms.git] / libs / fpa / Image / MoriFilterHelper.h
1 #ifndef __fpa__Image__MoriFilterHelper__h__
2 #define __fpa__Image__MoriFilterHelper__h__
3
4 #include <utility>
5 #include <vector>
6 #include <fpa/Image/RegionGrow.h>
7 #include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
8
9 namespace fpa
10 {
11   namespace Image
12   {
13     /**
14      */
15     template< class _TInputImage, class _TOutputImage >
16     class MoriFilterHelper
17       : public fpa::Image::RegionGrow< _TInputImage, _TOutputImage >
18     {
19     public:
20       typedef MoriFilterHelper                                        Self;
21       typedef fpa::Image::RegionGrow< _TInputImage, _TOutputImage > Superclass;
22       typedef itk::SmartPointer< Self >                             Pointer;
23       typedef itk::SmartPointer< const Self >                       ConstPointer;
24
25       typedef typename Superclass::TOutput       TOutput;
26       typedef typename Superclass::TVertex       TVertex;
27       typedef typename Superclass::TGrowFunction TGrowFunction;
28       typedef typename _TInputImage::PixelType   TPixel;
29       typedef fpa::Image::Functors::RegionGrow::BinaryThreshold< _TInputImage, TOutput > TBinThresholdFunction;
30
31     protected:
32       typedef typename Superclass::_TQueueNode _TQueueNode;
33       typedef typename Superclass::_TQueue     _TQueue;
34
35       typedef std::pair< TPixel, unsigned long > TCurveData;
36       typedef std::vector< TCurveData >          TCurve;
37
38     public:
39       itkNewMacro( Self );
40       itkTypeMacro( fpa::Image::MoriFilterHelper, fpa::Image::RegionGrow );
41
42       itkGetConstMacro( Lower, TPixel );
43       itkGetConstMacro( Upper, TPixel );
44       itkGetConstMacro( Step, TPixel );
45       itkGetConstMacro( OptimumThreshold, typename _TOutputImage::PixelType );
46
47       itkSetMacro( Lower, TPixel );
48       itkSetMacro( Upper, TPixel );
49       itkSetMacro( Step, TPixel );
50
51
52     protected:
53       MoriFilterHelper( );
54       virtual ~MoriFilterHelper( );
55
56       virtual bool _ContinueGenerateData( ) override;
57       virtual void _BeforeGenerateData( ) override;
58       virtual void _AfterGenerateData( ) override;
59       virtual void _BeforeLoop( ) override;
60       virtual void _AfterLoop( ) override;
61       virtual bool _UpdateValue( _TQueueNode& v, const _TQueueNode& p ) override;
62       virtual void _UpdateResult( const _TQueueNode& n ) override;
63
64     private:
65       // Purposely not defined
66       MoriFilterHelper( const Self& other );
67       Self& operator=( const Self& other );
68
69     protected:
70       TPixel m_Lower;
71       TPixel m_Upper;
72       TPixel m_Step;
73       typename _TOutputImage::PixelType m_OptimumThreshold;
74
75       _TQueue m_NextQueue;
76       unsigned long m_ActualCount;
77       TCurve m_Curve;
78     };
79
80   } // ecapseman
81
82 } // ecapseman
83
84 #ifndef ITK_MANUAL_INSTANTIATION
85 #  include <fpa/Image/MoriFilterHelper.hxx>
86 #endif // ITK_MANUAL_INSTANTIATION
87
88 #endif // __fpa__Image__MoriFilterHelper__h__
89
90 // eof - $RCSfile$