]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/IsoImageSlicer.h
...
[cpPlugins.git] / lib / cpExtensions / Algorithms / IsoImageSlicer.h
index 9479d343cbea49fcde8e121fa79db02fea1034ab..2582cf9f6400859366a4326c6e2d95bdcf522f68 100644 (file)
 #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;
+
+      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( ); // TODO { }
+      virtual void GenerateInputRequestedRegion( );
+      virtual void GenerateData( );
 
-      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
 
 } // ecapseman
 
+} // ecapseman
+
 // -------------------------------------------------------------------------
 #define CPPLUGINS_DEFINE_ISOIMAGESLICER( name, R, F )                   \
   template< class I, class S = double >                                 \
@@ -177,7 +177,7 @@ namespace cpPlugins
 
     } // ecapseman
 
-} // ecapseman
+  } // ecapseman
 
 #include <cpExtensions/Algorithms/IsoImageSlicer.hxx>