From 424e25e36ef1c41b9e3187d5c2e76cc8f8e49cc3 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 22 Jul 2022 15:19:27 +0200 Subject: [PATCH] #3392 vtk9itk5wx3-macos --- cmake/CREAMacro_AddLibrary.cmake | 2 +- cmake/CREAMacro_FindAndUseVTK.cmake | 22 +++++++++++++++------- src/creaVtk.txx | 14 ++++++++++---- src/creawxVTKRenderWindowInteractor.h | 1 + src/creawxVTKRenderWindowInteractor.mm | 21 +++++++++++++-------- 5 files changed, 40 insertions(+), 20 deletions(-) diff --git a/cmake/CREAMacro_AddLibrary.cmake b/cmake/CREAMacro_AddLibrary.cmake index 679b013..504b815 100644 --- a/cmake/CREAMacro_AddLibrary.cmake +++ b/cmake/CREAMacro_AddLibrary.cmake @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé) +# pour la Santé© # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil diff --git a/cmake/CREAMacro_FindAndUseVTK.cmake b/cmake/CREAMacro_FindAndUseVTK.cmake index c60c8f4..9541f57 100644 --- a/cmake/CREAMacro_FindAndUseVTK.cmake +++ b/cmake/CREAMacro_FindAndUseVTK.cmake @@ -30,7 +30,9 @@ MACRO(CREA_FIND_AND_USE_VTK) # Search VTK message("DFCH--VTK: CREAMacro_FindAndUseVTK.cmake: " ${CMAKE_CURRENT_LIST_FILE}) message("DFCH--VTK: CREAMacro_FindAndUseVTK.cmake: " ${_IMPORT_PREFIX}) + FIND_PACKAGE(VTK) + # If vtk found IF(VTK_FOUND) @@ -38,9 +40,12 @@ MACRO(CREA_FIND_AND_USE_VTK) MESSAGE ( STATUS "Looking for VTK... found") MESSAGE ( STATUS "* Dir = ${VTK_DIR}") MESSAGE ( STATUS "* Version = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}") - SET(VTK_BUILD_SETTINGS_FILE OFF) - INCLUDE(${VTK_USE_FILE}) - LINK_DIRECTORIES(${VTK_DIR}) #DFCH -- 16/7/2012 + SET(VTK_BUILD_SETTINGS_FILE OFF) + +## EED 2022-07-21 +## INCLUDE(${VTK_USE_FILE}) +## LINK_DIRECTORIES(${VTK_DIR}) #DFCH -- 16/7/2012 +INCLUDE_DIRECTORIES(include ${VTK_INCLUDE_DIRS} ) IF(VTK_USE_GL2PS) add_definitions(-DUSE_WXGLCANVAS) @@ -204,16 +209,19 @@ ENDIF("${VTK_MAJOR_VERSION}" LESS 6) # vtkRenderingContextOpenGL2 # ) IF (WIN32) - SET(VTK_LIBRARIES ${VTK_LIBRARIES} ) +# SET(VTK_LIBRARIES ${VTK_LIBRARIES} ) ELSE(WIN32) - SET(VTK_LIBRARIES ${VTK_LIBRARIES} +# SET(VTK_LIBRARIES ${VTK_LIBRARIES} # vtkRenderingQt # vtkGUISupportQt # vtkGUISupportQtSQL # vtkViewsQt # vtkNetCDF_cxx - ) - message("EED vtk libraries: "${VTK_LIBRARIES}) +# ) + message("EED-a vtk libraries: "${VTK_LIBRARIES}) + message("EED-start vtk include dirs: "${VTK_INCLUDE_DIRS}) + message("EED-end") + ENDIF(WIN32) diff --git a/src/creaVtk.txx b/src/creaVtk.txx index c83e758..a53111f 100644 --- a/src/creaVtk.txx +++ b/src/creaVtk.txx @@ -26,8 +26,10 @@ */ - -#include +//EED 2022-07-21 +// https://www.slicer.org/wiki/Documentation/Labs/VTK7 +// #include + #include #include #include @@ -105,8 +107,12 @@ namespace crea <::SizedName() <<" non implemented"); } - vtkDataArrayTemplate* tarray - = dynamic_cast*>(array); + +//EED 2022-07-21 +// https://www.slicer.org/wiki/Documentation/Labs/VTK7 +// vtkDataArrayTemplate* tarray = dynamic_cast*>(array); + vtkAOSDataArrayTemplate* tarray = dynamic_cast*>(array); + array->SetNumberOfComponents( 1 ); size_t size = (long)nx*(long)ny*(long)nz; // The last param of SetArray is set to 1 to keep the class from deleting the array diff --git a/src/creawxVTKRenderWindowInteractor.h b/src/creawxVTKRenderWindowInteractor.h index b465e3c..82b463a 100644 --- a/src/creawxVTKRenderWindowInteractor.h +++ b/src/creawxVTKRenderWindowInteractor.h @@ -79,6 +79,7 @@ #include // vtk includes +#include #include "vtkRenderWindowInteractor.h" #include "vtkRenderWindow.h" diff --git a/src/creawxVTKRenderWindowInteractor.mm b/src/creawxVTKRenderWindowInteractor.mm index 6109749..1dab3fa 100644 --- a/src/creawxVTKRenderWindowInteractor.mm +++ b/src/creawxVTKRenderWindowInteractor.mm @@ -53,6 +53,7 @@ # include "vtkVersion.h" #endif + #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0) # include "vtkCommand.h" #else @@ -106,12 +107,16 @@ wxWindow* wxGetTopLevelParent(wxWindow *win) // To access objc calls on cocoa #ifdef __WXCOCOA__ -#ifdef VTK_USE_COCOA -// This trick is no longer need in VTK CVS, should get rid of that: + #define id Id -#else -#error Build mismatch you need both wxWidgets and VTK to be configure against Cocoa to work -#endif //VTK_USE_COCOA + +// #ifdef VTK_USE_COCOA +// // This trick is no longer need in VTK CVS, should get rid of that: +// #define id Id +// #else +// #error Build mismatch you need both wxWidgets and VTK to be configure against Cocoa to work +// #endif //VTK_USE_COCOA + #endif //__WXCOCOA__ #if wxMAJOR_VERSION <= 2 @@ -449,9 +454,9 @@ void wxVTKRenderWindowInteractor::UpdateSize(int x, int y) // and our RenderWindow's size #ifdef __WXCOCOA__ - #ifdef VTK_USE_COCOA - #else - #endif //VTK_USE_COCOA +// #ifdef VTK_USE_COCOA +// #else +// #endif //VTK_USE_COCOA #else RenderWindow->SetSize(x, y); #endif //__WXCOCOA__ -- 2.46.1