1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
6 #ifndef __fpa__Image__MoriRegionGrow__h__
7 #define __fpa__Image__MoriRegionGrow__h__
9 #include <itkImageToImageFilter.h>
10 #include <itkBinaryThresholdImageFilter.h>
18 template< class _TInputImage, class _TOutputImage, class _TAuxiliaryPixel = unsigned short >
20 : public itk::ImageToImageFilter< _TInputImage, _TOutputImage >
23 typedef _TInputImage TInputImage;
24 typedef _TOutputImage TOutputImage;
25 typedef _TAuxiliaryPixel TAuxiliaryPixel;
26 typedef itk::Image< TAuxiliaryPixel, TInputImage::ImageDimension > TAuxiliaryImage;
28 typedef MoriRegionGrow Self;
29 typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass;
30 typedef itk::SmartPointer< Self > Pointer;
31 typedef itk::SmartPointer< const Self > ConstPointer;
33 typedef typename TInputImage::IndexType TIndex;
34 typedef typename TInputImage::RegionType TRegion;
35 typedef typename TInputImage::PixelType TInputPixel;
36 typedef typename TOutputImage::PixelType TOutputPixel;
43 TCurveData( TInputPixel v, unsigned long c )
47 this->Diff1 = double( 0 );
50 typedef std::vector< TCurveData > TCurve;
51 typedef itk::BinaryThresholdImageFilter< TAuxiliaryImage, TOutputImage > TThresholdFilter;
55 itkTypeMacro( fpa::Image::MoriRegionGrow, itk::ImageToImageFilter );
57 itkGetConstMacro( Seed, TIndex );
58 itkGetConstMacro( InsideValue, TOutputPixel );
59 itkGetConstMacro( OutsideValue, TOutputPixel );
60 itkGetConstMacro( LowerThreshold, TInputPixel );
61 itkGetConstMacro( UpperThreshold, TInputPixel );
62 itkGetConstMacro( DeltaThreshold, TInputPixel );
63 itkGetConstMacro( OptimumThreshold, TInputPixel );
64 itkGetConstMacro( Curve, TCurve );
66 itkSetMacro( Seed, TIndex );
67 itkSetMacro( InsideValue, TOutputPixel );
68 itkSetMacro( OutsideValue, TOutputPixel );
69 itkSetMacro( LowerThreshold, TInputPixel );
70 itkSetMacro( UpperThreshold, TInputPixel );
71 itkSetMacro( DeltaThreshold, TInputPixel );
74 TAuxiliaryImage* GetAuxiliaryImage( );
75 const TAuxiliaryImage* GetAuxiliaryImage( ) const;
77 void SetThresholdRange(
78 const TInputPixel& lower, const TInputPixel& upper,
79 const TInputPixel& delta = TInputPixel( 1 )
84 virtual ~MoriRegionGrow( );
86 virtual void GenerateInputRequestedRegion( ) override;
87 virtual void EnlargeOutputRequestedRegion(
88 itk::DataObject* output
90 virtual void GenerateData( ) override;
93 // Purposely not implemented
94 MoriRegionGrow( const Self& other );
95 Self& operator=( const Self& other );
99 TOutputPixel m_InsideValue;
100 TOutputPixel m_OutsideValue;
101 TInputPixel m_LowerThreshold;
102 TInputPixel m_UpperThreshold;
103 TInputPixel m_DeltaThreshold;
104 TInputPixel m_OptimumThreshold;
107 typename TThresholdFilter::Pointer m_ThresholdFilter;
114 #ifndef ITK_MANUAL_INSTANTIATION
115 # include <fpa/Image/MoriRegionGrow.hxx>
116 #endif // ITK_MANUAL_INSTANTIATION
118 #endif // __fpa__Image__MoriRegionGrow__h__