]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/SkeletonToImageFilter.h
yet another refactoring
[cpPlugins.git] / lib / cpExtensions / Algorithms / SkeletonToImageFilter.h
diff --git a/lib/cpExtensions/Algorithms/SkeletonToImageFilter.h b/lib/cpExtensions/Algorithms/SkeletonToImageFilter.h
new file mode 100644 (file)
index 0000000..8c9d8fe
--- /dev/null
@@ -0,0 +1,81 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __cpExtensions__Algorithms__SkeletonToImageFilter__h__
+#define __cpExtensions__Algorithms__SkeletonToImageFilter__h__
+
+#include <cpExtensions/Config.h>
+#include <itkImageSource.h>
+
+// -------------------------------------------------------------------------
+namespace cpExtensions
+{
+  namespace Algorithms
+  {
+    /**
+     */
+    template< class _TSkeleton, class _TImage >
+    class SkeletonToImageFilter
+      : public itk::ImageSource< _TImage >
+    {
+    public:
+      // Basic types
+      typedef SkeletonToImageFilter           Self;
+      typedef itk::ImageSource< _TImage >     Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef _TSkeleton TSkeleton;
+      typedef _TImage    TImage;
+      typedef typename _TImage::IndexType  TIndex;
+      typedef typename _TImage::PixelType  TPixel;
+      typedef typename _TImage::PointType  TPoint;
+      typedef typename _TImage::RegionType TRegion;
+      typedef itk::ImageBase< _TImage::ImageDimension > TImageBase;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( SkeletonToImageFilter, itk::ImageSource );
+
+      itkGetConstMacro( InsideValue, TPixel );
+      itkGetConstMacro( OutsideValue, TPixel );
+
+      itkSetMacro( InsideValue, TPixel );
+      itkSetMacro( OutsideValue, TPixel );
+
+    public:
+      const TImageBase* GetTemplateImage( ) const;
+      void SetTemplateImage( const TImageBase* image );
+
+      const TSkeleton* GetSkeleton( ) const;
+      void SetSkeleton( const TSkeleton* skeleton );
+
+    protected:
+      SkeletonToImageFilter( );
+      virtual ~SkeletonToImageFilter( );
+
+      virtual void GenerateData( ) cpExtensions_OVERRIDE;
+
+    private:
+      // Purposely not implemented
+      SkeletonToImageFilter( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      TPixel m_InsideValue;
+      TPixel m_OutsideValue;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+// -------------------------------------------------------------------------
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <cpExtensions/Algorithms/SkeletonToImageFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __cpExtensions__Algorithms__SkeletonToImageFilter__h__
+
+// eof - $RCSfile$