]> Creatis software - FrontAlgorithms.git/blobdiff - appli/CTBronchi/MoriLabelling.h
...
[FrontAlgorithms.git] / appli / CTBronchi / MoriLabelling.h
index d07968b3ca670ac90fe9283c5c380f3705d34395..89ce00164a57e417c5938f09e13e727895aa1d0c 100644 (file)
@@ -5,7 +5,6 @@
 #ifndef __CTBronchi__MoriLabelling__h__
 #define __CTBronchi__MoriLabelling__h__
 
-#include <map>
 #include <fpa/Filters/BaseMarksInterface.h>
 #include <fpa/Filters/Image/SeedsFromLabelsInterface.h>
 #include <fpa/Filters/Image/DefaultTraits.h>
@@ -16,15 +15,12 @@ namespace CTBronchi
 {
   /**
    */
-  template< class _TInputImage, class _TLabelImage >
+  template< class _TImage, class _TLabels >
   class MoriLabellingTraits
-    : public fpa::Filters::Image::DefaultTraits< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType >
+    : public fpa::Filters::Image::DefaultTraits< _TImage, _TLabels, typename _TLabels::PixelType >
   {
   public:
-    typedef _TInputImage TInputImage;
-    typedef _TLabelImage TLabelImage;
-    typedef typename TLabelImage::PixelType TLabel;
-    typedef fpa::Filters::Image::DefaultTraits< TInputImage, TLabelImage, TLabel > Superclass;
+    typedef fpa::Filters::Image::DefaultTraits< _TImage, _TLabels, typename _TLabels::PixelType > Superclass;
     typedef typename Superclass::TInternalTraits  TInternalTraits;
     typedef typename Superclass::TMarksImage      TMarksImage;
     typedef typename Superclass::TFilterInterface TFilterInterface;
@@ -35,41 +31,49 @@ namespace CTBronchi
 
   /**
    */
-  template< class _TInputImage, class _TLabelImage >
+  template< class _TImage, class _TLabels, class _TScalarImage >
   class MoriLabelling
-    : public fpa::Filters::Image::RegionGrow< _TInputImage, _TLabelImage, typename _TLabelImage::PixelType, CTBronchi::MoriLabellingTraits< _TInputImage, _TLabelImage > >
+    : public fpa::Filters::Image::RegionGrow< _TImage, _TLabels, typename _TLabels::PixelType, CTBronchi::MoriLabellingTraits< _TImage, _TLabels > >
   {
   public:
-    typedef _TInputImage TInputImage;
-    typedef _TLabelImage TLabelImage;
-    typedef CTBronchi::MoriLabellingTraits< TInputImage, TLabelImage > TTraits;
+    typedef CTBronchi::MoriLabellingTraits< _TImage, _TLabels > TTraits;
     fpaTraitsMacro( typename TTraits );
 
-    typedef fpa::Filters::Image::RegionGrow< TInputImage, TLabelImage, TMark, TTraits > Superclass;
-    typedef MoriLabelling                   Self;
-    typedef itk::SmartPointer< Self >       Pointer;
+    typedef fpa::Filters::Image::RegionGrow< _TImage, _TLabels, TMark, TTraits > Superclass;
+    typedef MoriLabelling Self;
+    typedef itk::SmartPointer< Self > Pointer;
     typedef itk::SmartPointer< const Self > ConstPointer;
+
     typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TFunctor;
 
   public:
     itkNewMacro( Self );
-    itkTypeMacro( CTBronchi::MoriLabelling, fpa::Filters::Image::RegionGrow );
+    itkTypeMacro( MoriLabelling, fpa::Filters::Image::RegionGrow );
 
-    itkGetConstMacro( LastThreshold, TInputValue );
-    itkSetMacro( LastThreshold, TInputValue );
+    itkGetConstMacro( VesselnessThreshold, double );
+    itkSetMacro( VesselnessThreshold, double );
 
-    fpaFilterInputMacro( InputLabels, TLabelImage );
+    itkGetConstMacro( UpperThreshold, TInputValue );
+    itkSetMacro( UpperThreshold, TInputValue );
 
-  public:
-    TInputValue GetUpperThreshold( ) const;
-    void SetUpperThreshold( TInputValue t );
+    ivqITKInputMacro( InputLabels, _TLabels );
+    ivqITKInputMacro( InputVesselness, _TScalarImage );
 
   protected:
-    MoriLabelling( );
-    virtual ~MoriLabelling( );
-
-    virtual const itk::DataObject* _GetReferenceInput( ) const override;
-    virtual void _PostComputeOutputValue( TNode& n ) override;
+    MoriLabelling( )
+      : Superclass( ),
+        m_VesselnessThreshold( 0.05 ),
+        m_UpperThreshold( -650 )
+      {
+        ivqITKInputConfigureMacro( InputLabels, _TLabels );
+        ivqITKInputConfigureMacro( InputVesselness, _TScalarImage );
+        this->m_Functor = TFunctor::New( );
+        this->SetPredicate( this->m_Functor );
+      }
+
+    virtual ~MoriLabelling( )
+      {
+      }
 
   private:
     // Purposely not implemented.
@@ -78,14 +82,12 @@ namespace CTBronchi
 
   protected:
     typename TFunctor::Pointer m_Functor;
-    TInputValue m_LastThreshold;
+    double m_VesselnessThreshold;
+    TInputValue m_UpperThreshold;
   };
 
 } // ecapseman
 
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <CTBronchi/MoriLabelling.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-#endif // __CTBronchi__MoriLabelling__h__
+#endif // __CTBronchi__Functions__h__
 
 // eof - $RCSfile$