]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/GradientImageFunctionBase.h
Medialness filters updated.
[cpPlugins.git] / lib / cpExtensions / Algorithms / GradientImageFunctionBase.h
index bc6bd3643845e5e3a4d1bf4085922d6b476cd69b..f6d3e5cef804e1faa4da31c444fb15fc5b0b213b 100644 (file)
@@ -10,16 +10,19 @@ namespace cpExtensions
     /**
      * Base class to compute values based on image gradients (vector).
      */
-    template< class _TGradient >
+    template< class _TGradient, class _TMask = itk::Image< unsigned char, _TGradient::ImageDimension > >
     class GradientImageFunctionBase
       : public itk::ImageFunction< _TGradient, typename _TGradient::PixelType::ValueType, typename _TGradient::PixelType::ValueType >
     {
     public:
       // Types from input arguments
       typedef _TGradient                     TGradient;
+      typedef _TMask                         TMask;
       typedef typename _TGradient::PixelType TVector;
       typedef typename TVector::ValueType    TScalar;
-      itkStaticConstMacro( Dimension, unsigned int, _TGradient::ImageDimension );
+      itkStaticConstMacro(
+        Dimension, unsigned int, _TGradient::ImageDimension
+        );
 
       // Standard itk types
       typedef GradientImageFunctionBase                          Self;
@@ -37,6 +40,9 @@ namespace cpExtensions
     public:
       itkTypeMacro( GradientImageFunctionBase, itkImageFunction );
 
+      itkGetConstObjectMacro( Mask, TMask );
+      itkSetConstObjectMacro( Mask, TMask );
+
     public:
       virtual void Prepare( ) const;
       virtual TOutput Evaluate( const TPoint& p ) const cpExtensions_OVERRIDE;
@@ -53,6 +59,9 @@ namespace cpExtensions
       // Purposely not implemented.
       GradientImageFunctionBase( const Self& );
       void operator=( const Self& );
+
+    protected:
+      typename _TMask::ConstPointer m_Mask;
     };
 
   } // ecapseman