]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/RegionGrow.h
...
[FrontAlgorithms.git] / libs / fpa / Image / RegionGrow.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5
6 #ifndef __fpa__Image__RegionGrow__h__
7 #define __fpa__Image__RegionGrow__h__
8
9 #include <itkImageToImageFilter.h>
10 #include <itkFunctionBase.h>
11 #include <fpa/Base/SeedsInterface.h>
12 #include <fpa/Image/MarksInterface.h>
13
14 namespace fpa
15 {
16   namespace Image
17   {
18     /**
19      */
20     template< class _TInputImage, class _TOutputImage >
21     class RegionGrow
22       : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >,
23         public fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare >,
24         public fpa::Image::MarksInterface< _TInputImage::ImageDimension >
25     {
26     public:
27       typedef _TInputImage  TInputImage;
28       typedef _TOutputImage TOutputImage;
29       typedef typename TInputImage::IndexType  TIndex;
30       typedef typename TInputImage::RegionType TRegion;
31       typedef typename TInputImage::PixelType  TInputPixel;
32       typedef typename TOutputImage::PixelType TOutputPixel;
33       typedef typename TIndex::LexicographicCompare TIndexCompare;
34
35       typedef RegionGrow                                                 Self;
36       typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass;
37       typedef itk::SmartPointer< Self >                               Pointer;
38       typedef itk::SmartPointer< const Self >                    ConstPointer;
39
40       typedef fpa::Base::SeedsInterface< TIndex, TIndexCompare > TSeedsInterface;
41       typedef fpa::Image::MarksInterface< _TInputImage::ImageDimension > TMarksInterface;
42       typedef itk::FunctionBase< TInputPixel, bool > TIntensityFunctor;
43
44     public:
45       itkNewMacro( Self );
46       itkTypeMacro( fpa::Image::RegionGrow, itk::ImageToImageFilter );
47
48       itkGetConstMacro( InsideValue, TOutputPixel );
49       itkGetConstMacro( OutsideValue, TOutputPixel );
50
51       itkSetMacro( InsideValue, TOutputPixel );
52       itkSetMacro( OutsideValue, TOutputPixel );
53
54     public:
55       void SetPredicate( TIntensityFunctor* functor );
56
57     protected:
58       RegionGrow( );
59       virtual ~RegionGrow( );
60
61       virtual void GenerateInputRequestedRegion( ) override;
62       virtual void EnlargeOutputRequestedRegion(
63         itk::DataObject* output
64         ) override;
65       virtual void GenerateData( ) override;
66
67     private:
68       // Purposely not implemented
69       RegionGrow( const Self& other );
70       Self& operator=( const Self& other );
71
72     protected:
73       typename TIntensityFunctor::Pointer m_IntensityFunctor;
74       TOutputPixel m_InsideValue;
75       TOutputPixel m_OutsideValue;
76     };
77
78   } // ecapseman
79
80 } // ecapseman
81
82 #ifndef ITK_MANUAL_INSTANTIATION
83 #  include <fpa/Image/RegionGrow.hxx>
84 #endif // ITK_MANUAL_INSTANTIATION
85
86 #endif // __fpa__Image__RegionGrow__h__
87
88 // eof - $RCSfile$