]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/GradientFunctionBase.h
Double click widget integrated with segmentation and deformation filters.
[cpPlugins.git] / lib / cpExtensions / Algorithms / GradientFunctionBase.h
index a120a463211d230d55f74f4a8f22170b3377ecac..0472cc4efec3dc49450a8d16620c70077049ac48 100644 (file)
@@ -9,73 +9,75 @@
 #include <itkImageFunction.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class G >
+    class GradientFunctionBase
+      : public itk::ImageFunction< G, typename G::PixelType::ValueType, typename G::PixelType::ValueType >
     {
-      /**
-       */
-      template< class G >
-      class GradientFunctionBase
-        : public itk::ImageFunction< G, typename G::PixelType::ValueType, typename G::PixelType::ValueType >
-      {
-      public:
-        // Types from input arguments
-        typedef G                           TGradient;
-        typedef typename G::PixelType       TVector;
-        typedef typename TVector::ValueType TScalar;
-        itkStaticConstMacro( Dimension, unsigned int, G::ImageDimension );
-
-        // Standard itk types
-        typedef GradientFunctionBase                      Self;
-        typedef itk::ImageFunction< G, TScalar, TScalar > Superclass;
-        typedef itk::SmartPointer< Self >                 Pointer;
-        typedef itk::SmartPointer< const Self >           ConstPointer;
-
-        // Types from base itk::ImageFunction
-        typedef typename Superclass::InputType           TInput;
-        typedef typename Superclass::OutputType          TOutput;
-        typedef typename Superclass::PointType           TPoint;
-        typedef typename Superclass::ContinuousIndexType TContIndex;
-        typedef typename Superclass::IndexType           TIndex;
-
-        // Sparse buffer
-        typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer;
-
-      public:
-        itkTypeMacro( GradientFunctionBase, itkImageFunction );
-
-        itkBooleanMacro( BufferResults );
-        itkGetConstMacro( BufferResults, bool );
-        itkSetMacro( BufferResults, bool );
-
-      public:
-        virtual void ResetBuffer( );
-
-        virtual TOutput Evaluate( const TPoint& p ) const;
-        virtual TOutput EvaluateAtIndex( const TIndex& i ) const;
-        virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const;
-
-      protected:
-        GradientFunctionBase( );
-        virtual ~GradientFunctionBase( );
-
-        virtual TOutput _Evaluate( const TIndex& i ) const = 0;
-
-      private:
-        // Purposely not implemented.
-        GradientFunctionBase( const Self& );
-        void operator=( const Self& );
-
-      protected:
-        mutable TBuffer m_Buffer;
-        bool m_BufferResults;
-      };
-
-    } // ecapseman
+    public:
+      // Types from input arguments
+      typedef G                           TGradient;
+      typedef typename G::PixelType       TVector;
+      typedef typename TVector::ValueType TScalar;
+      itkStaticConstMacro( Dimension, unsigned int, G::ImageDimension );
+
+      // Standard itk types
+      typedef GradientFunctionBase                      Self;
+      typedef itk::ImageFunction< G, TScalar, TScalar > Superclass;
+      typedef itk::SmartPointer< Self >                 Pointer;
+      typedef itk::SmartPointer< const Self >           ConstPointer;
+
+      // Types from base itk::ImageFunction
+      typedef typename Superclass::InputType           TInput;
+      typedef typename Superclass::OutputType          TOutput;
+      typedef typename Superclass::PointType           TPoint;
+      typedef typename Superclass::ContinuousIndexType TContIndex;
+      typedef typename Superclass::IndexType           TIndex;
+
+      // Sparse buffer
+      typedef std::map< TIndex, TOutput, typename TIndex::LexicographicCompare > TBuffer;
+
+    public:
+      itkTypeMacro( GradientFunctionBase, itkImageFunction );
+
+      itkBooleanMacro( BufferResults );
+      itkGetConstMacro( BufferResults, bool );
+      itkSetMacro( BufferResults, bool );
+
+    public:
+      virtual void ResetBuffer( );
+
+      virtual TOutput Evaluate( const TPoint& p ) const;
+      virtual TOutput EvaluateAtIndex( const TIndex& i ) const;
+      virtual TOutput EvaluateAtContinuousIndex( const TContIndex& i ) const;
+
+    protected:
+      GradientFunctionBase( );
+      virtual ~GradientFunctionBase( );
+
+      virtual TOutput _Evaluate( const TIndex& i ) const = 0;
+
+    private:
+      // Purposely not implemented.
+      GradientFunctionBase( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      mutable TBuffer m_Buffer;
+      bool m_BufferResults;
+    };
+
+  } // ecapseman
 
 } // ecapseman
 
+#ifndef ITK_MANUAL_INSTANTIATION
 #include <cpExtensions/Algorithms/GradientFunctionBase.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
 
 #endif // __CPEXTENSIONS__ALGORITHMS__GRADIENTFUNCTIONBASE__H__