]> Creatis software - creaMaracasVisu.git/blobdiff - lib/Kernel/VTKObjects/SurfaceRenderer/surfacerenderingimagestencilexport.cxx
#3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7
[creaMaracasVisu.git] / lib / Kernel / VTKObjects / SurfaceRenderer / surfacerenderingimagestencilexport.cxx
index 5b7473843715a932269b3da5b6cd45cdca4a5485..15d7bdb1cdbdda2840ffc356199232dcac428456 100644 (file)
@@ -50,18 +50,29 @@ void SurfaceRenderingImageStencilExport::Update(){
 
 void SurfaceRenderingImageStencilExport::Execute(vtkImageData *data){
 
-    vtkPolyData* polydata = (vtkPolyData*)this->GetInput();
-
     vtkSmartPointer<vtkPolyDataToImageStencil> polytostencil = vtkSmartPointer<vtkPolyDataToImageStencil>::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+    vtkPolyData* polydata = (vtkPolyData*)this->GetInput();
     polytostencil->SetInput(polydata);
+#else
+    vtkPolyData* polydata = (vtkPolyData*)this->GetInput();
+    polytostencil->SetInputData(polydata);
+#endif
     polytostencil->Update();
 
     double *bounds = polydata->GetBounds();
     vtkSmartPointer<vtkImageData> imagein = vtkSmartPointer<vtkImageData>::New();
 
     imagein->SetExtent(bounds[0] - 1, bounds[1] + 1, bounds[2] - 1, bounds[3] + 1, bounds[4] - 1, bounds[5] + 1);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
     imagein->SetScalarTypeToUnsignedShort();    
     imagein->AllocateScalars();
+#else
+    imagein->AllocateScalars(VTK_UNSIGNED_SHORT,1);
+#endif
 
 
     int* extent = imagein->GetExtent();
@@ -76,8 +87,16 @@ void SurfaceRenderingImageStencilExport::Execute(vtkImageData *data){
     }
 
     vtkSmartPointer<vtkImageStencil> stencil = vtkSmartPointer<vtkImageStencil>::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
     stencil->SetInput(imagein);
     stencil->SetStencil(polytostencil->GetOutput());
+#else
+    stencil->SetInputData(imagein);
+    stencil->SetStencilData(polytostencil->GetOutput());
+#endif
+
     stencil->ReverseStencilOn();
     stencil->SetBackgroundValue(128);
     stencil->Update();