]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Image/RegionGrow.h
e21bbb91ce6e0015abe84fb5e57a453725455f81
[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
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         public fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare >
23     {
24     public:
25       typedef _TInputImage  TInputImage;
26       typedef _TOutputImage TOutputImage;
27       typedef typename TInputImage::IndexType  TIndex;
28       typedef typename TInputImage::RegionType TRegion;
29       typedef typename TInputImage::PixelType  TInputPixel;
30       typedef typename TOutputImage::PixelType TOutputPixel;
31       typedef typename TIndex::LexicographicCompare TIndexCompare;
32
33       typedef RegionGrow                                                 Self;
34       typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass;
35       typedef itk::SmartPointer< Self >                               Pointer;
36       typedef itk::SmartPointer< const Self >                    ConstPointer;
37
38       typedef fpa::Base::SeedsInterface< TIndex, TIndexCompare > TSeedsInterface;
39       typedef itk::FunctionBase< TInputPixel, bool > TIntensityFunctor;
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     protected:
55       RegionGrow( );
56       virtual ~RegionGrow( );
57
58       virtual void GenerateInputRequestedRegion( ) override;
59       virtual void EnlargeOutputRequestedRegion(
60         itk::DataObject* output
61         ) override;
62       virtual void GenerateData( ) override;
63
64     private:
65       // Purposely not implemented
66       RegionGrow( const Self& other );
67       Self& operator=( const Self& other );
68
69     protected:
70       typename TIntensityFunctor::Pointer m_IntensityFunctor;
71       /* TODO
72          TSeeds m_Seeds;
73       */
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$