]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/MoriFilter.h
a78aab7f47925fe499890792a881d77e8168fa10
[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       typedef typename THelper::TCurve          TCurve;
32
33     public:
34       itkNewMacro( Self );
35       itkTypeMacro( fpa::Image::MoriFilter, itk::ImageToImageFilter );
36
37       itkGetConstMacro( Seed, TIndex );
38       itkSetMacro( Seed, TIndex );
39
40     public:
41       TAuxImage* GetAuxiliaryImage( );
42       const TAuxImage* GetAuxiliaryImage( ) const;
43
44       TInputPixel GetLower( ) const;
45       TInputPixel GetUpper( ) const;
46       TInputPixel GetStep( ) const;
47       TOutputPixel GetInsideValue( ) const;
48       TOutputPixel GetOutsideValue( ) const;
49       TOutputPixel GetOptimumThreshold( ) const;
50       TCurve GetCurve( ) const;
51
52       void SetLower( const TInputPixel& v );
53       void SetUpper( const TInputPixel& v );
54       void SetStep( const TInputPixel& v );
55       void SetThresholdRange(
56         const TInputPixel& l, const TInputPixel& u,
57         const TInputPixel& s = TInputPixel( 1 )
58         );
59       void SetInsideValue( const TOutputPixel& v );
60       void SetOutsideValue( const TOutputPixel& v );
61
62     protected:
63       MoriFilter( );
64       virtual ~MoriFilter( );
65
66       virtual void GenerateData( ) override;
67
68     private:
69       // Purposely not defined
70       MoriFilter( const Self& other );
71       Self& operator=( const Self& other );
72
73     protected:
74       typename THelper::Pointer m_Helper;
75       typename TThreshold::Pointer m_Threshold;
76       TIndex m_Seed;
77     };
78
79   } // ecapseman
80
81 } // ecapseman
82
83 #ifndef ITK_MANUAL_INSTANTIATION
84 #  include <fpa/Image/MoriFilter.hxx>
85 #endif // ITK_MANUAL_INSTANTIATION
86
87 #endif // __fpa__Image__MoriFilter__h__
88
89 // eof - $RCSfile$