]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/MoriFilter.h
0707ff5c2bfb2934fc145deb9d793c744f5ed86f
[FrontAlgorithms.git] / libs / fpa / Image / MoriFilter.h
1 #ifndef __fpa__Image__MoriFilter__h__
2 #define __fpa__Image__MoriFilter__h__
3
4 #include <itkImageToImageFilter.h>
5 #include <itkBinaryThresholdImageFilter.h>
6 #include <fpa/Image/MoriFilterHelper.h>
7
8 namespace fpa
9 {
10   namespace Image
11   {
12     /**
13      */
14     template< class _TInputImage, class _TOutputImage, class _TAuxPixel = unsigned short >
15     class MoriFilter
16       : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
17     {
18     public:
19       typedef MoriFilter                                         Self;
20       typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > Superclass;
21       typedef itk::SmartPointer< Self >                              Pointer;
22       typedef itk::SmartPointer< const Self >                        ConstPointer;
23
24       typedef itk::Image< _TAuxPixel, _TInputImage::ImageDimension >      TAuxImage;
25       typedef fpa::Image::MoriFilterHelper< _TInputImage, TAuxImage > THelper;
26       typedef itk::BinaryThresholdImageFilter< TAuxImage, _TOutputImage > TThreshold;
27
28       typedef typename _TInputImage::IndexType  TIndex;
29       typedef typename _TInputImage::PixelType  TInputPixel;
30       typedef typename _TOutputImage::PixelType TOutputPixel;
31
32     public:
33       itkNewMacro( Self );
34       itkTypeMacro( fpa::Image::MoriFilter, itk::ImageToImageFilter );
35
36       itkGetConstMacro( Seed, TIndex );
37       itkSetMacro( Seed, TIndex );
38
39     public:
40       TAuxImage* GetAuxiliaryImage( );
41       const TAuxImage* GetAuxiliaryImage( ) const;
42
43       TInputPixel GetLower( ) const;
44       TInputPixel GetUpper( ) const;
45       TInputPixel GetStep( ) const;
46       TOutputPixel GetInsideValue( ) const;
47       TOutputPixel GetOutsideValue( ) const;
48
49       void SetLower( const TInputPixel& v );
50       void SetUpper( const TInputPixel& v );
51       void SetStep( const TInputPixel& v );
52       void SetThresholdRange(
53         const TInputPixel& l, const TInputPixel& u,
54         const TInputPixel& s = TInputPixel( 1 )
55         );
56       void SetInsideValue( const TOutputPixel& v );
57       void SetOutsideValue( const TOutputPixel& v );
58
59
60       /* TODO
61          itkGetConstMacro( Lower, TPixel );
62          itkGetConstMacro( Upper, TPixel );
63          itkGetConstMacro( Step, TPixel );
64          itkGetConstMacro( Sensitivity, double );
65          itkSetMacro( Lower, TPixel );
66          itkSetMacro( Upper, TPixel );
67          itkSetMacro( Step, TPixel );
68          itkSetMacro( Sensitivity, double );
69       */
70
71     protected:
72       MoriFilter( );
73       virtual ~MoriFilter( );
74
75       virtual void GenerateData( ) override;
76
77     private:
78       // Purposely not defined
79       MoriFilter( const Self& other );
80       Self& operator=( const Self& other );
81
82     protected:
83       typename THelper::Pointer m_Helper;
84       typename TThreshold::Pointer m_Threshold;
85       TIndex m_Seed;
86     };
87
88   } // ecapseman
89
90 } // ecapseman
91
92 #ifndef ITK_MANUAL_INSTANTIATION
93 #  include <fpa/Image/MoriFilter.hxx>
94 #endif // ITK_MANUAL_INSTANTIATION
95
96 #endif // __fpa__Image__MoriFilter__h__
97
98 // eof - $RCSfile$