]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Algorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Image / Algorithm.h
index 0105cc3080d13166c0a23ca5b702b7622012c795..12a2f9140994434a9ac85ef1c2b4854f81b5fdc5 100644 (file)
@@ -1,10 +1,15 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__Algorithm__h__
 #define __fpa__Image__Algorithm__h__
 
-#include <itkFunctionBase.h>
+#include <itkImage.h>
 #include <itkImageToImageFilter.h>
+
 #include <fpa/Base/Algorithm.h>
-#include <fpa/Image/Functors/Base.h>
 
 namespace fpa
 {
@@ -12,53 +17,66 @@ namespace fpa
   {
     /**
      */
-    template< class _TInputImage, class _TOutputImage >
+    template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
     class Algorithm
-      : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, typename _TInputImage::IndexType, typename _TOutputImage::PixelType >
+      : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, _TMarksInterface, _TSeedsInterface >
     {
     public:
-      typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > TFilter;
-      typedef typename _TInputImage::IndexType                       TVertex;
-      typedef typename _TOutputImage::PixelType                      TOutput;
-
-      typedef Algorithm                                         Self;
-      typedef fpa::Base::Algorithm< TFilter, TVertex, TOutput > Superclass;
-      typedef itk::SmartPointer< Self >                         Pointer;
-      typedef itk::SmartPointer< const Self >                   ConstPointer;
-
+      typedef _TInputImage     TInputImage;
+      typedef _TOutputImage    TOutputImage;
+      typedef _TMarksInterface TMarksInterface;
+      typedef _TSeedsInterface TSeedsInterface;
+      typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
+
+      typedef Algorithm Self;
+      typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename TInputImage::PixelType    TInputValue;
+      typedef typename TOutputImage::PixelType   TOutputValue;
       typedef typename Superclass::TFrontId      TFrontId;
       typedef typename Superclass::TNeighborhood TNeighborhood;
+      typedef typename Superclass::TNode         TNode;
+      typedef typename Superclass::TNodes        TNodes;
+      typedef typename Superclass::TSeeds        TSeeds;
+      typedef typename Superclass::TVertex       TVertex;
+      typedef typename Superclass::TPoint        TPoint;
 
-      typedef fpa::Image::Functors::Base< itk::ImageBase< _TInputImage::ImageDimension >, typename Superclass::TNeighborhoodFunction > TNeighborhoodFunction;
-      typedef fpa::Image::Functors::Base< _TInputImage, typename Superclass::TVertexFunction > TVertexFunction;
-
-    protected:
-      typedef typename Superclass::_TQueueNode _TQueueNode;
+      typedef itk::Image< TFrontId, TInputImage::ImageDimension > TMarks;
 
     public:
       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
 
+      itkGetConstMacro( NeigborhoodOrder, unsigned int );
+      itkSetMacro( NeigborhoodOrder, unsigned int );
+
+    public:
+      TMarks* GetMarks( );
+      const TMarks* GetMarks( ) const;
+
     protected:
       Algorithm( );
       virtual ~Algorithm( );
 
-      virtual void _BeforeGenerateData( ) override;
-      virtual void _InitMarks( ) override;
-      virtual void _InitResults( const TOutput& init_value ) override;
+      virtual TNodes _UnifySeeds( ) override;
+      virtual void _ConfigureOutput( const TOutputValue& v ) override;
+      virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override;
+      virtual TInputValue _GetInputValue( const TVertex& v ) const override;
+      virtual TOutputValue _GetOutputValue( const TVertex& v ) const override;
+      virtual void _UpdateOutputValue( const TNode& n ) override;
       virtual bool _IsMarked( const TVertex& v ) const override;
-      virtual void _Mark( const _TQueueNode& n ) override;
-      virtual TFrontId _GetMark( const TVertex& v ) const override;
-      virtual void _UpdateResult( const _TQueueNode& n ) override;
-      virtual TOutput _GetResult( const TVertex& v ) const override;
-      virtual unsigned int _GetNumberOfDimensions( ) const override;
+      virtual unsigned long _GetMark( const TVertex& v ) const override;
+      virtual bool _Mark( const TVertex& v, unsigned long frontId ) override;
 
     private:
-      // Purposely not defined
+      // Purposely not implemented.
       Algorithm( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
-      unsigned int m_MarksIdx;
+      unsigned long m_MarksIdx;
+      unsigned int  m_NeigborhoodOrder;
     };
 
   } // ecapseman