X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=libs%2Ffpa%2FImage%2FMoriRegionGrow.h;h=182e004ba04e7cdc35ea34417a8dfc087ea338f2;hb=5e0c313e26ec0a292b5ee965b5a22a2ed60c1021;hp=606d4f7c0a0ca1a4541abb36ae817968979de917;hpb=1bde955a3f32330dcbbd2c190de75a8f77865de9;p=FrontAlgorithms.git diff --git a/libs/fpa/Image/MoriRegionGrow.h b/libs/fpa/Image/MoriRegionGrow.h index 606d4f7..182e004 100644 --- a/libs/fpa/Image/MoriRegionGrow.h +++ b/libs/fpa/Image/MoriRegionGrow.h @@ -6,8 +6,10 @@ #ifndef __fpa__Image__MoriRegionGrow__h__ #define __fpa__Image__MoriRegionGrow__h__ -#include -#include +#include +#include +#include +#include namespace fpa { @@ -15,106 +17,39 @@ namespace fpa { /** */ - template< class _TInputImage, class _TOutputImage, class _TAuxiliaryPixel = unsigned short > + template< class _TInputImage, class _TOutputImage > class MoriRegionGrow - : public itk::ImageToImageFilter< _TInputImage, _TOutputImage > + : public fpa::Base::MoriRegionGrow< fpa::Image::Filter< _TInputImage, _TOutputImage >, fpa::Image::MarksInterface< _TInputImage::ImageDimension >, fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > > { public: - typedef _TInputImage TInputImage; - typedef _TOutputImage TOutputImage; - typedef _TAuxiliaryPixel TAuxiliaryPixel; - typedef itk::Image< TAuxiliaryPixel, TInputImage::ImageDimension > TAuxiliaryImage; + // Interfaces + typedef fpa::Image::Filter< _TInputImage, _TOutputImage > TFilter; + typedef fpa::Image::MarksInterface< _TInputImage::ImageDimension > TMarksInterface; + typedef fpa::Base::SeedsInterface< typename _TInputImage::IndexType, typename _TInputImage::IndexType::LexicographicCompare > TSeedsInterface; - 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; + // Smart pointers + typedef MoriRegionGrow Self; + typedef fpa::Base::MoriRegionGrow< TFilter, TMarksInterface, TSeedsInterface > Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; 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 ) - ); + itkTypeMacro( fpa::Image::MoriRegionGrow, fpa::Base::MoriRegionGrow ); protected: - MoriRegionGrow( ); - virtual ~MoriRegionGrow( ); - - virtual void GenerateInputRequestedRegion( ) override; - virtual void EnlargeOutputRequestedRegion( - itk::DataObject* output - ) override; - virtual void GenerateData( ) override; + MoriRegionGrow( ) : Superclass( ) { } + virtual ~MoriRegionGrow( ) { } 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$