]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/RegionGrow.h
...
[FrontAlgorithms.git] / lib / fpa / Image / RegionGrow.h
index b12a869d87ccdca57610f351da531a9b71e30bc0..4d190dc09e32229afc33dc88da42c55333dbf202 100644 (file)
@@ -1,85 +1,55 @@
-#ifndef __FPA__IMAGE__REGIONGROW__H__
-#define __FPA__IMAGE__REGIONGROW__H__
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__RegionGrow__h__
+#define __fpa__Image__RegionGrow__h__
 
-#include <itkImageToImageFilter.h>
-#include <itkIndex.h>
 #include <fpa/Base/RegionGrow.h>
 #include <fpa/Image/Algorithm.h>
-#include <fpa/Image/Functors/ImageFunction.h>
+#include <fpa/Image/DefaultTraits.h>
 
 namespace fpa
 {
   namespace Image
   {
     /**
-     * @param I Input image type
      */
-    template< class I, class O = I, class CC = fpa::Image::Functors::CastVertexValueToCost< typename I::PixelType, typename O::PixelType > >
+    template< class _TInputImage, class _TOutputImage, class _TFrontId = unsigned char >
     class RegionGrow
-      : public Algorithm< I, fpa::Base::RegionGrow< typename I::IndexType, typename O::PixelType, typename I::PixelType, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, itk::ImageToImageFilter< I, O > >, CC >
+      : public fpa::Base::RegionGrow< fpa::Image::Algorithm< fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > > >
     {
     public:
-      // Standard class typdedefs
-      typedef typename I::IndexType TVertex;
-      typedef typename O::PixelType TResult;
-      typedef typename I::PixelType TVertexValue;
-      typedef itk::ImageToImageFilter< I, O > TBaseFilter;
-      typedef fpa::Base::RegionGrow< TVertex, TResult, TVertexValue, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, TBaseFilter > TBaseAlgorithm;
-
-      typedef RegionGrow                         Self;
-      typedef Algorithm< I, TBaseAlgorithm, CC > Superclass;
-      typedef itk::SmartPointer< Self >          Pointer;
-      typedef itk::SmartPointer< const Self >    ConstPointer;
+      typedef _TInputImage  TInputImage;
+      typedef _TOutputImage TOutputImage;
+      typedef _TFrontId     TFrontId;
 
-      typedef
-      fpa::Image::Functors::ImageFunction< I, bool >
-      TMembershipFunction;
+      typedef fpa::Image::DefaultTraits< TInputImage, TOutputImage, TFrontId > TTraits;
+      typedef fpa::Image::Algorithm< TTraits >    TAlgorithm;
+      typedef fpa::Base::RegionGrow< TAlgorithm > Superclass;
+      typedef RegionGrow                          Self;
+      typedef itk::SmartPointer< Self >           Pointer;
+      typedef itk::SmartPointer< const Self >     ConstPointer;
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( RegionGrow, fpaBaseRegionGrow );
-
-      itkGetObjectMacro( MembershipFunction, TMembershipFunction );
-      itkSetObjectMacro( MembershipFunction, TMembershipFunction );
+      itkTypeMacro( fpa::Image::RegionGrow, fpa::Base::RegionGrow );
 
     protected:
-      RegionGrow( )
-        : Superclass( ),
-          m_MembershipFunction( NULL )
-        { }
-      virtual ~RegionGrow( )
-        { }
-
-      virtual bool _CheckMembership(
-        const typename Superclass::_TNode& n
-        ) const
-        {
-          if( this->m_MembershipFunction.IsNotNull( ) )
-          {
-            if(
-              this->m_MembershipFunction->GetInputImage( ) !=
-              this->GetInput( )
-              )
-              this->m_MembershipFunction->SetInputImage( this->GetInput( ) );
-            return( this->m_MembershipFunction->Evaluate( n.Vertex ) );
-          }
-          else
-            return( false );
-        }
+      RegionGrow( ) : Superclass( ) { }
+      virtual ~RegionGrow( )        { }
 
     private:
-      // Purposely not implemented
-      RegionGrow( const Self& );
-      void operator=( const Self& );
-
-    protected:
-      typename TMembershipFunction::Pointer m_MembershipFunction;
+      // Purposely not implemented.
+      RegionGrow( const Self& other );
+      Self& operator=( const Self& other );
     };
 
   } // ecapseman
 
 } // ecapseman
 
-#endif // __FPA__IMAGE__REGIONGROW__H__
+#endif // __fpa__Image__RegionGrow__h__
 
 // eof - $RCSfile$