]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Algorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Image / Algorithm.h
index 2fd40bc1c242cef832e920189a844a63263a43dc..0105cc3080d13166c0a23ca5b702b7622012c795 100644 (file)
@@ -1,9 +1,10 @@
-#ifndef __FPA__IMAGE__ALGORITHM__H__
-#define __FPA__IMAGE__ALGORITHM__H__
+#ifndef __fpa__Image__Algorithm__h__
+#define __fpa__Image__Algorithm__h__
 
-#include <fpa/Base/Algorithm.h>
-#include <itkImage.h>
+#include <itkFunctionBase.h>
 #include <itkImageToImageFilter.h>
+#include <fpa/Base/Algorithm.h>
+#include <fpa/Image/Functors/Base.h>
 
 namespace fpa
 {
@@ -13,74 +14,51 @@ namespace fpa
      */
     template< class _TInputImage, class _TOutputImage >
     class Algorithm
-      : public fpa::Base::Algorithm< typename _TInputImage::IndexType, typename _TOutputImage::PixelType, itk::ImageToImageFilter< _TInputImage, _TOutputImage >, typename _TInputImage::IndexType::LexicographicCompare >
+      : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, typename _TInputImage::IndexType, typename _TOutputImage::PixelType >
     {
     public:
-      typedef fpa::Base::Algorithm< typename _TInputImage::IndexType, typename _TOutputImage::PixelType, itk::ImageToImageFilter< _TInputImage, _TOutputImage >, typename _TInputImage::IndexType::LexicographicCompare > Superclass;
-      typedef Algorithm                       Self;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      // Input types
-      typedef _TInputImage  TInputImage;
-      typedef _TOutputImage TOutputImage;
-      itkConceptMacro(
-        ImagesSameDimension,
-        (
-          itk::Concept::
-          SameDimension<
-          TInputImage::ImageDimension,
-          TOutputImage::ImageDimension
-          >
-          )
-        );
-
-      // Template arguments
-      typedef typename Superclass::TVertex        TVertex;
-      typedef typename Superclass::TScalar        TScalar;
-      typedef typename Superclass::TFilter        TFilter;
-      typedef typename Superclass::TVertexCompare TVertexCompare;
-      typedef typename Superclass::TFrontId       TFrontId;
-      typedef typename Superclass::TCollision     TCollision;
-      typedef typename Superclass::TCollisionsRow TCollisionsRow;
-      typedef typename Superclass::TCollisions    TCollisions;
-      typedef typename Superclass::TNodeLabel     TNodeLabel;
-      typedef typename Superclass::TNode          TNode;
-      typedef typename Superclass::TNodes         TNodes;
-      typedef typename Superclass::TVertices      TVertices;
-
-      typedef itk::Image< TFrontId, TInputImage::ImageDimension > TMarkImage;
+      typedef itk::ImageToImageFilter< _TInputImage, _TOutputImage > TFilter;
+      typedef typename _TInputImage::IndexType                       TVertex;
+      typedef typename _TOutputImage::PixelType                      TOutput;
 
-    public:
-      itkTypeMacro( Algorithm, _TFilter );
+      typedef Algorithm                                         Self;
+      typedef fpa::Base::Algorithm< TFilter, TVertex, TOutput > Superclass;
+      typedef itk::SmartPointer< Self >                         Pointer;
+      typedef itk::SmartPointer< const Self >                   ConstPointer;
+
+      typedef typename Superclass::TFrontId      TFrontId;
+      typedef typename Superclass::TNeighborhood TNeighborhood;
 
-      itkGetConstMacro( NeighborhoodOrder, unsigned short );
-      itkSetMacro( NeighborhoodOrder, unsigned short );
+      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;
+
+    public:
+      itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
 
     protected:
-      // Methods to extend itk-imaged architecture
       Algorithm( );
       virtual ~Algorithm( );
 
-      // Front propagation methods to be overloaded
-      virtual void _BeforeGenerateData( ) fpa_OVERRIDE;
-      virtual void _InitMarks( ) fpa_OVERRIDE;
-      virtual void _InitResults( ) fpa_OVERRIDE;
-      virtual void _DeallocateAuxiliary( ) fpa_OVERRIDE;
-      virtual TFrontId _GetMark( const TVertex& v ) fpa_OVERRIDE;
-      virtual void _Visit( const TNode& n ) fpa_OVERRIDE;
-      virtual TVertices _GetNeighborhood(
-        const TVertex& v
-        ) const fpa_OVERRIDE;
+      virtual void _BeforeGenerateData( ) override;
+      virtual void _InitMarks( ) override;
+      virtual void _InitResults( const TOutput& init_value ) 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;
 
     private:
-      // Purposely not implemented
+      // Purposely not defined
       Algorithm( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
-      unsigned short m_NeighborhoodOrder;
-      typename TMarkImage::Pointer m_Marks;
+      unsigned int m_MarksIdx;
     };
 
   } // ecapseman
@@ -89,8 +67,8 @@ namespace fpa
 
 #ifndef ITK_MANUAL_INSTANTIATION
 #  include <fpa/Image/Algorithm.hxx>
-#endif
+#endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __FPA__IMAGE__ALGORITHM__H__
+#endif // __fpa__Image__Algorithm__h__
 
 // eof - $RCSfile$