]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Image.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / Image.h
index e6b2b7762708360c5781af9651fe1f6ffc91212d..68367fdf7c9bba0fb9acee81f0f4de8246a0efc7 100644 (file)
@@ -3,44 +3,68 @@
 
 #include <map>
 #include <string>
-#include <itkProcessObject.h>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+#include <cpPlugins/cpPlugins_Export.h>
 #include <cpPlugins/Interface/DataObject.h>
 
+#define ITK_MANUAL_INSTANTIATION
+#include <itkProcessObject.h>
+
 class vtkImageData;
 
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Demangle( p, d, o, f, r )               \
+  if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL )        \
+    r = this->f< itk::Image< p, d > >( o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_Array_Demangle( a, p, da, di, o, f, r )    \
+  if( dynamic_cast< itk::Image< a< p, da >, di >* >( o ) != NULL ) \
+    r = this->f< itk::Image< a< p, da >, di > >( o )
+
+// -------------------------------------------------------------------------
 namespace cpPlugins
 {
   namespace Interface
   {
     /**
      */
-    class cpPlugins_Interface_EXPORT Image
+    class cpPlugins_EXPORT Image
       : public DataObject
     {
     public:
-      typedef Image      Self;
-      typedef DataObject Superclass;
+      typedef Image                           Self;
+      typedef DataObject                      Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
 
     public:
-      Image( );
-      virtual ~Image( );
+      itkNewMacro( Self );
+      itkTypeMacro( Image, DataObject );
 
-      virtual std::string GetClassName( ) const;
-      virtual void SetDataObject( itk::DataObject* dobj );
+    public:
+      virtual void SetITKDataObject( itk::DataObject* o );
+      virtual void SetVTKDataObject( vtkDataObject* o );
 
-      vtkImageData* GetVTKImageData( ) const;
+      virtual vtkImageData* GetVTKImageData( );
+      virtual const vtkImageData* GetVTKImageData( ) const;
 
     protected:
+      Image( );
+      virtual ~Image( );
+
       template< unsigned int D >
-      void _ConnectToVTK_0( );
+        bool _Dim( itk::DataObject* o );
+
+      template< class I >
+        bool _Type( itk::DataObject* o );
 
-      template< class P, unsigned int D >
-      void _ConnectToVTK_1( );
+    private:
+      // Purposely not implemented
+      Image( const Self& );
+      Self& operator=( const Self& );
 
     protected:
-      itk::ProcessObject::Pointer m_Image2VTKImageData;
-      vtkImageData* m_VTKImageData;
+      itk::ProcessObject::Pointer m_ITKvVTKConnection;
     };
 
   } // ecapseman