]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/DataObjects/Image.cxx
Windows compilation: 3/3
[cpPlugins.git] / lib / cpPlugins / DataObjects / Image.cxx
index 1d6da8d66fbaf3d962027add9166dab1981edf91..d7e26d4bac75084a5267f6fb2bbfd9feed316e90 100644 (file)
@@ -1,4 +1,5 @@
 #include <cpPlugins/DataObjects/Image.h>
+#include <cpPlugins/DataObjects/Image.hxx>
 
 // -------------------------------------------------------------------------
 void cpPlugins::DataObjects::Image::
@@ -20,9 +21,41 @@ SetITK( itk::LightObject* o )
 void cpPlugins::DataObjects::Image::
 SetVTK( vtkObjectBase* o )
 {
-  this->Superclass::SetVTK( o );
-  std::cerr << "Image: TODO this!!!!" << std::endl;
-  std::exit( 1 );
+  vtkImageData* img = dynamic_cast< vtkImageData* >( o );
+  this->Superclass::SetVTK( img );
+  if( img == NULL )
+  {
+    this->m_ITK = NULL;
+    this->m_ITKvVTK = NULL;
+    this->Modified( );
+    return;
+
+  } // fi
+
+  // Connect both worlds
+  this->_VTK_2_ITK_0< unsigned char >( img );
+  /* TODO
+     switch( img->GetScalarType( ) )
+     {
+     case VTK_CHAR: this->_VTK_2_ITK_0< char >( img ); break;
+     case VTK_SHORT: this->_VTK_2_ITK_0< short >( img ); break;
+     case VTK_INT: this->_VTK_2_ITK_0< int >( img ); break;
+     case VTK_LONG: this->_VTK_2_ITK_0< long >( img ); break;
+     case VTK_UNSIGNED_CHAR: this->_VTK_2_ITK_0< unsigned char >( img ); break;
+     case VTK_UNSIGNED_SHORT: this->_VTK_2_ITK_0< unsigned short >( img ); break;
+     case VTK_UNSIGNED_INT: this->_VTK_2_ITK_0< unsigned int >( img ); break;
+     case VTK_UNSIGNED_LONG: this->_VTK_2_ITK_0< unsigned long >( img ); break;
+     case VTK_FLOAT: this->_VTK_2_ITK_0< float >( img ); break;
+     case VTK_DOUBLE: this->_VTK_2_ITK_0< double >( img ); break;
+     default:
+     {
+     this->m_ITK = NULL;
+     this->m_ITKvVTK = NULL;
+
+     }
+     } // hctiws
+  */
+  this->Modified( );
 }
 
 // -------------------------------------------------------------------------