]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/CPRImageFilter.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / Algorithms / CPRImageFilter.h
diff --git a/lib/cpExtensions/Algorithms/CPRImageFilter.h b/lib/cpExtensions/Algorithms/CPRImageFilter.h
new file mode 100644 (file)
index 0000000..ed13da3
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef __cpExtensions__Algorithms__CPRImageFilter__h__
+#define __cpExtensions__Algorithms__CPRImageFilter__h__
+
+#include <vector>
+#include <itkImageToImageFilter.h>
+#include <itkJoinSeriesImageFilter.h>
+#include <cpExtensions/Algorithms/IsoImageSlicer.h>
+
+namespace cpExtensions
+{
+  namespace Algorithms
+  {
+    /**
+     */
+    template< class _TImage, class _TCurve >
+    class CPRImageFilter
+      : public itk::ImageToImageFilter< _TImage, _TImage >
+    {
+    public:
+      typedef CPRImageFilter                              Self;
+      typedef itk::ImageToImageFilter< _TImage, _TImage > Superclass;
+      typedef itk::SmartPointer< Self >                   Pointer;
+      typedef itk::SmartPointer< const Self >             ConstPointer;
+
+      typedef _TImage TImage;
+      typedef _TCurve TCurve;
+      typedef typename TCurve::TScalar TScalar;
+
+      typedef IsoImageSlicer< TImage, TScalar >      TSlicer;
+      typedef typename TSlicer::TInterpolateFunction TInterpolateFunction;
+      typedef typename TSlicer::TSliceImage          TSliceImage;
+
+      typedef itk::JoinSeriesImageFilter< TSliceImage, TImage > TJoinFilter;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( CPRImageFilter, itk::ImageToImageFilter );
+
+      itkGetConstMacro( SliceRadius, double );
+      itkGetObjectMacro( Interpolator, TInterpolateFunction );
+
+      itkSetMacro( SliceRadius, double );
+      itkSetObjectMacro( Interpolator, TInterpolateFunction );
+
+    public:
+      _TCurve* GetCurve( );
+      const _TCurve* GetCurve( ) const;
+      void SetCurve( _TCurve* curve );
+
+    protected:
+      CPRImageFilter( );
+      virtual ~CPRImageFilter( );
+
+      virtual void GenerateOutputInformation( ) cpExtensions_OVERRIDE;
+      virtual void GenerateInputRequestedRegion( ) cpExtensions_OVERRIDE;
+      virtual void GenerateData( ) cpExtensions_OVERRIDE;
+
+    protected:
+      double m_SliceRadius;
+      typename TInterpolateFunction::Pointer m_Interpolator;
+
+      std::vector< typename TSlicer::Pointer > m_Slicers;
+      typename TJoinFilter::Pointer            m_Join;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <cpExtensions/Algorithms/CPRImageFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __cpExtensions__Algorithms__CPRImageFilter__h__
+
+// eof - $RCSfile$