]> Creatis software - crea.git/commitdiff
#3106 crea Bug New Normal - branch vtk7itk4 compilation with vtk7
authorEduardo DAVILA <davila@localhost.localdomain>
Thu, 20 Jul 2017 10:05:33 +0000 (12:05 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Thu, 20 Jul 2017 10:05:33 +0000 (12:05 +0200)
cmake/CREAMacro_FindAndUseVTK.cmake
src/creaVtk.txx
src/creaVtkBasicSlicer.cxx

index ed9391233af64c0568362047b07b31a0f6f0256f..9ac483ff6a96166cdb061f5b265b318eaf1306d6 100644 (file)
@@ -57,24 +57,48 @@ MACRO(CREA_FIND_AND_USE_VTK)
 
       CREA_DEFINE( USE_VTK )
       CREA_DEFINE( _USE_VTK_ )
-      SET(VTK_LIBRARIES
-       vtkCommon     # Mandatory
-       vtkFiltering  # vtkImageData
-       vtkRendering  # vtkProp3D
-       vtkWidgets    # vtkImagePlaneWidget
-       vtkIO         # vtkMetaImageReader/Writer
-       vtkImaging    # filters such as vtkImageAnisotropicDiffusion3D
-       vtkGraphics   # vtkContourFilter, sources
-       vtkVolumeRendering # Mappers 
-       vtkGenericFiltering
-       vtkHybrid
-#      vtkInfovis
-#      vtkViews
+
+##EED 2017-01-01 Migration VTK7
+IF("${VTK_MAJOR_VERSION}" LESS 6)
+       SET(VTK_LIBRARIES
+               vtkCommon     # Mandatory
+               vtkFiltering  # vtkImageData
+               vtkRendering  # vtkProp3D
+               vtkWidgets    # vtkImagePlaneWidget
+               vtkIO         # vtkMetaImageReader/Writer
+               vtkImaging    # filters such as vtkImageAnisotropicDiffusion3D
+               vtkGraphics   # vtkContourFilter, sources
+               vtkVolumeRendering # Mappers 
+               vtkGenericFiltering
+               vtkHybrid
+#              vtkInfovis
+#              vtkViews
        )
-      IF(NOT USE_ITK)
-       SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO)
-      ENDIF(NOT USE_ITK)
-      MARK_AS_ADVANCED(VTK_DIR)
+       IF(NOT USE_ITK)
+               SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO)
+    ENDIF(NOT USE_ITK)
+
+ENDIF("${VTK_MAJOR_VERSION}" LESS 6)
+
+
+##EED 2017-01-01 Migration VTK7
+IF("${VTK_MAJOR_VERSION}" GREATER 5)
+       SET(VTK_LIBRARIES
+               vtkCommonCore
+               vtkCommonExecutionModel
+               vtkIOImage
+               vtkRenderingCore
+               vtkInteractionStyle
+        vtkImagingCore
+               vtkRenderingFreeType
+               vtkRenderingOpenGL2
+               vtkIOLegacy
+               vtkInteractionImage
+       )
+ENDIF("${VTK_MAJOR_VERSION}" GREATER 5)
+
+
+       MARK_AS_ADVANCED(VTK_DIR)
     ELSE(VTK_FOUND)
       message(FATAL_ERROR "VTK_DIR not found")
     ENDIF(VTK_FOUND)
index b748e67a32987356194b465db25ff014772ea6d9..91c250b19ad9b7931ecf46d0428482764c68a9d6 100644 (file)
@@ -59,13 +59,22 @@ namespace crea
 
     // Shouldn't we pass NumberOfScalarComponents to deal with RGB, RGBA images as well? // JPR
 
-    image->SetNumberOfScalarComponents(1);
 
     int vtktype = vtkTypeTraits<T>::VTKTypeID();
-    image->SetScalarType(vtktype);
     image->SetDimensions(nx, ny ,nz);
     image->SetSpacing(1, 1, 1);
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
+    image->SetNumberOfScalarComponents(1);
+    image->SetScalarType(vtktype);
     image->AllocateScalars();
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+    image->AllocateScalars(vtktype,1);
+#endif
+
+
     vtkDataArray* array = 0;
     switch (vtktype)
       {
index c027da12f98007685df5148b72bee5481142c96b..9a9611653f1857d8ca3cb6d08ef22fbb57a4c35c 100644 (file)
@@ -62,7 +62,14 @@ namespace crea
   // An outline is shown for context.
   
   vtkOutlineFilter* outline = vtkOutlineFilter::New();
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
   outline->SetInput(I);
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+  outline->SetInputData(I);
+#endif
   
   vtkPolyDataMapper* outlineMapper = vtkPolyDataMapper::New();
   outlineMapper->SetInputConnection(outline->GetOutputPort());
@@ -79,7 +86,15 @@ namespace crea
   // The 3 image plane widgets are used to probe the dataset.
   vtkImagePlaneWidget* planeWidgetX = vtkImagePlaneWidget::New();
   planeWidgetX->DisplayTextOn();
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
   planeWidgetX->SetInput(I);
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+  planeWidgetX->SetInputData(I);
+#endif
+
   planeWidgetX->SetPlaneOrientationToXAxes();
   planeWidgetX->SetSlicePosition((xMax+xMin)/2.);
   planeWidgetX->SetPicker(picker);
@@ -89,7 +104,15 @@ namespace crea
 
   vtkImagePlaneWidget* planeWidgetY = vtkImagePlaneWidget::New();
   planeWidgetY->DisplayTextOn();
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
   planeWidgetY->SetInput(I);
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+  planeWidgetY->SetInputData(I);
+#endif
+
   planeWidgetY->SetPlaneOrientationToYAxes();
   planeWidgetY->SetSlicePosition((yMax+yMin)/2.);
   planeWidgetY->SetPicker(picker);