]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/IsoImageSlicer.h
...
[cpPlugins.git] / lib / cpExtensions / Algorithms / IsoImageSlicer.h
index 9479d343cbea49fcde8e121fa79db02fea1034ab..919043022b208d86348d5795d69ce8a5be8319ef 100644 (file)
@@ -5,6 +5,7 @@
 #ifndef __CPEXTENSIONS__ALGORITHMS__ISOIMAGESLICER__H__
 #define __CPEXTENSIONS__ALGORITHMS__ISOIMAGESLICER__H__
 
+#include <cpExtensions/Config.h>
 #include <itkAffineTransform.h>
 #include <itkExtractImageFilter.h>
 #include <itkImage.h>
 #include <itkVectorInterpolateImageFunction.h>
 
 namespace cpExtensions
+{
+  namespace Algorithms
   {
-    namespace Algorithms
+    /**
+     */
+    template< class R, class I >
+    class BaseImageSlicer
+      : public itk::ImageToImageFilter< typename R::InputImageType, itk::Image< typename R::InputImageType::PixelType, R::ImageDimension - 1 > >
     {
-      /**
-       */
-      template< class R, class I >
-      class BaseImageSlicer
-        : public itk::ImageToImageFilter< typename R::InputImageType, itk::Image< typename R::InputImageType::PixelType, R::ImageDimension - 1 > >
+    public:
+      // Basic types
+      typedef BaseImageSlicer            Self;
+      typedef R                          TSlicer;
+      typedef I                          TInterpolateFunction;
+      typedef typename R::InputImageType TImage;
+      typedef typename I::CoordRepType   TScalar;
+      typedef typename TImage::PixelType TPixel;
+      enum
       {
-      public:
-        // Basic types
-        typedef BaseImageSlicer            Self;
-        typedef R                          TSlicer;
-        typedef I                          TInterpolateFunction;
-        typedef typename R::InputImageType TImage;
-        typedef typename I::CoordRepType   TScalar;
-        typedef typename TImage::PixelType TPixel;
-        enum
-        {
-          Dim      = TImage::ImageDimension,
-          SliceDim = TImage::ImageDimension - 1
-        };
-        typedef itk::Image< TPixel, Self::SliceDim > TSliceImage;
-
-        // itk types
-        typedef itk::ImageToImageFilter< TImage, TSliceImage > Superclass;
-        typedef itk::SmartPointer< Self >                      Pointer;
-        typedef itk::SmartPointer< const Self >                ConstPointer;
-
-        // Internal filters
-        typedef itk::ExtractImageFilter< TImage, TSliceImage > TCollapsor;
-
-        // Various types
-        typedef typename TImage::IndexType   TIndex;
-        typedef typename TImage::RegionType  TRegion;
-        typedef typename TImage::SizeType    TSize;
-        typedef typename TImage::SpacingType TSpacing;
-        typedef typename TSpacing::ValueType TSpacingValue;
-
-        typedef itk::AffineTransform< TScalar, Self::Dim > TTransform;
-        typedef typename TTransform::MatrixType            TMatrix;
-        typedef typename TTransform::OffsetType            TVector;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( BaseImageSlicer, itkImageToImageFilter );
-
-        itkBooleanMacro( SizeFromMaximum );
-        itkBooleanMacro( SizeFromMinimum );
-        itkBooleanMacro( SpacingFromMaximum );
-        itkBooleanMacro( SpacingFromMinimum );
-
-        itkGetConstObjectMacro( Transform, TTransform );
-        itkGetConstMacro( DefaultValue, TPixel );
-        itkGetConstMacro( Size, TVector );
-        itkGetConstMacro( SizeFromMaximum, bool );
-        itkGetConstMacro( SizeFromMinimum, bool );
-        itkGetConstMacro( Spacing, TSpacingValue );
-        itkGetConstMacro( SpacingFromMaximum, bool );
-        itkGetConstMacro( SpacingFromMinimum, bool );
-
-        itkSetObjectMacro( Transform, TTransform );
-        itkSetMacro( Size, TVector );
-        itkSetMacro( DefaultValue, TPixel );
-        itkSetMacro( SizeFromMaximum, bool );
-        itkSetMacro( SizeFromMinimum, bool );
-        itkSetMacro( Spacing, TSpacingValue );
-        itkSetMacro( SpacingFromMaximum, bool );
-        itkSetMacro( SpacingFromMinimum, bool );
-
-      public:
-        virtual unsigned long GetMTime( ) const;
-
-        const TInterpolateFunction* GetInterpolator( ) const;
-        const TMatrix& GetRotation( ) const;
-        const TVector& GetTranslation( ) const;
-
-        void SetInterpolator( TInterpolateFunction* f );
-
-        template< class M >
+        Dim      = TImage::ImageDimension,
+        SliceDim = TImage::ImageDimension - 1
+      };
+      typedef itk::Image< TPixel, Self::SliceDim > TSliceImage;
+
+      // itk types
+      typedef itk::ImageToImageFilter< TImage, TSliceImage > Superclass;
+      typedef itk::SmartPointer< Self >                      Pointer;
+      typedef itk::SmartPointer< const Self >                ConstPointer;
+
+      // Internal filters
+      typedef itk::ExtractImageFilter< TImage, TSliceImage > TCollapsor;
+
+      // Various types
+      typedef typename TImage::IndexType   TIndex;
+      typedef typename TImage::RegionType  TRegion;
+      typedef typename TImage::SizeType    TSize;
+      typedef typename TImage::SpacingType TSpacing;
+      typedef typename TSpacing::ValueType TSpacingValue;
+
+      typedef itk::AffineTransform< TScalar, Self::Dim > TTransform;
+      typedef typename TTransform::MatrixType            TMatrix;
+      typedef typename TTransform::OffsetType            TVector;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( BaseImageSlicer, itkImageToImageFilter );
+
+      itkBooleanMacro( SizeFromMaximum );
+      itkBooleanMacro( SizeFromMinimum );
+      itkBooleanMacro( SpacingFromMaximum );
+      itkBooleanMacro( SpacingFromMinimum );
+
+      itkGetConstObjectMacro( Transform, TTransform );
+      itkGetConstMacro( DefaultValue, TPixel );
+      itkGetConstMacro( Size, TVector );
+      itkGetConstMacro( SizeFromMaximum, bool );
+      itkGetConstMacro( SizeFromMinimum, bool );
+      itkGetConstMacro( Spacing, TSpacingValue );
+      itkGetConstMacro( SpacingFromMaximum, bool );
+      itkGetConstMacro( SpacingFromMinimum, bool );
+
+      itkSetObjectMacro( Transform, TTransform );
+      itkSetMacro( Size, TVector );
+      itkSetMacro( DefaultValue, TPixel );
+      itkSetMacro( SizeFromMaximum, bool );
+      itkSetMacro( SizeFromMinimum, bool );
+      itkSetMacro( Spacing, TSpacingValue );
+      itkSetMacro( SpacingFromMaximum, bool );
+      itkSetMacro( SpacingFromMinimum, bool );
+
+    public:
+      virtual unsigned long GetMTime( ) const cpExtensions_OVERRIDE;
+
+      const TInterpolateFunction* GetInterpolator( ) const;
+      const TMatrix& GetRotation( ) const;
+      const TVector& GetTranslation( ) const;
+
+      void SetInterpolator( TInterpolateFunction* f );
+
+      template< class M >
         void SetRotation( const M& r );
 
-        template< class V >
+      template< class V >
         void SetTranslation( const V& t );
-        void SetSize( TScalar s );
+      void SetSize( TScalar s );
 
-      protected:
-        BaseImageSlicer( );
-        virtual ~BaseImageSlicer( );
+    protected:
+      BaseImageSlicer( );
+      virtual ~BaseImageSlicer( );
 
-        virtual void GenerateOutputInformation( ); // TODO { }
-        virtual void GenerateInputRequestedRegion( );
-        virtual void GenerateData( );
+      virtual void GenerateOutputInformation( ) cpExtensions_OVERRIDE; // TODO { }
+      virtual void GenerateInputRequestedRegion( ) cpExtensions_OVERRIDE;
+      virtual void GenerateData( ) cpExtensions_OVERRIDE;
 
-      private:
-        // Purposely not implemented
-        BaseImageSlicer( const Self& );
-        void operator=( const Self& );
+    private:
+      // Purposely not implemented
+      BaseImageSlicer( const Self& );
+      void operator=( const Self& );
 
-      protected:
-        typename TSlicer::Pointer    m_Slicer;
-        typename TCollapsor::Pointer m_Collapsor;
-        typename TTransform::Pointer m_Transform;
+    protected:
+      typename TSlicer::Pointer    m_Slicer;
+      typename TCollapsor::Pointer m_Collapsor;
+      typename TTransform::Pointer m_Transform;
 
-        TPixel m_DefaultValue;
+      TPixel m_DefaultValue;
 
-        TVector m_Size;
-        bool    m_SizeFromMaximum;
-        bool    m_SizeFromMinimum;
-
-        TSpacingValue m_Spacing;
-        bool          m_SpacingFromMaximum;
-        bool          m_SpacingFromMinimum;
-      };
+      TVector m_Size;
+      bool    m_SizeFromMaximum;
+      bool    m_SizeFromMinimum;
 
-    } // ecapseman
+      TSpacingValue m_Spacing;
+      bool          m_SpacingFromMaximum;
+      bool          m_SpacingFromMinimum;
+    };
 
   } // ecapseman
 
