]> Creatis software - FrontAlgorithms.git/blobdiff - libs/fpa/Image/MoriRegionGrow.h
...
[FrontAlgorithms.git] / libs / fpa / Image / MoriRegionGrow.h
index 606d4f7c0a0ca1a4541abb36ae817968979de917..182e004ba04e7cdc35ea34417a8dfc087ea338f2 100644 (file)
@@ -6,8 +6,10 @@
 #ifndef __fpa__Image__MoriRegionGrow__h__
 #define __fpa__Image__MoriRegionGrow__h__
 
-#include <itkImageToImageFilter.h>
-#include <itkBinaryThresholdImageFilter.h>
+#include <fpa/Base/MoriRegionGrow.h>
+#include <fpa/Base/SeedsInterface.h>
+#include <fpa/Image/MarksInterface.h>
+#include <fpa/Image/Filter.h>
 
 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 <fpa/Image/MoriRegionGrow.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
 #endif // __fpa__Image__MoriRegionGrow__h__
 
 // eof - $RCSfile$