Tag Archives: QT5.12.1

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