@@ -158,28 +157,28 @@ namespace cpExtensions
     void operator=( const Self& );                                      \
   };
 
-namespace cpPlugins
+namespace cpExtensions
 {
-  namespace Extensions
+  namespace Algorithms
   {
-    namespace Algorithms
-    {
-      CPPLUGINS_DEFINE_ISOIMAGESLICER(
-        IsoImageSlicer,
-        itk::ResampleImageFilter,
-        itk::InterpolateImageFunction
-        );
-      CPPLUGINS_DEFINE_ISOIMAGESLICER(
-        VectorIsoImageSlicer,
-        itk::VectorResampleImageFilter,
-        itk::VectorInterpolateImageFunction
-        );
-
-    } // ecapseman
+    CPPLUGINS_DEFINE_ISOIMAGESLICER(
+      IsoImageSlicer,
+      itk::ResampleImageFilter,
+      itk::InterpolateImageFunction
+      );
+    CPPLUGINS_DEFINE_ISOIMAGESLICER(
+      VectorIsoImageSlicer,
+      itk::VectorResampleImageFilter,
+      itk::VectorInterpolateImageFunction
+      );
+
+  } // ecapseman
 
 } // ecapseman
 
-#include <cpExtensions/Algorithms/IsoImageSlicer.hxx>
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <cpExtensions/Algorithms/IsoImageSlicer.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
 
 #endif // __CPEXTENSIONS__ALGORITHMS__ISOIMAGESLICER__H__