Tag Archives: vtk8.0.0

Vs2017 compiles pcl1.8.1 with vtk8.0 and uses qt5.9.5

Package version and download address:

Qt5.9.5 (msvc2017-64)

http://download.qt.io/archive/qt/5.9/5.9.5/qt-opensource-windows-x86-5.9.5.exe

VS2017

Microsoft’s official website

VTK – 8.0.0 https://download.csdn.net/download/u013598629/10683029

Cmake – 3.12.2

https://cmake.org/download/
Local Directory Description:

pcl1.8.1 installation directory

E: \ pcl1.8.1

Qt5.9.5 MSVC – 64 – bit directory

E: \ Qt \ Qt5.9.5\5.9.5 \ msvc2017_64

vtk8.0.0 Extract the directory

E: \ VTK – v8.0.0

vtk8.0.0 build directory

E: \ VTK – v8.0.0 \ build

vtk8.0.0 The install directory

E: \ PCL1.8.1\3 rdparty \ VTK
Cmake Settings:
[1. Set the source directory is the vtk8.0.0 decompression directory ] and generated directory [is the build directory].
2. Click Add Entry,Name is CMAKE_DEBUG_POSTFIX, Type is String, Value is -GD, and click OK. This is to separate the final generated debug from the release version of the lib.

3. Click Configure, select VisualStudio 15 2017 Win64, and click Finish to wait for the configuration to complete.
After some time, the configuration is finished, and a configuration list will appear. Follow these steps to configure it
BUILD options
BUILD_EXAMPLES, build_shared_libs, BUILD_TESTING
Just tick build_shared_libs, and the other two are up to the individual to select, so it’s a lot faster at compile time, so I just tick build_shared_libs.

VTK installation directory
CMAKE_INSTALL_POSTFIX- Set to the vtk8.0.0 install directory described in the local directory above

VTK_Group_Qt

Click Configure and wait for the configuration to finish.
After some time, more configuration options will appear, and then follow the following steps to configure them.
1. Modify Qt5_DIR to E:\Qt\Qt5.9.5\5.9.5\msvc2017_64\lib\cmake\Qt5.
2. Set VKT_QT_VERSION to 5. Click Configure again to continue.

Generate engineering
After the configuration is successful, a Configuring Done prompt appears. Click Generate to build the project. If Generating Done appears, you can click Open Project. VTK. SLN will be opened in VS2017.

First, configure the solution to Debug in VS2017. In Solution Manager, go to ALL_BUILD, right-click, and click Build. Wait for VS to compile. When finished, find Install, click the right mouse button, and click Create
Switch the solution configuration to Release. In Solution Manager, go to ALL_BUILD, right-click, and click Build. Wait for VS to compile. When finished, find Install, click the right mouse button, and click Create.
After the above steps are completed, the compiled file will be placed under the path set by CMAKE_INSTALL_PREFIX.
Then put the QVTKWidgetPlugin.dll in the E:\vtk-v8.0.0\ Build \bin\Release directory
Copy to E:\Qt\Qt5.9.5\5.9.5\msvc2017_64\plugins\designer.
At this point, open the Designer again and you will see the QVTKWidget.

Vtk8.0 compilation process record under vs2017 and qt5.12.1

I want to display point cloud in Qt interface, but the VTK of PCL 1.8.1 lacks qvtkwidgetPlugin.dll, so I need to recompile it.
1. VTK source source
Link: https://pan.baidu.com/s/10kMCNJ-5UiYqRTOvrlrR9A
extraction code: ug7p
2. The build folder is created by yourself in the D:/vtk-v8.0.0 directory

3. Click the Configure button in the lower left corner

After waiting for some time, the following screen appears

The Build option checks the following three

The CMake option CMAKE_INSTALL_PREFIX is set to the following path, which is where a directory structure similar to the VTK that comes with PCL will be generated when you run the install project in the compiled solution
The following is checked in the VTK options

Click Configure again and report the following error when the configuration is complete

The two lines at the red position below are modified as follows:

Then click the Configure button again. Then click the configuration Ungrouped Entries again

Click Configure again, no more errors

Click Generate to Generate the project

Then click the Open Project button to Open the solution with VS2017
Check the environment, currently I have Debug, x64

Then click on the generate ALL_BUILD project, which will last for a long time.
1 error message was found at the end

Some files did not download in time
1> — [download 83% complete]
1> — [download 84% complete]
1> CMake Error at D:/VTK – v8.0.0/CMake/ExternalData CMake: 1005 (the message) :
1 & gt; The Object MD5 = 9 e68ff1b1cc914ed88cd84f6a8235021 not found at:
1 & gt;
1> http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download& checksum=9e68ff1b1cc914ed88cd84f6a8235021& algorithm=MD5 (“HTTP response code said error”)
1> http://www.vtk.org/files/ExternalData/MD5/9e68ff1b1cc914ed88cd84f6a8235021 (” the Timeout was reached “)
1 & gt; Call Stack (most recent call first):
1> D:/VTK – v8.0.0/CMake/ExternalData CMake: 1027 (_ExternalData_download_object)
1 & gt;
1>
D:\vtk-v8.0.0\build\ExternalData\Objects\MD5 :\vtk-v8.0.0\build\ExternalData\Objects\MD5

Here I will upload a copy, and replace the folder MD5 after unzipping
Link: https://pan.baidu.com/s/1GItTKoBPeiil20RXgMwyYg
extraction code: k4tz
It then regenerates into the next ALL_BUILD project
After success, generate only the INSTALL project

Then go to the C disk directory C:\VTK and look at this folder

Similar to the VTK structure that comes with PCL1.8.1. There is a plugins folder, and then replace this folder with the following folder in PCL1.8.1

Since the debug version of VTK shipped with PCL1.8.1 contains the -gd keyword, you can use the following Python script to modify the file name

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:jiugeshao
import os
import sys

filepath= r'C:/VTK/lib'
fileList = os.listdir(filepath)
currentpath = os.getcwd()
os.chdir(filepath)

for fileName in fileList:
    result = "lib" in fileName
    if(result):
      os.rename(fileName,fileName.replace(".lib","-gd.lib"))

os.chdir(currentpath)

The format of the lib name in the modified folder is as follows:

Switch to Release x64 and compile ALL_BUILD. After compiling, remember to compile INSTALL
You can run the example QtVTKRenderWindows project

When running under DEBUG, report an error

Unable to locate program input vtkguisupportqt-8.0. DLL by running error under release

Note the environment variables at this point, since I installed both 32bit and 64bit versions of QT, I added bin and lib to the environment variables.
Also note that these four paths are placed at the top (environment variables can be sorted).

When running QTVTKrenderWindows project in debug mode, the interface can be displayed, but there is an error message in VTKOutputWindow
Either a filename was not specified or the specified directory does not contain any DICOM images.

I upload a DICOM diagram here

I put it under the folder D:\ ct
Link: https://pan.baidu.com/s/1adDaWCQaTwgnLVARf2nQkg
extraction code: h793.
and then open the QtVTKRenderingWindows CXX file, modify the following way

This will show the following interface in both debug and release mode:

After I compiled the debug version and release version of VTK, see Baidu net disk
Link: https://pan.baidu.com/s/199YssGsprlm99zkuI5eM3g
extraction code: 3 ip5