]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Image/Functors/RegionGrowThresholdFunction.h
Some more debug... almost there
[FrontAlgorithms.git] / lib / fpa / Image / Functors / RegionGrowThresholdFunction.h
1 #ifndef __FPA__IMAGE__FUNCTORS__REGIONGROWTHRESHOLDFUNCTION__H__
2 #define __FPA__IMAGE__FUNCTORS__REGIONGROWTHRESHOLDFUNCTION__H__
3
4 #include <limits>
5 #include <fpa/Image/Functors/RegionGrowAllBelongsFunction.h>
6
7 namespace fpa
8 {
9   namespace Image
10   {
11     namespace Functors
12     {
13       /**
14        */
15       template< class I >
16       class RegionGrowThresholdFunction
17         : public RegionGrowAllBelongsFunction< I >
18       {
19       public:
20         /// Type-related and pointers
21         typedef RegionGrowThresholdFunction       Self;
22         typedef RegionGrowAllBelongsFunction< I > Superclass;
23         typedef itk::SmartPointer< Self >         Pointer;
24         typedef itk::SmartPointer< const Self >   ConstPointer;
25
26         // Superclass' types
27         typedef typename Superclass::TInputImage  TInputImage;
28         typedef typename Superclass::TOutputValue TOutputValue;
29         typedef typename Superclass::TIndex       TIndex;
30         typedef typename I::PixelType             TPixel;
31
32       public:
33         itkNewMacro( Self );
34         itkTypeMacro(
35           RegionGrowThresholdFunction,
36           RegionGrowAllBelongsFunction
37           );
38
39         itkGetConstMacro( LowerThreshold, TPixel );
40         itkGetConstMacro( UpperThreshold, TPixel );
41
42         itkSetMacro( LowerThreshold, TPixel );
43         itkSetMacro( UpperThreshold, TPixel );
44
45       public:
46         virtual TOutputValue Evaluate( const TIndex& idx ) const
47           {
48             const I* img = this->GetInputImage( );
49             if( img != NULL )
50             {
51               /* TODO
52                  if( this->IsInsideBuffer( idx ) )
53                  {
54               */
55               TPixel v = img->GetPixel( idx );
56               std::cout
57                 << v << " "
58                 << this->m_LowerThreshold << " "
59                 << this->m_UpperThreshold << std::endl;
60               return(
61                 this->m_LowerThreshold <= v && v < this->m_UpperThreshold
62                 );
63
64               // TODO: } // fi
65
66             } // fi
67             return( false );
68           }
69
70       protected:
71         RegionGrowThresholdFunction( )
72           : Superclass( ),
73             m_LowerThreshold( std::numeric_limits< TPixel >::min( ) ),
74             m_UpperThreshold( std::numeric_limits< TPixel >::max( ) )
75           { }
76         virtual ~RegionGrowThresholdFunction( )
77           { }
78
79       private:
80         // Purposely not implemented
81         RegionGrowThresholdFunction( const Self& );
82         void operator=( const Self& );
83
84       protected:
85         TPixel m_LowerThreshold;
86         TPixel m_UpperThreshold;
87       };
88
89     } // ecapseman
90
91   } // ecapseman
92
93 } // ecapseman
94
95 #endif // __FPA__IMAGE__FUNCTORS__REGIONGROWTHRESHOLDFUNCTION__H__
96
97 // eof - $RCSfile$