]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Image.cxx
Code cleaning
[cpPlugins.git] / lib / cpPlugins / Image.cxx
diff --git a/lib/cpPlugins/Image.cxx b/lib/cpPlugins/Image.cxx
new file mode 100644 (file)
index 0000000..994e643
--- /dev/null
@@ -0,0 +1,66 @@
+#include <cpPlugins/Image.h>
+
+#include <vtkImageActor.h>
+#include <vtkImageProperty.h>
+#include <vtkImageSliceMapper.h>
+
+// -------------------------------------------------------------------------
+void cpPlugins::Image::
+SetITK( itk::LightObject* o )
+{
+  this->Superclass::SetITK( o );
+  bool     s = this->_ITK_2_VTK_0_Scalar< 2 >( o );
+  if( !s ) s = this->_ITK_2_VTK_0_Scalar< 3 >( o );
+  if( !s ) s = this->_ITK_2_VTK_0_Color< 2 >( o );
+  if( !s ) s = this->_ITK_2_VTK_0_Color< 3 >( o );
+  if( !s )
+  {
+    this->m_VTKObject = NULL;
+    this->m_ITKvVTK = NULL;
+
+  } // fi
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Image::
+SetVTK( vtkObjectBase* o )
+{
+  this->Superclass::SetVTK( o );
+  std::cerr << "Image: TODO this!!!!" << std::endl;
+  std::exit( 1 );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Image::
+Image( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Image::
+~Image( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Image::
+_CreateVTKActor( ) const
+{
+  vtkImageData* image =
+    const_cast< vtkImageData* >( this->GetVTK< vtkImageData >( ) );
+  if( image != NULL )
+  {
+    vtkImageSliceMapper* mapper = vtkImageSliceMapper::New( );
+    vtkImageActor* actor = vtkImageActor::New( );
+    mapper->SetInputData( image );
+    actor->SetMapper( mapper );
+    actor->GetProperty( )->SetInterpolationTypeToNearest( );
+    this->m_Actor = actor;
+    mapper->Delete( );
+
+  } // fi
+}
+
+// eof - $RCSfile$