]> 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 <set>
12
13 namespace fpa
14 {
15   namespace Image
16   {
17     /**
18      */
19     template< class _TInputImage, class _TOutputImage >
20     class RegionGrow
21       : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
22     {
23     public:
24       typedef _TInputImage  TInputImage;
25       typedef _TOutputImage TOutputImage;
26
27       typedef RegionGrow                                                 Self;
28       typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass;
29       typedef itk::SmartPointer< Self >                               Pointer;
30       typedef itk::SmartPointer< const Self >                    ConstPointer;
31
32       typedef typename TInputImage::IndexType  TIndex;
33       typedef typename TInputImage::RegionType TRegion;
34       typedef typename TInputImage::PixelType  TInputPixel;
35       typedef typename TOutputImage::PixelType TOutputPixel;
36
37       typedef itk::FunctionBase< TInputPixel, bool > TIntensityFunctor;
38
39       typedef std::set< TIndex, typename TIndex::LexicographicCompare > TSeeds;
40
41     public:
42       itkNewMacro( Self );
43       itkTypeMacro( fpa::Image::RegionGrow, itk::ImageToImageFilter );
44
45       itkGetConstMacro( InsideValue, TOutputPixel );
46       itkGetConstMacro( OutsideValue, TOutputPixel );
47
48       itkSetMacro( InsideValue, TOutputPixel );
49       itkSetMacro( OutsideValue, TOutputPixel );
50
51     public:
52       void SetPredicate( TIntensityFunctor* functor );
53
54       void AddSeed( const TIndex& seed );
55
56     protected:
57       RegionGrow( );
58       virtual ~RegionGrow( );
59
60       virtual void GenerateInputRequestedRegion( ) override;
61       virtual void EnlargeOutputRequestedRegion(
62         itk::DataObject* output
63         ) override;
64       virtual void GenerateData( ) override;
65
66     private:
67       // Purposely not implemented
68       RegionGrow( const Self& other );
69       Self& operator=( const Self& other );
70
71     protected:
72       typename TIntensityFunctor::Pointer m_IntensityFunctor;
73       TSeeds m_Seeds;
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$