// ========================================================================= // @author Leonardo Florez Valencia // @email florez-l@javeriana.edu.co // ========================================================================= #ifndef __fpa__Image__MoriRegionGrow__h__ #define __fpa__Image__MoriRegionGrow__h__ #include #include namespace fpa { namespace Image { /** */ template< class _TInputImage, class _TOutputImage, class _TAuxiliaryPixel = unsigned short > class MoriRegionGrow : public itk::ImageToImageFilter< _TInputImage, _TOutputImage > { public: typedef _TInputImage TInputImage; typedef _TOutputImage TOutputImage; typedef _TAuxiliaryPixel TAuxiliaryPixel; typedef itk::Image< TAuxiliaryPixel, TInputImage::ImageDimension > TAuxiliaryImage; typedef MoriRegionGrow Self; typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef typename TInputImage::IndexType TIndex; typedef typename TInputImage::RegionType TRegion; typedef typename TInputImage::PixelType TInputPixel; typedef typename TOutputImage::PixelType TOutputPixel; struct TCurveData { TInputPixel XValue; unsigned long YValue; double Diff1; TCurveData( TInputPixel v, unsigned long c ) { this->XValue = v; this->YValue = c; this->Diff1 = double( 0 ); } }; typedef std::vector< TCurveData > TCurve; typedef itk::BinaryThresholdImageFilter< TAuxiliaryImage, TOutputImage > TThresholdFilter; public: itkNewMacro( Self ); itkTypeMacro( fpa::Image::MoriRegionGrow, itk::ImageToImageFilter ); itkGetConstMacro( Seed, TIndex ); itkGetConstMacro( InsideValue, TOutputPixel ); itkGetConstMacro( OutsideValue, TOutputPixel ); itkGetConstMacro( LowerThreshold, TInputPixel ); itkGetConstMacro( UpperThreshold, TInputPixel ); itkGetConstMacro( DeltaThreshold, TInputPixel ); itkGetConstMacro( OptimumThreshold, TInputPixel ); itkGetConstMacro( Curve, TCurve ); itkSetMacro( Seed, TIndex ); itkSetMacro( InsideValue, TOutputPixel ); itkSetMacro( OutsideValue, TOutputPixel ); itkSetMacro( LowerThreshold, TInputPixel ); itkSetMacro( UpperThreshold, TInputPixel ); itkSetMacro( DeltaThreshold, TInputPixel ); public: TAuxiliaryImage* GetAuxiliaryImage( ); const TAuxiliaryImage* GetAuxiliaryImage( ) const; void SetThresholdRange( const TInputPixel& lower, const TInputPixel& upper, const TInputPixel& delta = TInputPixel( 1 ) ); protected: MoriRegionGrow( ); virtual ~MoriRegionGrow( ); virtual void GenerateInputRequestedRegion( ) override; virtual void EnlargeOutputRequestedRegion( itk::DataObject* output ) override; virtual void GenerateData( ) override; private: // Purposely not implemented MoriRegionGrow( const Self& other ); Self& operator=( const Self& other ); protected: TIndex m_Seed; TOutputPixel m_InsideValue; TOutputPixel m_OutsideValue; TInputPixel m_LowerThreshold; TInputPixel m_UpperThreshold; TInputPixel m_DeltaThreshold; TInputPixel m_OptimumThreshold; TCurve m_Curve; typename TThresholdFilter::Pointer m_ThresholdFilter; }; } // ecapseman } // ecapseman #ifndef ITK_MANUAL_INSTANTIATION # include #endif // ITK_MANUAL_INSTANTIATION #endif // __fpa__Image__MoriRegionGrow__h__ // eof - $RCSfile$