Difference between revisions of "Documentation/Labs/Qt5-and-VTK8"
(→Status) |
|||
(260 intermediate revisions by 6 users not shown) | |||
Line 3: | Line 3: | ||
== Overview == | == Overview == | ||
− | Because Qt4 is not actively developed (as documented [http://blog.qt.io/blog/2014/11/27/qt-4-8-x-support-to-be-extended-for-another-year/ here] support ended), we need to work toward supporting Qt5. This page summarizes support status of the various components of Slicer stack and remaining tasks. | + | Because Qt4 is not actively developed (as documented [http://blog.qt.io/blog/2014/11/27/qt-4-8-x-support-to-be-extended-for-another-year/ here] support ended), we need to work toward supporting Qt5. |
+ | |||
+ | Similarly because VTK7 is not actively developed, we need to work toward supporting VTK8 and the OpenGL2 rendering backend. | ||
+ | |||
+ | This page summarizes support status of the various components of Slicer stack and remaining tasks. | ||
+ | |||
+ | === List of fixes integrated into VTK === | ||
+ | |||
+ | * VTK 8 | ||
+ | ** 2017-08: [https://github.com/Kitware/VTK/commit/3b94273 3b94273]: Fix memory leaks in vtkOpenGLRenderer::DonePick() (Max Smolens) | ||
+ | ** 2017-08: [https://github.com/Kitware/VTK/commit/1b9800b 1b9800b]: Fix QVTKOpenGLWidget rendering with disabled interactor (Max Smolens) | ||
+ | ** 2017-08: [https://github.com/Kitware/VTK/commit/056dd9a 056dd9a]: Fix picking when using QVTKOpenGLWidget (Max Smolens) | ||
+ | ** 2017-08: [https://github.com/Kitware/VTK/commit/ee2ea5d ee2ea5d]: was missing object base initialization (Ken Martin, Max Smolens) | ||
+ | ** 2017-07: [https://github.com/Kitware/VTK/commit/e0c60b1 e0c60b1]: QVTKOpenGLWidget: Set screen size on render window (Max Smolens) | ||
+ | ** 2017-07: [https://github.com/Kitware/VTK/commit/8a60be1 8a60be1]: Fix linking libvtkWrapping with Python wrapping and kits enabled on Mac (Max Smolens) | ||
+ | ** 2017-07: [https://github.com/Kitware/VTK/commit/bcce50b bcce50b]: cmake: Fix support for VTK_ENABLE_VTKPYTHON set to OFF (Jean-Christophe Fillion-Robin) | ||
+ | ** 2017-07: [https://github.com/Kitware/VTK/commit/d0aed86 d0aed86]: cmake/vtkCompilerExtras: Remove "--no-undefined" gcc linker flag (Jean-Christophe Fillion-Robin) | ||
+ | ** 2017-06: [https://github.com/Kitware/VTK/commit/5a4ddec 5a4ddec]: Respect access specifier of using statements in wrapping (Max Smolens) | ||
+ | ** 2017-05: [https://github.com/Kitware/VTK/commit/b684733 b684733]: ENH: Allow selection of seed points using vtkSeedWidget (Andras Lasso) | ||
+ | ** 2017-05: [https://github.com/Kitware/VTK/commit/f86a870 f86a870]: Ensure vtkVariant stream associated with << operator is set back to "dec". (Jean-Christophe Fillion-Robin) | ||
+ | ** 2017-05: Support crosspiling emulator | ||
+ | *** 2017-05: [https://github.com/Kitware/VTK/commit/894acce 894acce]: cmake: Import VTKCompileTools if CROSSCOMPILING_EMULATOR support is incomplete (Jean-Christophe Fillion-Robin) | ||
+ | *** 2017-05: [https://github.com/Kitware/VTK/commit/d0f83df d0f83df]: cmake: Simplify buildsystem introducing VTK_COMPILE_TOOLS_IMPORTED (Jean-Christophe Fillion-Robin) | ||
+ | *** 2017-05: [https://github.com/Kitware/VTK/commit/d767f09 d767f09]: cmake: Add support for CMAKE_CROSSCOMPILING_EMULATOR (Jean-Christophe Fillion-Robin) | ||
+ | ** 2017-05: [https://github.com/Kitware/VTK/commit/91ca08b 91ca08b]: OpenGL2: Fix undeclared "glXGetProcAddressARB" when building on Centos5 (Jean-Christophe Fillion-Robin) | ||
+ | ** 2016-12: [https://github.com/Kitware/VTK/commit/a16b2da6 a16b2da6]: MSVC performance improvements. (David C. Lonie) | ||
+ | ** 2016-09: [https://github.com/Kitware/VTK/commit/0ea52cc 0ea52cc]: fix an OpenGL2 issue impacting slicer and add test (Max Smolens) | ||
+ | |||
+ | * VTK 7 | ||
+ | ** 2016-09: [https://github.com/Kitware/VTK/commit/d309ca8 d309ca8]: Consider whether volume transform preserves orientation (Max Smolens) | ||
+ | ** 2016-09: [https://github.com/Kitware/VTK/commit/0cd1a32 0cd1a32]: Fix formatting of VTK_DELETE_FUNCTION (Max Smolens) | ||
+ | ** 2016-08: Volume Rendering: Support large transfer function | ||
+ | *** 2016-08: [https://github.com/Kitware/VTK/commit/ea74f88 ea74f88]: Adjusted LargeColorTf test to add coverage for scale/bias patch. (Alvaro Sanchez) | ||
+ | *** 2016-08: [https://github.com/Kitware/VTK/commit/5d8e8d5 5d8e8d5]: Added texture width checks in opacity and gradientOpacity tables. (Alvaro Sanchez) | ||
+ | *** 2016-08: [https://github.com/Kitware/VTK/commit/ddb5ebc ddb5ebc]: Fixed gl color scale issue. (Alvaro Sanchez) | ||
+ | *** 2016-07: [https://github.com/Kitware/VTK/commit/813462c 813462c]: Added a method in RGBTable to check whether certain tex size is supported. (Alvaro Sanchez) | ||
+ | *** 2015-12: [https://github.com/Kitware/VTK/commit/114bc96 114bc96]: Add test for GPU volume rendering with a large color transfer function. (Max Smolens) | ||
+ | *** 2015-12: [https://github.com/Kitware/VTK/commit/634a33b 634a33b]: vtkOpenGLGPUVolumeRayCastMapper: handle when table size increases (Max Smolens) | ||
+ | *** 2015-12: [https://github.com/Kitware/VTK/commit/608d4fb 608d4fb]: vtkOpenGLGPUVolumeRayCastMapper: remove unnecessary NULL check before delete (Max Smolens) | ||
+ | *** 2015-12: [https://github.com/Kitware/VTK/commit/18b6e57 18b6e57]: vtkOpenGLGPUVolumeRayCastMapper: use existing function to find next power of 2 (Max Smolens) | ||
+ | *** 2015-07: [https://github.com/Kitware/VTK/commit/f0eba00 f0eba00]: GPU raycast volume rendering now supports textures larger than 1024 (Julien Finet) | ||
+ | ** 2016-07: Fix VTK interaction | ||
+ | *** 2016-06: [https://github.com/Kitware/VTK/commit/9ecc055 9ecc055]: Fix variable names in vtkImplicitCylinderWidget test (Max Smolens) | ||
+ | *** 2016-06: [https://github.com/Kitware/VTK/commit/e8170ff e8170ff]: Fix multiple definitions of vtkInteractionCallback (Max Smolens) | ||
+ | ** 2016-06: [https://github.com/Kitware/VTK/commit/7602a0e 7602a0e]: Make vtkCollection implement iterable in the python wrapping (Hastings Greer) | ||
+ | ** 2016-06: [https://github.com/Kitware/VTK/commit/dd87a44 dd87a44]: Allow pyvtkObjects to have InvokeEvent called on them with calldata (Hastings Greer) | ||
+ | ** 2016-06: [https://github.com/Kitware/VTK/commit/a0eb686 a0eb686]: Add #include for offsetof() macro in generated Python wrappers (Max Smolens) | ||
+ | ** 2016-04: [https://github.com/Kitware/VTK/commit/bd63a80 bd63a80]: Handle case when textDims are NULL (Max Smolens) | ||
+ | ** 2016-04: [https://github.com/Kitware/VTK/commit/5dcad97 5dcad97]: vtkTextMapper: fix rendering of empty string (Max Smolens) | ||
+ | ** 2016-04: [https://github.com/Kitware/VTK/commit/e646e65 e646e65]: Fix vtkAxisActor2D documentation error (Max Smolens) | ||
+ | ** 2016-04: [https://github.com/Kitware/VTK/commit/4be6351 4be6351]: vtkLegendScaleActor: add Modified() call after updating points (Max Smolens) | ||
+ | ** 2016-03: [https://github.com/Kitware/VTK/commit/7a24b32 7a24b32]: Change picking manager to not own objects associated with pickers (Max Smolens) | ||
+ | ** 2016-03: Support building python wrapping with VTK_ENABLE_KITS enabled | ||
+ | *** 2016-02: [https://github.com/Kitware/VTK/commit/540f2c5 540f2c5]: python: Add adapter modules when VTK_ENABLE_KITS is ON (Max Smolens) | ||
+ | *** 2016-02: [https://github.com/Kitware/VTK/commit/31b7b0e 31b7b0e]: python: Update wrapping tool to support multiple hierarchy and hint files (Max Smolens) | ||
+ | *** 2016-02: [https://github.com/Kitware/VTK/commit/1ebfa5b 1ebfa5b]: python: Add wrapping of kits when VTK_ENABLE_KITS is ON (Max Smolens) | ||
== Status == | == Status == | ||
− | * | + | To configure Slicer: |
− | https://github.com/ | + | |
+ | <pre> | ||
+ | cmake -DQt5_DIR:PATH=/home/jcfr/Software/Qt5.9.1/5.9.1/gcc_64/lib/cmake/Qt5 ... ../Slicer | ||
+ | </pre> | ||
+ | |||
+ | This will automatically build VTK8 with OpenGL2 backend enabled. | ||
+ | |||
+ | Notes: | ||
+ | * Use VS2015 on windows | ||
+ | |||
+ | === 2018-10-16 === | ||
+ | |||
+ | * Migration has been completed. | ||
+ | |||
+ | === 2017-08-16 === | ||
+ | |||
+ | ==== To Do List ==== | ||
+ | ===== Slicer ===== | ||
+ | |||
+ | * Test with Qt5.9.1: Linux {{done}}, macOS {{done}}, Windows: {{done}} | ||
+ | |||
+ | * <s>Packaging: | ||
+ | ** Update packaging script SlicerCPackBundleFixup.cmake</s> | ||
+ | |||
+ | * Building: | ||
+ | ** Update build script to support qt5 (see https://github.com/jcfr/qt-easy-build ) | ||
+ | ** <s>Update Slicer build instruction on developer wiki</s> | ||
+ | |||
+ | * <s>Fix Slicer test failures: | ||
+ | ** Floating point exceptions ("SIGFPE with code FPE_FLTUND") on Mac (ModelToLabelMapTest, ModelToLabelMapTestLabelValue, N4ITKBiasFieldCorrectionTest). | ||
+ | ** py_LandmarkRegistration crash on exit. | ||
+ | ** py_VolumeRenderingThreeDOnlyLayout on Windows ("Shader object was not initialized, cannot attach it."). This is a similar issue as was fixed in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=25239 r25239], but resurrected due to the behavior of QVTKOpenGLWidget. The old fix is insufficient.</s> | ||
+ | |||
+ | * Application errors reported at https://discourse.slicer.org/t/qt5-build-a-few-hiccups/952 (more information and screenshots are available there) | ||
+ | ** <del>Whenever an item is selected in the Fiducial/ROI/Ruler tool, the items get duplicated to an certain number of items that I didn’t count.</del> Cannot reproduce on 0297723 | ||
+ | ** <s>In Volume Rending module, the items of the ‘View’ combobox are no longer checkable.</s> | ||
+ | ** <s>Switching to module ‘SceneViews’ crashes Slicer: | ||
+ | *** Switch to module: “SceneViews” | ||
+ | *** qSlicerSceneViewsModuleWidgetPrivate::setupUi - Capture link not implemented with Qt5 | ||
+ | *** qSlicerSceneViewsModuleWidgetPrivate::setupUi - Restore scroll bar position not implemented with Qt5 | ||
+ | *** As it says, it has yet to be implemented.</s> | ||
+ | **<s>Styles are broken (cannot select Slicer Dark Style) | ||
+ | **The module name disappear in the module combobox when: | ||
+ | *** Select module | ||
+ | *** Open module selector and do not select anything | ||
+ | *** Name disappears</s> | ||
+ | |||
+ | * <del>Windows: Debug build runs very slowly - can it be improved? Build is very slow too, but the application runs so slowly in debug mode that it is basically unusable (this is a change from previous version that were usable for testing real workflows in debug mode).</del> - fixed in VTK (a16b2da6), Slicer already uses VTK version that includes this | ||
+ | |||
+ | ===== SimpleITK ===== | ||
+ | |||
+ | * <s>SimpleITK doesn't recognize standard CMake way to enable C++11. See https://github.com/SimpleITK/SimpleITK/issues/260.</s> | ||
+ | ** <s>Upstream fix: https://github.com/SimpleITK/SimpleITK/pull/261</s> - Fixed in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26339 r26339] and [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26340 r26340] | ||
+ | |||
+ | ===== VTK ===== | ||
+ | |||
+ | * Transparency is handled differently: see problem in this discussion thread http://vtk.1045678.n5.nabble.com/Strange-renderering-with-mixed-polydata-volume-with-QVTKOpenGLWidget-td5743309.html and a related fix in ITKSnap https://github.com/pyushkevich/itksnap/blob/master/GUI/Qt/main.cxx#L572-L574 and | ||
+ | |||
+ | === 2017-08-14 === | ||
+ | |||
+ | As of 2017-08-14, the support for Qt5 and VTK8 has been integrated into the trunk. | ||
+ | |||
+ | Command line arguments to expose webgl and webengine debugging: | ||
+ | |||
+ | <pre> | ||
+ | ./Slicer-build/Slicer --enable-experimental-web-platform-features --enable-unsafe-es3-apis --remote-debugging-port=12117 --use-gl=desktop | ||
+ | </pre> | ||
+ | |||
+ | ==== To Do List ==== | ||
+ | |||
+ | ===== VTK ===== | ||
+ | |||
+ | * <del>Fix and update VTK: https://gitlab.kitware.com/vtk/vtk/issues/17076 ("OpenGL errors occur when destroying vtkWin32OpenGLRenderWindow") (Only affects old OpenGL backend.)</del>. This is not issue for Slicer. VTK8 based build will use openGL2 backend, and VTK7.1 based build do not have the problem. See https://gitlab.kitware.com/vtk/vtk/issues/17076#note_303185 | ||
+ | * <del>Merge and update VTK: QVTKOpenGLWidget can blit uninitialized framebuffers. On Mac, the bug is evident through visible artifacts when resizing the views.</del> Merged in https://gitlab.kitware.com/vtk/vtk/merge_requests/3138. | ||
+ | |||
+ | ===== Slicer ===== | ||
+ | |||
+ | * Packaging | ||
+ | ** <del>Update packaging scripts (SlicerBlockInstallQt.cmake,</del> SlicerCPackBundleFixup.cmake) | ||
+ | *** <del>Linux</del> {{done}}, macOS {{wip}}, <del>Windows</del>: {{done}} - <del>See https://github.com/jcfr/Slicer/tree/support-qt5-packaging</del> - Integrated in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26289 r26289] | ||
+ | ** Linux: | ||
+ | *** needed to manually copy shared libraries: | ||
+ | **** libasound.so.2 | ||
+ | **** libxslt.so.1 | ||
+ | **** libsmime3 | ||
+ | **** libstdc++.so.6 (glibc mismatch, needed GLIBCXX_3.4.21) should build instead with manylinux | ||
+ | *** <del>like on mac, need to create bin/platfrms and bin/sqldrivers and copy in platforms/libqxcb.so and sqldrivers/libqsqlite.so</del> | ||
+ | ** Mac: | ||
+ | *** <del>Add libqcocoa.dylib and libqsqlite.dylib to package for mac</del> | ||
+ | ***:<pre> | ||
+ | ***::mkdir Slicer-build/bin/Slicer.app/Contents/MacOS/sqldrivers | ||
+ | ***::cp ~/Qt/5.7/clang_64/plugins/sqldrivers/libqsqlite.dylib Slicer-build/bin/Slicer.app/Contents/MacOS/sqldrivers/ | ||
+ | ***::mkdir Slicer-build/bin/Slicer.app/Contents/MacOS/platforms | ||
+ | ***::cp ~/Qt/5.7/clang_64/plugins/platforms/libqcocoa.dylib Slicer-build/bin/Slicer.app/Contents/MacOS/platforms/ | ||
+ | ***:</pre> | ||
+ | |||
+ | |||
+ | * Find and fix layout changes. | ||
+ | ** <del>For example, some widgets likely need to set QSizePolicy::Expanding, such as the exit application confirmation dialog. See https://github.com/commontk/CTK/pull/738</del> - Fixed in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26282 r26282] | ||
+ | * <del>Test branch build with VTK7+OpenGL backend.</del> | ||
+ | |||
+ | |||
+ | * <del>Build shows errors in console at start: Proposed fix in https://github.com/Slicer/Slicer/pull/774</del> - Fixed in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26279 r26279] and [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26280 r26280] | ||
+ | **:<del><pre> | ||
+ | **::Failed to obtain reference to 'FileMenu' | ||
+ | **::Failed to obtain reference to 'qSlicerAppMainWindow' | ||
+ | **::No Data Probe frame - cannot create DataProbe | ||
+ | **::Failed to obtain reference to 'qSlicerAppMainWindow' | ||
+ | **::Failed to obtain reference to 'FileMenu' | ||
+ | **:</pre></del> | ||
+ | |||
+ | * Fix Slicer test failures: | ||
+ | ** <del>qMRMLLayoutManagerWithCustomFactoryTest ("vtkPlaneSource: Bad plane coordinate system"). See https://github.com/Slicer/Slicer/pull/775</del> - Fixed in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26285 r26285] | ||
+ | ** <del>ResampleDTIVolumeBSplineInterpolationTest (image diff?). See https://github.com/Slicer/Slicer/pull/776</del> - Fixed in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26288 r26288] | ||
+ | |||
+ | |||
+ | * <del>Linux/Windows/macOS: fix for `libpng warning: iCCP: known incorrect sRGB profile`</del> - Fixed in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26276 r26276] | ||
+ | |||
+ | |||
+ | ===== CTK ===== | ||
+ | |||
+ | * Fix CTK warnings. See http://slicer.cdash.org/viewBuildError.php?type=1&buildid=1076772 | ||
+ | |||
+ | === 2017-08-07 === | ||
+ | |||
+ | As of 2017-08-07 the relevant branches for testing are: | ||
+ | * <del>Slicer: https://github.com/msmolens/Slicer/tree/support-qt5-2017-08-05-r26208 (includes VTK8)</del> - Integrated in Slicer as [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26268 r26268] | ||
+ | ** <del>old branches</del>: | ||
+ | *** <del>https://github.com/msmolens/Slicer/tree/support-qt5-2017-07-29-r26186</del> | ||
+ | * <del>CTK: https://github.com/msmolens/CTK/tree/wip-support-qvtkopenglwidget</del> - Integrated in CTK as [https://github.com/commontk/CTK/commit/1066374b63b6907797ee14b35196829216fbc3dd commontk/CTK@1066374], integrated in Slicer as [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26224 r26224] | ||
+ | * <del>VTK: https://github.com/Slicer/VTK/tree/slicer-v8.0.0-2017-08-07-88c80af</del> | ||
+ | * <del>DCMTK: https://github.com/msmolens/DCMTK/tree/patched-DCMTK-3.6.2_20170801</del> - Integrated in Slicer as [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26204 r26204] (Branch was also renamed - see https://github.com/commontk/DCMTK/tree/patched-DCMTK-3.6.2_20170714) | ||
+ | * <del>PythonQt: https://github.com/msmolens/PythonQt/tree/msvc-bigobj</del> | ||
+ | * <del>qRestAPI: https://github.com/msmolens/qRestAPI/tree/support-qt-no-ssl-macro</del> - Integrated in Slicer as [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26198 r26198] | ||
+ | * <del>AppLauncher: https://github.com/msmolens/AppLauncher/tree/support-qt5</del> - Integrated in Slicer as [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26217 r26217] | ||
+ | * <del>MultiVolumeExplorer: https://github.com/msmolens/MultiVolumeExplorer/tree/support-qt5</del> | ||
+ | |||
+ | |||
+ | For VS2015 gotchas, see below. | ||
+ | |||
+ | * Qt5/VTK8 integration TODO: | ||
+ | ** <del>Properly initialize QVTKOpenGLWidget. Call QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance so that an OpenGL core profile context is requested.</del> | ||
+ | ** <del>Properly initialize QVTKOpenGLWidget for tests. Call QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance so that an OpenGL core profile context is requested. (Slicer, CTK)</del> | ||
+ | ** Enable C++11 for Slicer, extensions, and libraries as appropriate. | ||
+ | *** <del>BRAINSTools ignores configuration options and fails to configure when C++11 is enabled.</del> | ||
+ | *** <del>DCMTK has a compile error when C++11 is enabled?</del>. (Resolved: requires custom definition to enable C++11.) | ||
+ | *** <del>Slicer</del> | ||
+ | *** <del>Libraries that use C++</del> | ||
+ | *** <del>Extensions</del> | ||
+ | *** <del>Add VTK_OVERRIDE, VTK_FINAL, VTK_DELETE_FUNCTION and other necessary keywords to fix build warnings. Maintain compatibility with VTK7 by defining these as empty when using VTK7.</del> | ||
+ | **** <del>OpenIGTLinkIF</del> Updated in https://github.com/openigtlink/OpenIGTLinkIF/pull/72 | ||
+ | **** <del>MultiVolumeExplorer</del> Updated in https://github.com/fedorov/MultiVolumeExplorer/pull/36. | ||
+ | **** <del>ParameterSerializer</del> Updated in https://github.com/Slicer/ParameterSerializer/pull/7. | ||
+ | **** <del>EMSegment</del> Updated in [http://viewvc.slicer.org/viewvc.cgi/Slicer3?view=revision&revision=17135 r17135]. Integrated in Slicer in [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26228 r26228] | ||
+ | **** <del>OpenIGTLinkIF</del> - Integrated in Slicer as [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26227 r26227] (Changes available in [https://github.com/Slicer/OpenIGTLinkIF Slicer/OpenIGTLinkIF] - Pending PR: <del>[https://github.com/openigtlink/OpenIGTLinkIF/pull/70 #70]</del>, <del>[https://github.com/openigtlink/OpenIGTLinkIF/pull/71 #71]</del>, [https://github.com/openigtlink/OpenIGTLinkIF/pull/72 #72], <del>[https://github.com/openigtlink/OpenIGTLinkIF/pull/73 #73]</del> and [https://github.com/openigtlink/OpenIGTLinkIF/pull/74 #74] | ||
+ | **** SlicerExecutionModel | ||
+ | **** <del>DataStore (see https://github.com/Slicer/Slicer-DataStore/pull/3)</del> - Integrated in Slicer as [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26229 r26229] | ||
+ | *** <del>DCMTK 3.6.2 has a configuration error when C++11 is enabled on Linux. See https://github.com/msmolens/DCMTK/commit/c9ccd45212cb542d78201995951fbcfb416f8b16 for a workaround.</del> - See [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=26204 r26204] and [https://github.com/commontk/DCMTK/tree/patched-DCMTK-3.6.2_20170714 commontk/DCMTK@patched-DCMTK-3.6.2_20170714] - DCMTK team was notified - See [https://github.com/msmolens/DCMTK/commit/c9ccd45212cb542d78201995951fbcfb416f8b16#commitcomment-23474059 here]) | ||
+ | ** <del>Set OpenGL2 as default rendering backend.</del> | ||
+ | ** <del>CTK and Slicer QtTesting tests refer to QVTKWidget. Can they be converted to recognize QVTKOpenGLWidget?</del> | ||
+ | ** <del>Merge and update CTK: https://github.com/commontk/PythonQt/pull/57 ("Fix compile error on MSVC with Qt 5.7.1")</del> | ||
+ | ** <del>Merge and update VTK: https://gitlab.kitware.com/vtk/vtk/merge_requests/3014 ("Fix linking libvtkWrapping with Python wrapping and kits enabled on Mac")</del> | ||
+ | ** <del>Merge and update VTK: https://gitlab.kitware.com/vtk/vtk/merge_requests/3041 ("QVTKOpenGLWidget: Set screen size on render window")</del> | ||
+ | ** <del>Fix and update VTK: https://gitlab.kitware.com/vtk/vtk/issues/17091 ("QVTKOpenGLWidget: Picking vtkActor2D fails"). In Slicer one operation this issue affects is picking slice view ROI box handles.</del> Merged in https://gitlab.kitware.com/vtk/vtk/merge_requests/3103. | ||
+ | ** <del>Merge and update VTK: QVTKOpenGLWidget can blit uninitialized framebuffers. On Mac, the bug is evident through visible artifacts when resizing the views.</del> Merged in https://gitlab.kitware.com/vtk/vtk/merge_requests/3138. | ||
+ | ** <del>Clicking on module search result in popup does not open the module. ComboBox does not always show the selected item.</del> | ||
+ | *** <del>qMRMLColorPickerWidgetTest2 on Mac crashes due to changes in QColorDialog in Qt5. CTK should no longer assume the non-native dialog is constructed, i.e. the layouts exist, when ctkColorDialog is instantiated.</del> | ||
+ | ** <del>Fix CTK Qt5 test failures.</del> | ||
+ | ** OpenSSL/DataStore/qRestAPI issues? | ||
+ | ** <del>CTK needs to properly export CTK_USE_QVTKOPENGLWIDGET so that the preprocessor correctly handles <tt>#if CTK_USE_QVTKOPENGLWIDGET</tt> in its header files. Or, an alternative mechanism could be implemented.</del> | ||
+ | ** <del>Windows/Linux: CPU and GPU Volume Rendering display nothing or are corrupt. GPU Volume Rendering gives OpenGL errors.</del> Disabling multisampling before creating the default surface format fixes this. See https://gitlab.kitware.com/vtk/vtk/issues/17095. | ||
+ | ** <del>Mac: Slice views use only lower-left quarter of widget.</del> | ||
+ | *** <del>Set Qt::AA_EnableHighDpiScaling to enable automatic scaling based on the pixel density of the monitor. This enables High DPI for platforms other than Mac.</del> | ||
+ | *** <del>Call setEnableHiDPI(true) on QVTKOpenGLWidgets.</del> | ||
+ | *** <del>qMRMLSliceWidget: Scale SliceView geometry by its devicePixelRatio() before calling this->SliceController->setSliceViewSize().</del> | ||
+ | *** <del>qMRMLSliceWidget: Observe change in devicePixelRatio (i.e. app dragged to another screen) and recompute slice view size.</del> | ||
+ | ** <del>Volume Rendering transfer functions aren't displayed correctly. (ctkVTKChartView)</del> | ||
+ | ** <del>Fix vtkWindowToImageFilter usage of method deprecated in VTK8.1: https://github.com/Kitware/VTK/blob/b8eae1e022cc71de5dcac578f4087b71d8573324/Rendering/Core/vtkWindowToImageFilter.h#L95</del> | ||
+ | ** <del>Fix Qt deprecation warnings.</del> | ||
+ | ** <del>Address "Policy CMP0020 is not set: Automatically link Qt executables to qtmain target on Windows" warnings.</del> | ||
+ | ** <del>Test branch build with VTK7+OpenGL backend.</del> - Changes integrated into the trunk and tested daily | ||
+ | ** <del>Test branch build with VTK7+OpenGL2 backend.</del> | ||
+ | ** <del>Test branch build with Qt4.</del> | ||
+ | ** Test with Qt5.9.1. | ||
+ | ** <del>Support VS2015 by updating to latest python-cmake-buildsystem. Prerequisite: make pre-compiled OpenSSL available for VS2015/VS2017.</del> | ||
+ | ** <del>Update MultiVolumeExplorer hash for Qt5 support.</del> | ||
+ | |||
+ | * TODOs and Notes for the current integration | ||
+ | ** Make Qt5.7.1 the required version if version greater than Qt5.6; a QWebEngine bug: https://bugreports.qt.io/browse/QTBUG-54762 was resolved in 5.7.1. | ||
+ | ** Windows: | ||
+ | *** Tested build: VS2013, Qt5.7.1 downloaded from Qt's official releases. | ||
+ | *** 2017-08-07: http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1076299 | ||
+ | *** <s>SlicerLauncherSettings.ini need to include path to Qt bin directory. Doing this manually right now </s> | ||
+ | *** VS2015: | ||
+ | **** <del>Configure with <code>-DSlicer_USE_PYTHONQT_WITH_OPENSSL:BOOL=OFF</code></del> | ||
+ | **** <del>Python 2.7: This patch should be applied. See https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/issues/161</del> | ||
+ | **** <del>DCMTK: To fix "DCMTK was configured to use the C++11 STL, [...]" error. Edit <code>C:\path\to\S-bld\DCMTK\CMake\osconfig.h.in</code> and comment lines highlighted in https://github.com/commontk/DCMTK/blob/d8ed091cda2b815226eafe41f5b4fe3bd22f8d5d/CMake/osconfig.h.in#L1096-L1100</del> | ||
+ | ***** To understand why: See https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/ | ||
+ | ***** From Microsoft: <code>We won’t update __cplusplus until the compiler fully conforms to the standard. Until then, you can check the value of _MSVC_LANG.</code> | ||
+ | ***** Or, could change logic in SuperBuild/External_DCMTK.cmake to only enable C++11 for UNIX platforms. | ||
+ | |||
+ | * MacOSX: | ||
+ | ** Tested build: Qt5.7.1 downloaded from Qt's official releases, MacOSX10.11 | ||
+ | ** 2017-08-07: http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1076538 | ||
+ | *** NOTE: WIP qt-easy-build to build Qt5.7.1 with OpenSSL support: https://github.com/msmolens/qt-easy-build/commits/wip-qt5; based on https://github.com/jcfr/qt-easy-build/pull/32 | ||
+ | ** <s> Need to address manual install of the sql and cocoa plugin and platform files for sql and cocoa. </s> | ||
+ | |||
+ | === 2017-08-02 === | ||
+ | |||
+ | * Linux: | ||
+ | ** Tested build: Ubuntu 16.04, gcc, Qt5.7.1 downloaded from Qt's official releases: | ||
+ | ** 2017-08-02: http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1074507 | ||
+ | === 2017-01 === | ||
* Work-in-progress branch that partially builds | * Work-in-progress branch that partially builds | ||
** 2017-01: | ** 2017-01: | ||
*** https://github.com/Slicer/Slicer/pull/648 corresponding to branch https://github.com/Slicer/Slicer/compare/master...jcfr:support-qt5?expand=1 | *** https://github.com/Slicer/Slicer/pull/648 corresponding to branch https://github.com/Slicer/Slicer/compare/master...jcfr:support-qt5?expand=1 | ||
+ | |||
+ | * Original branch: | ||
+ | https://github.com/jcfr/Slicer/commits/support-qt5 | ||
+ | |||
+ | === 2016-12 === | ||
+ | |||
** 2016-12: | ** 2016-12: | ||
*** Slicer: https://github.com/Slicer/Slicer/compare/master...pieper:slicer-qt5?expand=1 | *** Slicer: https://github.com/Slicer/Slicer/compare/master...pieper:slicer-qt5?expand=1 | ||
Line 34: | Line 307: | ||
</pre> | </pre> | ||
− | == Platform Notes == | + | ==== Platform Notes ==== |
Experimental build on Window: | Experimental build on Window: | ||
Line 41: | Line 314: | ||
** Include QtWebEngine and QtScript during install | ** Include QtWebEngine and QtScript during install | ||
** Select 2015 64 bit install | ** Select 2015 64 bit install | ||
+ | * Qt 5.8 | ||
+ | ** Use Visual Studio Community 2015 or above. Qt-5.8 does not support QtWebEngine for msvc 2013. | ||
− | == Known Issues == | + | ==== Known Issues ==== |
* Slice viewers do not have the expected size after changing layout | * Slice viewers do not have the expected size after changing layout | ||
− | == To Do List == | + | ==== To Do List ==== |
− | === All platforms === | + | ===== All platforms ===== |
* Slicer build system upgrade: To be done {{wip}} | * Slicer build system upgrade: To be done {{wip}} | ||
** <s>Add Slicer_QT_VERSION option that could be set to either 4 or 5 - See what is done in CTK</s> {{done}} | ** <s>Add Slicer_QT_VERSION option that could be set to either 4 or 5 - See what is done in CTK</s> {{done}} | ||
− | ** Fix qRestAPI to support Qt5 (or turn off Slicer_BUILD_EXTENSIONMANAGER_SUPPORT for testing) {{ | + | ** <s>Fix qRestAPI to support Qt5 (or turn off Slicer_BUILD_EXTENSIONMANAGER_SUPPORT for testing)</s> {{done}} |
** <s>Update use of QT4_* macros (see below) - See what is done in CTK</s> {{done}} | ** <s>Update use of QT4_* macros (see below) - See what is done in CTK</s> {{done}} | ||
*** <s>The QT5_ versions of the macros appear to be directly compatible</s> {{done}} | *** <s>The QT5_ versions of the macros appear to be directly compatible</s> {{done}} | ||
− | ** [https://wiki.qt.io/Porting_from_QtWebKit_to_QtWebEngine Port from QtWebKit to QtWebEngine] | + | ** <del>[https://wiki.qt.io/Porting_from_QtWebKit_to_QtWebEngine Port from QtWebKit to QtWebEngine] </del> |
− | *** Update of classes using WebKit to work with <code>WebEngineView</code> (these includes "Extension Manager", "Data Store", "Chart View" and `qMRMLExpandingWebView`). | + | *** <del>Update of classes using WebKit to work with <code>WebEngineView</code> (these includes "Extension Manager", "Data Store", "Chart View" and `qMRMLExpandingWebView`).</del> |
*** `qSlicerWebWidget` should be improved, moved to CTK and used for all widgets making use of a web view. | *** `qSlicerWebWidget` should be improved, moved to CTK and used for all widgets making use of a web view. | ||
** <s>update PythonQt to the latest Qt version</s> {{done}} | ** <s>update PythonQt to the latest Qt version</s> {{done}} | ||
− | *** Look at updating PythonQt to support QWebEngine | + | *** <del>Look at updating PythonQt to support QWebEngine</del> |
** <s>Fix [https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5#Plugin_loading differences in plugin loading]</s> {{done}} | ** <s>Fix [https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5#Plugin_loading differences in plugin loading]</s> {{done}} | ||
− | * | + | * <del>Qt5::Network is now a dependency of Base/QTCore (Networking module in Qt5 has classes like QNetworkProxyFactory that were in Qt4's QtCore module)</del> |
− | * | + | * <del>CTK Python wrapping doesn't expose [https://github.com/commontk/CTK/blob/9e6df183277d2516f3522a8ef024450f0bcb5a57/Libs/Widgets/ctkWidgetsUtils.h#L43 grabWidget].</del> |
− | |||
− | + | ===== Linux ===== | |
− | |||
− | |||
− | === Linux === | ||
* fix fox `libpng warning: iCCP: known incorrect sRGB profile` | * fix fox `libpng warning: iCCP: known incorrect sRGB profile` | ||
Line 79: | Line 350: | ||
* like on mac, need to create bin/platfrms and bin/sqldrivers and copy in platforms/libqxcb.so and sqldrivers/libqsqlite.so | * like on mac, need to create bin/platfrms and bin/sqldrivers and copy in platforms/libqxcb.so and sqldrivers/libqsqlite.so | ||
− | === Mac === | + | ===== Mac ===== |
− | ** on Mac, QT_NO_OPENSSL is defined, but so is QSslError leading to redefined symbol [https://github.com/jcfr/Slicer/blob/1d8aa09e4862c6fe48d9f229a11f151d9ed89cea/Base/QTGUI/qSlicerWebWidget.h#L43](here). | + | ** <del>on Mac, QT_NO_OPENSSL is defined, but so is QSslError leading to redefined symbol [https://github.com/jcfr/Slicer/blob/1d8aa09e4862c6fe48d9f229a11f151d9ed89cea/Base/QTGUI/qSlicerWebWidget.h#L43](here).</del> |
− | ** Mac crash in qSlicerUnitsSettingsPanelPrivate::addQuantity, appears to be corrupted model. [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=25855 partly addressed by r25855 ]. Most expedient solution is probably to disable the units settings panel in the application settings since is not widely used in the application. | + | ** <strike>Mac crash in qSlicerUnitsSettingsPanelPrivate::addQuantity, appears to be corrupted model.</strike> [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=25855 partly addressed by r25855 ], finally resolved [https://github.com/Slicer/Slicer/commit/8e5d924dc938ad7f1efb22e13e327383f6347ada r25883]. Most expedient solution is probably to disable the units settings panel in the application settings since is not widely used in the application. |
** Add libqcocoa.dylib and libqsqlite.dylib to package for mac | ** Add libqcocoa.dylib and libqsqlite.dylib to package for mac | ||
<pre> | <pre> | ||
Line 90: | Line 361: | ||
</pre> | </pre> | ||
− | * Workarounds here: | + | * <del>Workarounds here: |
− | https://gist.github.com/pieper/59de820ad08cf3c0f7a33926397e612d | + | https://gist.github.com/pieper/59de820ad08cf3c0f7a33926397e612d </del> |
+ | |||
+ | ===== Windows ===== | ||
− | |||
* <s>qtstyleplugins library needs to be removed or ported to support windows</s> {{done}} | * <s>qtstyleplugins library needs to be removed or ported to support windows</s> {{done}} | ||
− | ** add declspec exports/imports | + | ** <del>add declspec exports/imports</del> |
− | ** create .lib for use in QTGUI | + | ** <del>create .lib for use in QTGUI</del> |
− | ** support shared/static build? | + | ** <del>support shared/static build?</del> |
* AppLauncher settings need to be update | * AppLauncher settings need to be update | ||
− | ** Add to PYTHONPATH: <superbuild>/VTKv7-build/bin/Debug (currently lib not bin) | + | ** <s>Add to PYTHONPATH: <superbuild>/VTKv7-build/bin/Debug (currently lib not bin)</s> {{done}} |
** Add to PATH: <Qt>/5.7/msvc2013_64/bin | ** Add to PATH: <Qt>/5.7/msvc2013_64/bin | ||
* Debug build runs very slowly - can it be improved? Build is very slow too, but the application runs so slowly in debug mode that it is basically unusable (this is a change from previous version that were usable for testing real workflows in debug mode). | * Debug build runs very slowly - can it be improved? Build is very slow too, but the application runs so slowly in debug mode that it is basically unusable (this is a change from previous version that were usable for testing real workflows in debug mode). | ||
+ | * Setting Slicer_USE_SimpleITK to ON in CMake results in compile-time errors. | ||
+ | * <del>Creating a debug build (MSVC 2013, Qt5.7) creates a compile time error on PythonQt.cpp while building the CTK project with message: </del> | ||
+ | ** <del><pre>Error 1220 error C1128: number of sections exceeded object file format limit: compile with /bigobj </pre></del> | ||
− | + | Example starting point command: | |
− | + | <del><pre> | |
− | + | cmake \ | |
− | + | -DQt5_DIR:FILEPATH=c:/Qt/5.7/msvc2013_64/lib/cmake/Qt5 \ | |
− | + | -DCMAKE_CONFIGUREATION_TYPES:STRING=Release \ | |
+ | -DADDITIONAL_C_FLAGS:STRING=" /MP8" \ | ||
+ | -DADDITIONAL_CXX_FLAGS:STRING=" /MP8" \ | ||
+ | -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \ | ||
+ | -DSlicer_USE_SimpleITK:BOOL=OFF \ | ||
+ | -DSlicer_USE_QtTesting:BOOL=OFF \ | ||
+ | -DSlicer_BUILD_EXTENSIONMANAGER_SUPPORT:BOOL=OFF \ | ||
+ | -DSlicer_BUILD_DataStore:BOOL=OFF \ | ||
+ | -DSlicer_QT_VERSION:STRING=5 \ | ||
+ | -DBUILD_TESTING:BOOL=OFF \ | ||
+ | -G"Visual Studio 12 2013 Win64" \ | ||
+ | c:/pieper/slicer4/latest/Slicer | ||
+ | </pre></del> | ||
− | + | {{:Documentation/Nightly/Developers/Tutorials/MigrationGuide/VTK7-Qt4-to-VTK8-Qt5}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== List of extensions that may require updates == | == List of extensions that may require updates == | ||
− | + | See https://discourse.slicer.org/t/slicer-extensions-action-required-by-maintainers/1003 | |
− | |||
− | |||
− | |||
− | |||
== References == | == References == | ||
* Qt 4.8 support schedule info: http://slicer-devel.65872.n3.nabble.com/Fwd-Qt-4-8-x-support-extended-out-by-a-year-td4033248.html | * Qt 4.8 support schedule info: http://slicer-devel.65872.n3.nabble.com/Fwd-Qt-4-8-x-support-extended-out-by-a-year-td4033248.html | ||
* http://blog.qt.io/blog/2014/11/27/qt-4-8-x-support-to-be-extended-for-another-year | * http://blog.qt.io/blog/2014/11/27/qt-4-8-x-support-to-be-extended-for-another-year | ||
+ | * [https://wiki.qt.io/Porting_from_QtWebKit_to_QtWebEngine Port from QtWebKit to QtWebEngine] |
Latest revision as of 15:39, 29 October 2018
Home < Documentation < Labs < Qt5-and-VTK8This page documents the update of Slicer to use Qt 5.
Contents
- 1 Overview
- 2 Status
- 3 Transition from VTK7-Qt4 to VTK8-Qt5
- 3.1 Slicer SuperBuild Extension: Enable C++11 in external projects
- 3.2 Qt5: Update loadable modules to use new plugin macros
- 3.3 Qt5: Update DesignerPlugin to use QtUiPlugin/QDesignerCustomWidgetInterface
- 3.4 Qt5: Update DesignerPlugin to use QtUiPlugin/QDesignerCustomWidgetCollectionInterface
- 3.5 Qt5: any use of QWebKit needs to switch to QWebEngine
- 3.6 Qt5: QVTKOpenGLWidget
- 3.7 Qt5: Fix error: 'class QString' has no member named 'toAscii'
- 3.8 Qt5: Fix error: ‘class QHeaderView’ has no member named ‘setResizeMode’
- 3.9 VTK8: Use hierarchy files for VTK Python wrapping
- 3.10 VTK8: Use of vtkTypeMacro requires to use the correct base class
- 3.11 VTK8: Copy constructor and equal operator should be disabled
- 3.12 VTK8: Call InitializeObjectBase() in vtkObject New() methods
- 3.13 VTK8: Add C++11 keywords
- 3.14 VTK8: vtkWindowToImageFilter::SetMagnification() is deprecated
- 3.15 VTK8: vtkInstantiator is deprecated
- 3.16 VTK 8.2: Signature of vtkFSLookupTable::MapValue updated
- 3.17 Slicer scripted module initialization steps after application startup
- 4 List of extensions that may require updates
- 5 References
Overview
Because Qt4 is not actively developed (as documented here support ended), we need to work toward supporting Qt5.
Similarly because VTK7 is not actively developed, we need to work toward supporting VTK8 and the OpenGL2 rendering backend.
This page summarizes support status of the various components of Slicer stack and remaining tasks.
List of fixes integrated into VTK
- VTK 8
- 2017-08: 3b94273: Fix memory leaks in vtkOpenGLRenderer::DonePick() (Max Smolens)
- 2017-08: 1b9800b: Fix QVTKOpenGLWidget rendering with disabled interactor (Max Smolens)
- 2017-08: 056dd9a: Fix picking when using QVTKOpenGLWidget (Max Smolens)
- 2017-08: ee2ea5d: was missing object base initialization (Ken Martin, Max Smolens)
- 2017-07: e0c60b1: QVTKOpenGLWidget: Set screen size on render window (Max Smolens)
- 2017-07: 8a60be1: Fix linking libvtkWrapping with Python wrapping and kits enabled on Mac (Max Smolens)
- 2017-07: bcce50b: cmake: Fix support for VTK_ENABLE_VTKPYTHON set to OFF (Jean-Christophe Fillion-Robin)
- 2017-07: d0aed86: cmake/vtkCompilerExtras: Remove "--no-undefined" gcc linker flag (Jean-Christophe Fillion-Robin)
- 2017-06: 5a4ddec: Respect access specifier of using statements in wrapping (Max Smolens)
- 2017-05: b684733: ENH: Allow selection of seed points using vtkSeedWidget (Andras Lasso)
- 2017-05: f86a870: Ensure vtkVariant stream associated with << operator is set back to "dec". (Jean-Christophe Fillion-Robin)
- 2017-05: Support crosspiling emulator
- 2017-05: 894acce: cmake: Import VTKCompileTools if CROSSCOMPILING_EMULATOR support is incomplete (Jean-Christophe Fillion-Robin)
- 2017-05: d0f83df: cmake: Simplify buildsystem introducing VTK_COMPILE_TOOLS_IMPORTED (Jean-Christophe Fillion-Robin)
- 2017-05: d767f09: cmake: Add support for CMAKE_CROSSCOMPILING_EMULATOR (Jean-Christophe Fillion-Robin)
- 2017-05: 91ca08b: OpenGL2: Fix undeclared "glXGetProcAddressARB" when building on Centos5 (Jean-Christophe Fillion-Robin)
- 2016-12: a16b2da6: MSVC performance improvements. (David C. Lonie)
- 2016-09: 0ea52cc: fix an OpenGL2 issue impacting slicer and add test (Max Smolens)
- VTK 7
- 2016-09: d309ca8: Consider whether volume transform preserves orientation (Max Smolens)
- 2016-09: 0cd1a32: Fix formatting of VTK_DELETE_FUNCTION (Max Smolens)
- 2016-08: Volume Rendering: Support large transfer function
- 2016-08: ea74f88: Adjusted LargeColorTf test to add coverage for scale/bias patch. (Alvaro Sanchez)
- 2016-08: 5d8e8d5: Added texture width checks in opacity and gradientOpacity tables. (Alvaro Sanchez)
- 2016-08: ddb5ebc: Fixed gl color scale issue. (Alvaro Sanchez)
- 2016-07: 813462c: Added a method in RGBTable to check whether certain tex size is supported. (Alvaro Sanchez)
- 2015-12: 114bc96: Add test for GPU volume rendering with a large color transfer function. (Max Smolens)
- 2015-12: 634a33b: vtkOpenGLGPUVolumeRayCastMapper: handle when table size increases (Max Smolens)
- 2015-12: 608d4fb: vtkOpenGLGPUVolumeRayCastMapper: remove unnecessary NULL check before delete (Max Smolens)
- 2015-12: 18b6e57: vtkOpenGLGPUVolumeRayCastMapper: use existing function to find next power of 2 (Max Smolens)
- 2015-07: f0eba00: GPU raycast volume rendering now supports textures larger than 1024 (Julien Finet)
- 2016-07: Fix VTK interaction
- 2016-06: 7602a0e: Make vtkCollection implement iterable in the python wrapping (Hastings Greer)
- 2016-06: dd87a44: Allow pyvtkObjects to have InvokeEvent called on them with calldata (Hastings Greer)
- 2016-06: a0eb686: Add #include for offsetof() macro in generated Python wrappers (Max Smolens)
- 2016-04: bd63a80: Handle case when textDims are NULL (Max Smolens)
- 2016-04: 5dcad97: vtkTextMapper: fix rendering of empty string (Max Smolens)
- 2016-04: e646e65: Fix vtkAxisActor2D documentation error (Max Smolens)
- 2016-04: 4be6351: vtkLegendScaleActor: add Modified() call after updating points (Max Smolens)
- 2016-03: 7a24b32: Change picking manager to not own objects associated with pickers (Max Smolens)
- 2016-03: Support building python wrapping with VTK_ENABLE_KITS enabled
Status
To configure Slicer:
cmake -DQt5_DIR:PATH=/home/jcfr/Software/Qt5.9.1/5.9.1/gcc_64/lib/cmake/Qt5 ... ../Slicer
This will automatically build VTK8 with OpenGL2 backend enabled.
Notes:
- Use VS2015 on windows
2018-10-16
- Migration has been completed.
2017-08-16
To Do List
Slicer
Packaging:Update packaging script SlicerCPackBundleFixup.cmake
- Building:
- Update build script to support qt5 (see https://github.com/jcfr/qt-easy-build )
Update Slicer build instruction on developer wiki
Fix Slicer test failures:- Floating point exceptions ("SIGFPE with code FPE_FLTUND") on Mac (ModelToLabelMapTest, ModelToLabelMapTestLabelValue, N4ITKBiasFieldCorrectionTest).
- py_LandmarkRegistration crash on exit.
py_VolumeRenderingThreeDOnlyLayout on Windows ("Shader object was not initialized, cannot attach it."). This is a similar issue as was fixed in r25239, but resurrected due to the behavior of QVTKOpenGLWidget. The old fix is insufficient.
- Application errors reported at https://discourse.slicer.org/t/qt5-build-a-few-hiccups/952 (more information and screenshots are available there)
Whenever an item is selected in the Fiducial/ROI/Ruler tool, the items get duplicated to an certain number of items that I didn’t count.Cannot reproduce on 0297723In Volume Rending module, the items of the ‘View’ combobox are no longer checkable.Switching to module ‘SceneViews’ crashes Slicer:- Switch to module: “SceneViews”
- qSlicerSceneViewsModuleWidgetPrivate::setupUi - Capture link not implemented with Qt5
- qSlicerSceneViewsModuleWidgetPrivate::setupUi - Restore scroll bar position not implemented with Qt5
As it says, it has yet to be implemented.
Styles are broken (cannot select Slicer Dark Style)The module name disappear in the module combobox when:- Select module
- Open module selector and do not select anything
Name disappears
Windows: Debug build runs very slowly - can it be improved? Build is very slow too, but the application runs so slowly in debug mode that it is basically unusable (this is a change from previous version that were usable for testing real workflows in debug mode).- fixed in VTK (a16b2da6), Slicer already uses VTK version that includes this
SimpleITK
SimpleITK doesn't recognize standard CMake way to enable C++11. See https://github.com/SimpleITK/SimpleITK/issues/260.Upstream fix: https://github.com/SimpleITK/SimpleITK/pull/261- Fixed in r26339 and r26340
VTK
- Transparency is handled differently: see problem in this discussion thread http://vtk.1045678.n5.nabble.com/Strange-renderering-with-mixed-polydata-volume-with-QVTKOpenGLWidget-td5743309.html and a related fix in ITKSnap https://github.com/pyushkevich/itksnap/blob/master/GUI/Qt/main.cxx#L572-L574 and
2017-08-14
As of 2017-08-14, the support for Qt5 and VTK8 has been integrated into the trunk.
Command line arguments to expose webgl and webengine debugging:
./Slicer-build/Slicer --enable-experimental-web-platform-features --enable-unsafe-es3-apis --remote-debugging-port=12117 --use-gl=desktop
To Do List
VTK
Fix and update VTK: https://gitlab.kitware.com/vtk/vtk/issues/17076 ("OpenGL errors occur when destroying vtkWin32OpenGLRenderWindow") (Only affects old OpenGL backend.). This is not issue for Slicer. VTK8 based build will use openGL2 backend, and VTK7.1 based build do not have the problem. See https://gitlab.kitware.com/vtk/vtk/issues/17076#note_303185Merge and update VTK: QVTKOpenGLWidget can blit uninitialized framebuffers. On Mac, the bug is evident through visible artifacts when resizing the views.Merged in https://gitlab.kitware.com/vtk/vtk/merge_requests/3138.
Slicer
- Packaging
Update packaging scripts (SlicerBlockInstallQt.cmake,SlicerCPackBundleFixup.cmake)Linux, macOS ,Windows: -See https://github.com/jcfr/Slicer/tree/support-qt5-packaging- Integrated in r26289
- Linux:
- needed to manually copy shared libraries:
- libasound.so.2
- libxslt.so.1
- libsmime3
- libstdc++.so.6 (glibc mismatch, needed GLIBCXX_3.4.21) should build instead with manylinux
like on mac, need to create bin/platfrms and bin/sqldrivers and copy in platforms/libqxcb.so and sqldrivers/libqsqlite.so
- needed to manually copy shared libraries:
- Mac:
Add libqcocoa.dylib and libqsqlite.dylib to package for mac- mkdir Slicer-build/bin/Slicer.app/Contents/MacOS/sqldrivers
- cp ~/Qt/5.7/clang_64/plugins/sqldrivers/libqsqlite.dylib Slicer-build/bin/Slicer.app/Contents/MacOS/sqldrivers/
- mkdir Slicer-build/bin/Slicer.app/Contents/MacOS/platforms
- cp ~/Qt/5.7/clang_64/plugins/platforms/libqcocoa.dylib Slicer-build/bin/Slicer.app/Contents/MacOS/platforms/
- Find and fix layout changes.
For example, some widgets likely need to set QSizePolicy::Expanding, such as the exit application confirmation dialog. See https://github.com/commontk/CTK/pull/738- Fixed in r26282
Test branch build with VTK7+OpenGL backend.
Build shows errors in console at start: Proposed fix in https://github.com/Slicer/Slicer/pull/774- Fixed in r26279 and r26280- Failed to obtain reference to 'FileMenu'
- Failed to obtain reference to 'qSlicerAppMainWindow'
- No Data Probe frame - cannot create DataProbe
- Failed to obtain reference to 'qSlicerAppMainWindow'
- Failed to obtain reference to 'FileMenu'
- Fix Slicer test failures:
qMRMLLayoutManagerWithCustomFactoryTest ("vtkPlaneSource: Bad plane coordinate system"). See https://github.com/Slicer/Slicer/pull/775- Fixed in r26285ResampleDTIVolumeBSplineInterpolationTest (image diff?). See https://github.com/Slicer/Slicer/pull/776- Fixed in r26288
Linux/Windows/macOS: fix for `libpng warning: iCCP: known incorrect sRGB profile`- Fixed in r26276
CTK
- Fix CTK warnings. See http://slicer.cdash.org/viewBuildError.php?type=1&buildid=1076772
2017-08-07
As of 2017-08-07 the relevant branches for testing are:
Slicer: https://github.com/msmolens/Slicer/tree/support-qt5-2017-08-05-r26208 (includes VTK8)- Integrated in Slicer as r26268CTK: https://github.com/msmolens/CTK/tree/wip-support-qvtkopenglwidget- Integrated in CTK as commontk/CTK@1066374, integrated in Slicer as r26224VTK: https://github.com/Slicer/VTK/tree/slicer-v8.0.0-2017-08-07-88c80afDCMTK: https://github.com/msmolens/DCMTK/tree/patched-DCMTK-3.6.2_20170801- Integrated in Slicer as r26204 (Branch was also renamed - see https://github.com/commontk/DCMTK/tree/patched-DCMTK-3.6.2_20170714)PythonQt: https://github.com/msmolens/PythonQt/tree/msvc-bigobjqRestAPI: https://github.com/msmolens/qRestAPI/tree/support-qt-no-ssl-macro- Integrated in Slicer as r26198AppLauncher: https://github.com/msmolens/AppLauncher/tree/support-qt5- Integrated in Slicer as r26217MultiVolumeExplorer: https://github.com/msmolens/MultiVolumeExplorer/tree/support-qt5
For VS2015 gotchas, see below.
- Qt5/VTK8 integration TODO:
Properly initialize QVTKOpenGLWidget. Call QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance so that an OpenGL core profile context is requested.Properly initialize QVTKOpenGLWidget for tests. Call QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance so that an OpenGL core profile context is requested. (Slicer, CTK)- Enable C++11 for Slicer, extensions, and libraries as appropriate.
BRAINSTools ignores configuration options and fails to configure when C++11 is enabled.DCMTK has a compile error when C++11 is enabled?. (Resolved: requires custom definition to enable C++11.)SlicerLibraries that use C++ExtensionsAdd VTK_OVERRIDE, VTK_FINAL, VTK_DELETE_FUNCTION and other necessary keywords to fix build warnings. Maintain compatibility with VTK7 by defining these as empty when using VTK7.OpenIGTLinkIFUpdated in https://github.com/openigtlink/OpenIGTLinkIF/pull/72MultiVolumeExplorerUpdated in https://github.com/fedorov/MultiVolumeExplorer/pull/36.ParameterSerializerUpdated in https://github.com/Slicer/ParameterSerializer/pull/7.EMSegmentUpdated in r17135. Integrated in Slicer in r26228OpenIGTLinkIF- Integrated in Slicer as r26227 (Changes available in Slicer/OpenIGTLinkIF - Pending PR:#70,#71, #72,#73and #74- SlicerExecutionModel
DataStore (see https://github.com/Slicer/Slicer-DataStore/pull/3)- Integrated in Slicer as r26229
DCMTK 3.6.2 has a configuration error when C++11 is enabled on Linux. See https://github.com/msmolens/DCMTK/commit/c9ccd45212cb542d78201995951fbcfb416f8b16 for a workaround.- See r26204 and commontk/DCMTK@patched-DCMTK-3.6.2_20170714 - DCMTK team was notified - See here)
Set OpenGL2 as default rendering backend.CTK and Slicer QtTesting tests refer to QVTKWidget. Can they be converted to recognize QVTKOpenGLWidget?Merge and update CTK: https://github.com/commontk/PythonQt/pull/57 ("Fix compile error on MSVC with Qt 5.7.1")Merge and update VTK: https://gitlab.kitware.com/vtk/vtk/merge_requests/3014 ("Fix linking libvtkWrapping with Python wrapping and kits enabled on Mac")Merge and update VTK: https://gitlab.kitware.com/vtk/vtk/merge_requests/3041 ("QVTKOpenGLWidget: Set screen size on render window")Fix and update VTK: https://gitlab.kitware.com/vtk/vtk/issues/17091 ("QVTKOpenGLWidget: Picking vtkActor2D fails"). In Slicer one operation this issue affects is picking slice view ROI box handles.Merged in https://gitlab.kitware.com/vtk/vtk/merge_requests/3103.Merge and update VTK: QVTKOpenGLWidget can blit uninitialized framebuffers. On Mac, the bug is evident through visible artifacts when resizing the views.Merged in https://gitlab.kitware.com/vtk/vtk/merge_requests/3138.Clicking on module search result in popup does not open the module. ComboBox does not always show the selected item.qMRMLColorPickerWidgetTest2 on Mac crashes due to changes in QColorDialog in Qt5. CTK should no longer assume the non-native dialog is constructed, i.e. the layouts exist, when ctkColorDialog is instantiated.
Fix CTK Qt5 test failures.- OpenSSL/DataStore/qRestAPI issues?
CTK needs to properly export CTK_USE_QVTKOPENGLWIDGET so that the preprocessor correctly handles #if CTK_USE_QVTKOPENGLWIDGET in its header files. Or, an alternative mechanism could be implemented.Windows/Linux: CPU and GPU Volume Rendering display nothing or are corrupt. GPU Volume Rendering gives OpenGL errors.Disabling multisampling before creating the default surface format fixes this. See https://gitlab.kitware.com/vtk/vtk/issues/17095.Mac: Slice views use only lower-left quarter of widget.Set Qt::AA_EnableHighDpiScaling to enable automatic scaling based on the pixel density of the monitor. This enables High DPI for platforms other than Mac.Call setEnableHiDPI(true) on QVTKOpenGLWidgets.qMRMLSliceWidget: Scale SliceView geometry by its devicePixelRatio() before calling this->SliceController->setSliceViewSize().qMRMLSliceWidget: Observe change in devicePixelRatio (i.e. app dragged to another screen) and recompute slice view size.
Volume Rendering transfer functions aren't displayed correctly. (ctkVTKChartView)Fix vtkWindowToImageFilter usage of method deprecated in VTK8.1: https://github.com/Kitware/VTK/blob/b8eae1e022cc71de5dcac578f4087b71d8573324/Rendering/Core/vtkWindowToImageFilter.h#L95Fix Qt deprecation warnings.Address "Policy CMP0020 is not set: Automatically link Qt executables to qtmain target on Windows" warnings.Test branch build with VTK7+OpenGL backend.- Changes integrated into the trunk and tested dailyTest branch build with VTK7+OpenGL2 backend.Test branch build with Qt4.- Test with Qt5.9.1.
Support VS2015 by updating to latest python-cmake-buildsystem. Prerequisite: make pre-compiled OpenSSL available for VS2015/VS2017.Update MultiVolumeExplorer hash for Qt5 support.
- TODOs and Notes for the current integration
- Make Qt5.7.1 the required version if version greater than Qt5.6; a QWebEngine bug: https://bugreports.qt.io/browse/QTBUG-54762 was resolved in 5.7.1.
- Windows:
- Tested build: VS2013, Qt5.7.1 downloaded from Qt's official releases.
- 2017-08-07: http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1076299
SlicerLauncherSettings.ini need to include path to Qt bin directory. Doing this manually right now- VS2015:
Configure with-DSlicer_USE_PYTHONQT_WITH_OPENSSL:BOOL=OFF
Python 2.7: This patch should be applied. See https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/issues/161DCMTK: To fix "DCMTK was configured to use the C++11 STL, [...]" error. EditC:\path\to\S-bld\DCMTK\CMake\osconfig.h.in
and comment lines highlighted in https://github.com/commontk/DCMTK/blob/d8ed091cda2b815226eafe41f5b4fe3bd22f8d5d/CMake/osconfig.h.in#L1096-L1100- To understand why: See https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/
- From Microsoft:
We won’t update __cplusplus until the compiler fully conforms to the standard. Until then, you can check the value of _MSVC_LANG.
- Or, could change logic in SuperBuild/External_DCMTK.cmake to only enable C++11 for UNIX platforms.
- MacOSX:
- Tested build: Qt5.7.1 downloaded from Qt's official releases, MacOSX10.11
- 2017-08-07: http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1076538
- NOTE: WIP qt-easy-build to build Qt5.7.1 with OpenSSL support: https://github.com/msmolens/qt-easy-build/commits/wip-qt5; based on https://github.com/jcfr/qt-easy-build/pull/32
Need to address manual install of the sql and cocoa plugin and platform files for sql and cocoa.
2017-08-02
- Linux:
- Tested build: Ubuntu 16.04, gcc, Qt5.7.1 downloaded from Qt's official releases:
- 2017-08-02: http://slicer.cdash.org/viewTest.php?onlyfailed&buildid=1074507
2017-01
- Work-in-progress branch that partially builds
- 2017-01:
- Original branch:
https://github.com/jcfr/Slicer/commits/support-qt5
2016-12
- Superbuild configure command on mac using Qt 5.7 stock downloads
cmake \ -DQT_QMAKE_EXECUTABLE:FILEPATH=/Users/pieper/Qt/5.7/clang_64/bin/qmake \ -DCMAKE_PREFIX_PATH:PATH=/Users/pieper/Qt/5.7/clang_64/ \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 \ -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \ -DSlicer_USE_SimpleITK:BOOL=OFF \ -DSlicer_USE_QtTesting:BOOL=OFF \ -DSlicer_BUILD_EXTENSIONMANAGER_SUPPORT:BOOL=OFF \ -DSlicer_QT_VERSION:STRING=5 \ ../Slicer
Platform Notes
Experimental build on Window:
- Visual Studio Community 2015
- Qt 5.7
- Include QtWebEngine and QtScript during install
- Select 2015 64 bit install
- Qt 5.8
- Use Visual Studio Community 2015 or above. Qt-5.8 does not support QtWebEngine for msvc 2013.
Known Issues
- Slice viewers do not have the expected size after changing layout
To Do List
All platforms
- Slicer build system upgrade: To be done
Add Slicer_QT_VERSION option that could be set to either 4 or 5 - See what is done in CTKFix qRestAPI to support Qt5 (or turn off Slicer_BUILD_EXTENSIONMANAGER_SUPPORT for testing)Update use of QT4_* macros (see below) - See what is done in CTKPort from QtWebKit to QtWebEngineUpdate of classes using WebKit to work withWebEngineView
(these includes "Extension Manager", "Data Store", "Chart View" and `qMRMLExpandingWebView`).- `qSlicerWebWidget` should be improved, moved to CTK and used for all widgets making use of a web view.
update PythonQt to the latest Qt versionLook at updating PythonQt to support QWebEngine
Fix differences in plugin loading
Qt5::Network is now a dependency of Base/QTCore (Networking module in Qt5 has classes like QNetworkProxyFactory that were in Qt4's QtCore module)CTK Python wrapping doesn't expose grabWidget.
Linux
- fix fox `libpng warning: iCCP: known incorrect sRGB profile`
Minimal working release experimental build (no cli, ssl, simpleitk, ...) built on ubuntu 16.04, tested on debian 8
- needed to manually copy shared libraries:
- libasound.so.2
- libxslt.so.1
- libsmime3
- libstdc++.so.6 (glibc mismatch, needed GLIBCXX_3.4.21) should build instead with manylinux
- like on mac, need to create bin/platfrms and bin/sqldrivers and copy in platforms/libqxcb.so and sqldrivers/libqsqlite.so
Mac
on Mac, QT_NO_OPENSSL is defined, but so is QSslError leading to redefined symbol [1](here).Mac crash in qSlicerUnitsSettingsPanelPrivate::addQuantity, appears to be corrupted model.partly addressed by r25855 , finally resolved r25883. Most expedient solution is probably to disable the units settings panel in the application settings since is not widely used in the application.- Add libqcocoa.dylib and libqsqlite.dylib to package for mac
mkdir Slicer-build/bin/Slicer.app/Contents/MacOS/sqldrivers cp ~/Qt/5.7/clang_64/plugins/sqldrivers/libqsqlite.dylib Slicer-build/bin/Slicer.app/Contents/MacOS/sqldrivers/ mkdir Slicer-build/bin/Slicer.app/Contents/MacOS/platforms cp ~/Qt/5.7/clang_64/plugins/platforms/libqcocoa.dylib Slicer-build/bin/Slicer.app/Contents/MacOS/platforms/
Workarounds here:
https://gist.github.com/pieper/59de820ad08cf3c0f7a33926397e612d
Windows
qtstyleplugins library needs to be removed or ported to support windowsadd declspec exports/importscreate .lib for use in QTGUIsupport shared/static build?
- AppLauncher settings need to be update
- Debug build runs very slowly - can it be improved? Build is very slow too, but the application runs so slowly in debug mode that it is basically unusable (this is a change from previous version that were usable for testing real workflows in debug mode).
- Setting Slicer_USE_SimpleITK to ON in CMake results in compile-time errors.
Creating a debug build (MSVC 2013, Qt5.7) creates a compile time error on PythonQt.cpp while building the CTK project with message:Error 1220 error C1128: number of sections exceeded object file format limit: compile with /bigobj
Example starting point command:
cmake \ -DQt5_DIR:FILEPATH=c:/Qt/5.7/msvc2013_64/lib/cmake/Qt5 \ -DCMAKE_CONFIGUREATION_TYPES:STRING=Release \ -DADDITIONAL_C_FLAGS:STRING=" /MP8" \ -DADDITIONAL_CXX_FLAGS:STRING=" /MP8" \ -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \ -DSlicer_USE_SimpleITK:BOOL=OFF \ -DSlicer_USE_QtTesting:BOOL=OFF \ -DSlicer_BUILD_EXTENSIONMANAGER_SUPPORT:BOOL=OFF \ -DSlicer_BUILD_DataStore:BOOL=OFF \ -DSlicer_QT_VERSION:STRING=5 \ -DBUILD_TESTING:BOOL=OFF \ -G"Visual Studio 12 2013 Win64" \ c:/pieper/slicer4/latest/Slicer
Transition from VTK7-Qt4 to VTK8-Qt5
This section lists categories of code changes necessary to build and run Slicer with VTK 8.0 and Qt5. Each category has a short description, a suggested upgrade path, and references to relevant commits (TBD once merged).
Slicer SuperBuild Extension: Enable C++11 in external projects
SuperBuild extensions may have to enable C++11 for their external projects. Add the following lines to CMAKE_CACHE_ARGS in ExternalProject_Add
-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED} -DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS}
Suggested commit message:
COMP: Enable C++11 in external projects See https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide/VTK7-Qt4-to-VTK8-Qt5#Slicer_SuperBuild_Extension:_Enable_C.2B.2B11_in_external_projects
Error message similar to:
/path/to/Slicer-build/ITKv4-build/Modules/Core/Common/itkConfigure.h:59:6: warning: #warning "WARNING: The current project is configured to use a C++ standard version older than the C++ standard used for this build of ITK" [-Wcpp] #warning "WARNING: The current project is configured to use a C++ standard version older than the C++ standard used for this build of ITK" ^
Qt5: Update loadable modules to use new plugin macros
In Qt5, the Q_EXPORT_PLUGIN
, Q_EXPORT_PLUGIN2
macros have been deprecated in favor of the new Q_PLUGIN_METADATA
macro.
Error message similar to:
error: static assertion failed: Old plugin system used
Suggested commit message:
COMP: Qt5: Fix error: static assertion failed: Old plugin system used See https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide/VTK7-Qt4-to-VTK8-Qt5#Qt5:_Update_loadable_modules_to_use_new_plugin_macros
Solution (part 1):
In qSlicer<NameOfModule>Module.h, replace lines like:
Q_OBJECT Q_INTERFACES(qSlicerLoadableModule);
with:
Q_OBJECT #ifdef Slicer_HAVE_QT5 Q_PLUGIN_METADATA(IID "org.slicer.modules.loadable.qSlicerLoadableModule/1.0"); #endif Q_INTERFACES(qSlicerLoadableModule);
Solution (part 2):
In qSlicer<NameOfModule>Module.cxx, Replace lines like:
Q_EXPORT_PLUGIN2(qSlicer<NameOfModule>Module, qSlicer<NameOfModule>Module);
with:
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #include <QtPlugin> Q_EXPORT_PLUGIN2(qSlicer<NameOfModule>Module, qSlicer<NameOfModule>Module); #endif
References:
Qt5: Update DesignerPlugin to use QtUiPlugin/QDesignerCustomWidgetInterface
In Qt5, the QtDesigner/QDesignerCustomWidgetInterface
header have been deprecated in favor of the new QtUiPlugin/QDesignerCustomWidgetInterface
header.
Error message similar to:
/path/to/include/QtDesigner/QDesignerCustomWidgetInterface:4:4: warning: #warning Header <QtDesigner/QDesignerCustomWidgetInterface> is deprecated. Please include <QtUiPlugin/QDesignerCustomWidgetInterface> instead. [-Wcpp] # warning Header <QtDesigner/QDesignerCustomWidgetInterface> is deprecated. Please include <QtUiPlugin/QDesignerCustomWidgetInterface> instead. ^
Suggested commit message:
COMP: Update designer plugin to support Qt5 See https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MigrationGuide/VTK7-Qt4-to-VTK8-Qt5#Qt5:_Update_DesignerPlugin_to_use_QtUiPlugin.2FQDesignerCustomWidgetInterface
Solution (part 1):
In Widgets/DesignerPlugins/qSlicer<NameOfModule>ModuleWidgetsAbstractPlugin.h, replace lines like:
#include <QDesignerCustomWidgetInterface>
with:
#include <QtGlobal> #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) #include <QDesignerCustomWidgetInterface> #else #include <QtUiPlugin/QDesignerCustomWidgetInterface> #endif
Solution (part 2):
In Widgets/DesignerPlugins/qSlicer<NameOfModule>ModuleWidgetsAbstractPlugin.h, replace lines like:
Q_INTERFACES(QDesignerCustomWidgetInterface);
with:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface") #endif Q_INTERFACES(QDesignerCustomWidgetInterface);
Qt5: Update DesignerPlugin to use QtUiPlugin/QDesignerCustomWidgetCollectionInterface
Error message similar to:
/path/to/5.9.1/gcc_64/include/QtDesigner/QDesignerCustomWidgetCollectionInterface:4:4: warning: #warning Header <QtDesigner/QDesignerCustomWidgetCollectionInterface> is deprecated. Please include <QtUiPlugin/QDesignerCustomWidgetCollectionInterface> instead. [-Wcpp] # warning Header <QtDesigner/QDesignerCustomWidgetCollectionInterface> is deprecated. Please include <QtUiPlugin/QDesignerCustomWidgetCollectionInterface> instead. ^
Solution (part 1):
In Widgets/DesignerPlugins/qSlicer<NameOfModule>ModuleWidgetsPlugin.h, replace lines like:
#include <QDesignerCustomWidgetCollectionInterface>
with:
#include "vtkSlicerConfigure.h" // For Slicer_HAVE_QT5 // Qt includes #ifdef Slicer_HAVE_QT5 #include <QtUiPlugin/QDesignerCustomWidgetCollectionInterface> #else #include <QDesignerCustomWidgetCollectionInterface> #endif
Solution (part 2):
In Widgets/DesignerPlugins/qSlicer<NameOfModule>ModuleWidgetsPlugin.h, replace lines like:
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface);
with:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface") #endif Q_INTERFACES(QDesignerCustomWidgetCollectionInterface);
Qt5: any use of QWebKit needs to switch to QWebEngine
TBD
Qt5: QVTKOpenGLWidget
When using Qt5, QVTKOpenGLWidget should be used in place of QVTKGLWidget.
To ensure that QVTKOpenGLWidget receives a properly configured OpenGL context it's necessary to call QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance. QVTKOpenGLWidget::defaultFormat() supplies a suitable format, although it's recommended to disable multisampling for full compatibility with advanced rendering techniques. See http://doc.qt.io/qt-5/qopenglwidget.html.
Error message similar to:
error: no matching function for call to ‘QVTKWidget::QVTKWidget(QWidget*&)’ scalarsToColorsView = new QVTKWidget(ctkVTKDiscretizableColorTransferWidget); ^
Solution (part 1):
In NameOfClass.h file, replace lines like:
#include <QVTKWidget.h>
with:
#if CTK_USE_QVTKOPENGLWIDGET #include <QVTKOpenGLWidget.h> #else #include <QVTKWidget.h> #endif
Solution (part 2):
In NameOfClass.h file, replace lines like:
QVTKWidget* View;
with:
#if CTK_USE_QVTKOPENGLWIDGET QVTKOpenGLWidget* View; #else QVTKWidget* View; #endif
Solution (part 3):
In NameOfClass.cpp file, replace lines like:
this->View = new QVTKWidget;
with:
#if CTK_USE_QVTKOPENGLWIDGET this->View = new QVTKOpenGLWidget; #else this->View = new QVTKWidget; #endif
Qt5: Fix error: 'class QString' has no member named 'toAscii'
Replace call to toAscii().data()
with toLatin1().data()
References:
Qt5: Fix error: ‘class QHeaderView’ has no member named ‘setResizeMode’
Error message similar to:
error: ‘class QHeaderView’ has no member named ‘setResizeMode’ headerView->setResizeMode(FileColumn, QHeaderView::Stretch);
Solution:
Replace lines like:
headerView->setResizeMode(FileColumn, QHeaderView::Stretch);
with:
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) headerView->setResizeMode(FileColumn, QHeaderView::Stretch); #else headerView->setSectionResizeMode(FileColumn, QHeaderView::Stretch); #endif
Solution for Python:
from packaging import version ... def _setSectionResizeMode(header, *args, **kwargs): """ To be compatible with Qt4 and Qt5 """ if version.parse(qt.Qt.qVersion()) < version.parse("5.0.0"): header.setResizeMode(*args, **kwargs) else: header.setSectionResizeMode(*args, **kwargs) ... _setSectionResizeMode(horizontalHeader, 1, qt.QHeaderView.ResizeToContents)
VTK8: Use hierarchy files for VTK Python wrapping
In VTK8 it's necessary to generate hierarchy files for proper wrapping VTK classes in Python. Without the information provided by the hierarchy files, the Python wrapping tool lacks complete information about classes and types. In this case, the generated classes contain methods that shouldn't be wrapped and fail to compile, and include references to types such as vtkTypeBool. Once the hierarchy files are generated and provided to the Python wrapping tool, the generated classes compile and typedefs like vtkTypeBool are correctly resolved.
Once the VTK8 changes are merged, generating hierarchy files is handled by https://github.com/Slicer/Slicer/blob/master/CMake/vtkMacroKitPythonWrap.cmake.
References:
VTK8: Use of vtkTypeMacro requires to use the correct base class
Error message similar to:
error: expected unqualified-id before 'protected'
This error is usually a symptom of an incorrect base class when using vtkTypeMacro.
Solution:
Assuming the class vtkIGTLToMRMLPoint derives from vtkIGTLToMRMLBase,
Replace lines like:
vtkTypeMacro(vtkIGTLToMRMLPoint,vtkObject);
with:
vtkTypeMacro(vtkIGTLToMRMLPoint,vtkIGTLToMRMLBase);
References:
VTK8: Copy constructor and equal operator should be disabled
Error message similar to:
error: use of deleted function 'vtkMyClass::vtkMyClass(const vtkMyClass&)'
This error is usually a symptom of not disabling the copy constructor and equal operator.
Solution:
Replace lines like:
protected: vtkMyClass(); ~vtkMyClass();
with:
protected: vtkMyClass(); ~vtkMyClass(); vtkMyClass(const vtkMyClass&); void operator=(const vtkMyClass&);
VTK8: Call InitializeObjectBase() in vtkObject New() methods
In VTK8 it's necessary for vtkObject New() methods to call InitializeObjectBase() on the new object for proper tracking with vtkDebugLeaks. The standard macros (vtkStandardNewMacro, vtkObjectFactoryNewMacro) handle this. For those classes that don't use the macros, add a call to InitializeObjectBase() immediately after constructing the object by new vtkXXX().
Additionally, vtkObjectFactory::CreateInstance() now doesn't register the class name with vtkDebugLeaks if the factory fails to create the object. Therefore, it's no longer necessary to unregister the class name with vtkDebugLeaks. Remove calls to vtkDebugLeaks::DestructClass(className) following vtkObjectFactory::CreateInstance().
To support both VTK8 and earlier versions of VTK, wrap these changes in preprocessor checks for whether VTK_HAS_INITIALIZE_OBJECT_BASE is defined.
References:
- https://github.com/Kitware/VTK/commit/e5c793dbdf87e838bb2b60c6a5905ced0e5548f9
- http://public.kitware.com/pipermail/vtk-developers/2016-September/034332.html
VTK8: Add C++11 keywords
VTK8 requires C++11. Subclasses of VTK classes must mark overridden methods with VTK_OVERRIDE.
VTK8: vtkWindowToImageFilter::SetMagnification() is deprecated
VTK8.1 deprecated vtkWindowToImageFilter::SetMagnification() and vtkWindowToImageFilter::GetMagnification(). Replace calls to those methods with SetScale() and GetScale(). See https://github.com/Kitware/VTK/commit/af0a95fa7dd4e25ef869a0bc6077e547f18baa29.
VTK8: vtkInstantiator is deprecated
VTK8.1 deprecated vtkInstantiator. See https://github.com/Kitware/VTK/commit/11bb6a4d395e877847355a63de2e2e8f8d9e1d91
Error message similar to:
/path/to/SlicerIGT-Release/ToolWatchdog/MRMLDM/WatchdogInstantiator.cxx:10:1: error: expected constructor, destructor, or type conversion before ‘void’ void WatchdogInstantiator::ClassInitialize() ^ /path/to/SlicerIGT-Release/ToolWatchdog/MRMLDM/WatchdogInstantiator.cxx: In static member function ‘static void WatchdogInstantiator::ClassFinalize()’: /path/to/SlicerIGT-Release/ToolWatchdog/MRMLDM/WatchdogInstantiator.cxx:21:3: error: ‘vtkInstantiator’ has not been declared vtkInstantiator::UnRegisterInstantiator("vtkMRMLWatchdogDisplayableManager", vtkInstantiatorvtkMRMLWatchdogDisplayableManagerNew); ^ /path/to/SlicerIGT-Release/ToolWatchdog/MRMLDM/WatchdogInstantiator.cxx:21:80: error: ‘vtkInstantiatorvtkMRMLWatchdogDisplayableManagerNew’ was not declared in this scope vtkInstantiator::UnRegisterInstantiator("vtkMRMLWatchdogDisplayableManager", vtkInstantiatorvtkMRMLWatchdogDisplayableManagerNew); ^
Solution (part 1):
Update associated CMakeLists.txt replacing lines like:
set(VTK_USE_INSTANTIATOR_NEW 1) if(${VTK_VERSION_MAJOR} GREATER 5) include(${VTK_CMAKE_DIR}/vtkMakeInstantiator.cmake) endif() VTK_MAKE_INSTANTIATOR3("${MODULE_NAME}Instantiator" displayable_manager_instantiator_SRCS "${displayable_manager_SRCS}" "${${KIT}_EXPORT_DIRECTIVE}" ${CMAKE_CURRENT_BINARY_DIR} "${KIT}Export.h" )
with:
SlicerConfigureDisplayableManagerObjectFactory( TARGET_NAME ${KIT} SRCS "${displayable_manager_SRCS}" EXPORT_MACRO "${${KIT}_EXPORT_DIRECTIVE}" EXPORT_HEADER "${KIT}Export.h" OUTPUT_SRCS_VAR displayable_manager_instantiator_SRCS )
Solution (part 2):
Update associated qSlicer<NameOfModule>Module.h (or any test requiring displayable manager) adding lines like:
// DisplayableManager initialization #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkSlicer<NameOfModule>ModuleMRMLDisplayableManager)
Solution (part 2 - maintaining backward compatibility with Slicer 4.8):
#include <vtkSlicerVersionConfigure.h> // For Slicer_VERSION_MAJOR, Slicer_VERSION_MINOR [...] // DisplayableManager initialization #if Slicer_VERSION_MAJOR == 4 && Slicer_VERSION_MINOR >= 9 #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkSlicer<NameOfModule>ModuleMRMLDisplayableManager) #endif
For example, see https://github.com/SlicerIGT/SlicerIGT/pull/155/commits/2f866ea8872435b9a3a7382dd0549231da00406f
VTK 8.2: Signature of vtkFSLookupTable::MapValue updated
The signature of the function was updated in Kitware/VTK@43f6ee3
Error message similar to:
error: invalid conversion from ‘const unsigned char*’ to ‘unsigned char*’ [-fpermissive]
overriding virtual function return type differs and is not covariant from 'vtkLookupTable::MapValue'
Solution:
Update code to use `const` keyword. For example, see r26708
Slicer scripted module initialization steps after application startup
In Slicer 4.8 and earlier versions, those module initialization steps that required application startup completed, often were called using a singleshot timer, because timer events were only processed after the application startup was completed. In Slicer 4.9, some event processing is performed before the application startup is completed, therefore instead of relying on a timer, the application's startupCompleted() signal must be used.
Replace line like:
qt.QTimer.singleShot(0, self.myAdditionalInitializationSteps)
with:
slicer.app.connect("startupCompleted()", self.myAdditionalInitializationSteps)
List of extensions that may require updates
See https://discourse.slicer.org/t/slicer-extensions-action-required-by-maintainers/1003