]> Creatis software - FrontAlgorithms.git/blobdiff - appli/CTBronchi/MoriLabelling.h
...
[FrontAlgorithms.git] / appli / CTBronchi / MoriLabelling.h
index 0a9c58609735f86daea46fd91cb60c9ef4518333..caa96aab98be496910be43883512c1a35ff71ea0 100644 (file)
@@ -6,6 +6,13 @@
 #ifndef __CTBronchi__MoriLabelling__h__
 #define __CTBronchi__MoriLabelling__h__
 
+#include <fpa/Filters/Image/DefaultTraits.h>
+#include <fpa/Filters/MarksInterface.h>
+#include <fpa/Filters/Image/LabelsSeedFilter.h>
+#include <fpa/Filters/Image/LabelsSeedInterface.h>
+#include <fpa/Filters/Image/RegionGrow.h>
+#include <fpa/Functors/RegionGrow/BinaryThreshold.h>
+
 /* TODO
    #include <fpa/Base/RegionGrow.h>
    #include <fpa/Base/MarksInterface.h>
@@ -19,64 +26,63 @@ namespace CTBronchi
 {
   /**
    */
-  /* TODO
-     template< class _TInputImage, class _TLabelImage, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType > >
-     class MoriLabelling
-     : public fpa::Base::RegionGrow< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterface< _TTraits >, fpa::Image::LabelledSeedsInterface< _TTraits > > >
-     {
-     public:
-     typedef _TInputImage TInputImage;
-     typedef _TLabelImage TLabelImage;
-     typedef _TTraits     TTraits;
-     fpa_Base_TraitTypes( typename TTraits );
-
-     typedef fpa::Base::MarksInterface< TTraits > TMarksInterface;
-     typedef fpa::Image::LabelledSeedsInterface< TTraits > TSeedsInterface;
-     typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm;
-
-     typedef MoriLabelling                       Self;
-     typedef fpa::Base::RegionGrow< TAlgorithm > Superclass;
-     typedef itk::SmartPointer< Self >           Pointer;
-     typedef itk::SmartPointer< const Self >     ConstPointer;
-
-     typedef fpa::Base::Functors::RegionGrow::BinaryThreshold< TInputValue > TThresholdFunction;
-
-     public:
-     itkNewMacro( Self );
-     itkTypeMacro( MoriLabelling, fpa::Base::RegionGrow );
-
-     itkGetConstMacro( InsideLabel, TOutputValue );
-     itkSetMacro( InsideLabel, TOutputValue );
-
-     public:
-     const TLabelImage* GetInputLabelImage( ) const;
-     void SetInputLabelImage( TLabelImage* image );
-
-     const TInputImage* GetInputRawImage( ) const;
-     void SetInputRawImage( TInputImage* image );
-
-     TInputValue GetUpperThreshold( ) const;
-     void SetUpperThreshold( TInputValue t );
-
-     TOutputValue GetOutsideValue( ) const;
-     void SetOutsideLabel( TOutputValue o );
-
-     protected:
-     MoriLabelling( );
-     virtual ~MoriLabelling( );
-
-     virtual TNodes _UnifySeeds( ) override;
-     virtual void _UpdateOutputValue( TNode& n ) override;
-
-     private:
-     // Purposely not implemented.
-     MoriLabelling( const Self& other );
-     Self& operator=( const Self& other );
-
-     protected:
-     TOutputValue m_InsideLabel;
-     };
-  */
+  template< class _TInputImage, class _TLabelImage >
+  class MoriLabellingTraits
+        : public fpa::Filters::Image::DefaultTraits< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType >
+  {
+  public:
+    typedef _TInputImage TInputImage;
+    typedef _TLabelImage TLabelImage;
+    typedef fpa::Filters::Image::DefaultTraits< TInputImage, TLabelImage, typename TLabelImage::PixelType > Superclass;
+
+    typedef typename Superclass::TInternalTraits TInternalTraits;
+    typedef typename Superclass::TFilter TFilter;
+    typedef fpa::Filters::MarksInterface< TInternalTraits >  TMarksInterface;
+    typedef fpa::Filters::Image::LabelsSeedInterface< TInternalTraits > TSeedsInterface;
+  };
+
+  /**
+   */
+  template< class _TInputImage, class _TLabelImage >
+  class MoriLabelling
+    : public fpa::Filters::Image::LabelsSeedFilter< fpa::Filters::Image::Algorithm< fpa::Filters::RegionGrow< CTBronchi::MoriLabellingTraits< _TInputImage, _TLabelImage > > >, _TLabelImage >
+  {
+  public:
+    typedef _TInputImage TInputImage;
+    typedef _TLabelImage TLabelImage;
+    typedef CTBronchi::MoriLabellingTraits< TInputImage, TLabelImage > TTraits;
+    fpaTraitsMacro( typename, TTraits );
+
+    typedef fpa::Filters::Image::Algorithm< fpa::Filters::RegionGrow< TTraits > > TAlgorithm;
+    typedef fpa::Filters::Image::LabelsSeedFilter< TAlgorithm, _TLabelImage > Superclass;
+    typedef MoriLabelling Self;
+    typedef itk::SmartPointer< Self >        Pointer;
+    typedef itk::SmartPointer< const Self >  ConstPointer;
+
+    typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TLabelFunctor;
+
+  public:
+    itkNewMacro( Self );
+    itkTypeMacro( CTBronchi::MoriLabelling, fpa::Filters::Image::RegionGrow );
+
+  public:
+    TInputValue GetUpperThreshold( ) const;
+    void SetUpperThreshold( TInputValue t );
+
+  protected:
+    MoriLabelling( );
+    virtual ~MoriLabelling( );
+
+    virtual void _UpdateOutputValue( TNode& n ) override;
+
+  private:
+    // Purposely not implemented.
+    MoriLabelling( const Self& other );
+    Self& operator=( const Self& other );
+
+  protected:
+    typename TLabelFunctor::Pointer m_LabelFunctor;
+  };
 
 } // ecapseman