]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Algorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Image / Algorithm.h
index 12a2f9140994434a9ac85ef1c2b4854f81b5fdc5..6bed9adc858a68b142aca6effff34065fef065a5 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <itkImage.h>
 #include <itkImageToImageFilter.h>
-
 #include <fpa/Base/Algorithm.h>
 
 namespace fpa
@@ -17,33 +16,67 @@ namespace fpa
   {
     /**
      */
-    template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+    template< class _TTraits, class _TMarks, class _TSeeds >
     class Algorithm
-      : public fpa::Base::Algorithm< itk::ImageToImageFilter< _TInputImage, _TOutputImage >, _TMarksInterface, _TSeedsInterface >
+      : public fpa::Base::Algorithm< itk::ImageToImageFilter< typename _TTraits::TInputImage, typename _TTraits::TOutputImage >, _TMarks, _TSeeds >
     {
     public:
-      typedef _TInputImage     TInputImage;
-      typedef _TOutputImage    TOutputImage;
-      typedef _TMarksInterface TMarksInterface;
-      typedef _TSeedsInterface TSeedsInterface;
+      typedef _TTraits TTraits;
+      typedef _TMarks  TMarksInterface;
+      typedef _TSeeds  TSeedsInterface;
+      typedef typename TTraits::TInputImage  TInputImage;
+      typedef typename TTraits::TOutputImage TOutputImage;
       typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
 
-      typedef Algorithm Self;
       typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
+      typedef Algorithm                       Self;
       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;
+      fpa_Base_TraitTypes( typename TTraits );
+
+      /* TODO
+         typedef typename TTraits::TFrontId      TFrontId;
+         typedef typename TTraits::TInputImage   TInputImage;
+         typedef typename TTraits::TInputValue   TInputValue;
+         typedef typename TTraits::TNeighborhood TNeighborhood;
+         typedef typename TTraits::TNode         TNode;
+         typedef typename TTraits::TNodes        TNodes;
+         typedef typename TTraits::TOutputImage  TOutputImage;
+         typedef typename TTraits::TOutputValue  TOutputValue;
+         typedef typename TTraits::TSeeds        TSeeds;
+         typedef typename TTraits::TVertex       TVertex;
+      */
+
+      typedef itk::Image< TFrontId, TTraits::Dimension > TMarks;
+
+      /* TODO
+         typedef _TMarksInterface TMarksInterface;
+         typedef _TSeedsInterface TSeedsInterface;
+
+         typedef typename TSeedsInterface::TTraits TTraits;
+         typedef typename TTraits::TInputImage   TInputImage;
+         typedef typename TTraits::TOutputImage  TOutputImage;
+         typedef typename TTraits::TInputValue   TInputValue;
+         typedef typename TTraits::TOutputValue  TOutputValue;
+         typedef typename TTraits::TFrontId      TFrontId;
+         typedef typename TTraits::TNeighborhood TNeighborhood;
+         typedef typename TTraits::TNode         TNode;
+         typedef typename TTraits::TNodes        TNodes;
+         typedef typename TTraits::TSeeds        TSeeds;
+         typedef typename TTraits::TVertex       TVertex;
+         typedef typename TTraits::TPoint        TPoint;
+
+         typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
+         typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
+         typedef Algorithm                       Self;
+      */
 
-      typedef itk::Image< TFrontId, TInputImage::ImageDimension > TMarks;
+    private:
+      itkConceptMacro(
+        Marks_SameTraits,
+        ( itk::Concept::SameType< typename _TMarks::TTraits, TTraits > )
+        );
 
     public:
       itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
@@ -64,10 +97,10 @@ namespace fpa
       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 void _UpdateOutputValue( TNode& n ) override;
       virtual bool _IsMarked( const TVertex& v ) const override;
       virtual unsigned long _GetMark( const TVertex& v ) const override;
-      virtual bool _Mark( const TVertex& v, unsigned long frontId ) override;
+      virtual void _Mark( const TVertex& v, unsigned long frontId ) override;
 
     private:
       // Purposely not implemented.