To do a good job, a worker must first sharpen his tools
First of all, we need to prepare the required documents, which are as follows:
(1) cmake, download link cmake download. As for what CMAKE is, I will not introduce it, so a book, want to say it is hard to say. If you look at the suffix,.msi and.zip, you may wonder “what’s the difference?” In my opinion, zip is more convenient than msi.![](https://programmerah.com/wp-content/uploads/2021/02/aec9759c6055d7bd4681b62d88078082.png)
(2) VTK file, divided into Source file and Data file. Download link VTK download link. Click the download link and you will see the picture.
![](https://programmerah.com/wp-content/uploads/2021/02/a57d829fbe1f9e17751b89f3f5d722e1.png)
Download zip files for source and zip files for data. Since I’m using VS here, I don’t need to download Python.
After downloading, it is decompressed. I used to decompress the files extracted from Data into the files extracted from Source. I stressed that I decompressed them separately, that is, decompressed them into two folders.
Two, start compiling
(1) Create a new folder in the folder after source unzipped, habitually named build, this folder is used to put the project related files after cmake.
(2) Open cmake
![](https://programmerah.com/wp-content/uploads/2021/02/affa2851e3df9784aba2e610f3a8b138.png)
The source code bar is the path after unzips the source, and the build bar is the path of the project generated by CMAKE. The bin folder in the picture is not what I said above, so you can change the destination path to the build folder you created.
If you want to create a 64-bit VTK, you need to select the 64-bit VSXuan option. If you want to create a 64-bit VTK, you need to select the 64-bit VSXuan option
(3) Make the file options, the specific meaning of the options I will not say
![](https://programmerah.com/wp-content/uploads/2021/02/3e32119c54040dd629c0d3eaaf4200d6.png)
This is the item that should be checked in Build.
![](https://programmerah.com/wp-content/uploads/2021/02/1def83bd8e4d93d3ee972fea0556a300.png)
This is the cmake group, but watch out for CMAKE_INSTALL_PREFIX. This is a very important one. You’ll notice that most of the blogs don’t talk about it at the moment, but it will make it much easier to use VTK.
Then is the intall road strength configuration, as shown below:
![](https://programmerah.com/wp-content/uploads/2021/02/77f9bb5e25e6b97746d755195226461b.png)
Represent the DLL path, the LIB path, and the VTK header path compiled with VS respectively. You need to set it up by yourself. In the future, you can use VTK just like OpenCV.
![](https://programmerah.com/wp-content/uploads/2021/02/ed04c0bcc73b0ab3c2507934e060ecd5.png)
Because I’m using MFC, check the module_vtkguisupportMFC in the Module. Other options seem to be the default.
(4) Click the Configure button, and when the red color turns to white, click the Generate button to Generate the project.
Note: If there is an error when cmake is checked, it may be because the VS installation path has Chinese. Therefore, it is specially reminded that the installation path in Chinese should not appear.
(5) Finally, click Open ProJeroject to open the generated project in VS. As shown in figure:
![](https://programmerah.com/wp-content/uploads/2021/02/6581159d0e672db150b66c2428d7d9f0.png)
Compile all_build, only install if successful.
While I’m using VS2015, other VSs do the same, I need to remind you that there is one more step you need to take before VS2013 is compiled, and that is to install multiple character sets.
![](https://programmerah.com/wp-content/uploads/2021/02/ee5c08a7cae1c6fdf27e5912e50c0040.png)
The result after successful compilation is shown in the figure below:
![](https://programmerah.com/wp-content/uploads/2021/02/3d22b6d891e32514ef63ff26a90830f4.png)
As for the use, and you are familiar with the use of OpenCV is the same.
Because everyone’s level is different, I don’t know if it’s clear or not. If there is a lack of documents, or what questions can be left in the blog question, we discuss together.
And finally, the aforementioned book:
![](https://programmerah.com/wp-content/uploads/2021/02/635ad65101f5a67f453ead5cdd7c3814.png)
These are books about learning VTK, ITK, and CMAKE. Please leave a comment below if you need any.
First of all, we need to prepare the required documents, which are as follows:
(1) cmake, download link cmake download. As for what CMAKE is, I will not introduce it, so a book, want to say it is hard to say. If you look at the suffix,.msi and.zip, you may wonder “what’s the difference?” In my opinion, zip is more convenient than msi.
![](https://programmerah.com/wp-content/uploads/2021/02/aec9759c6055d7bd4681b62d88078082.png)
(2) VTK file, divided into Source file and Data file. Download link VTK download link. Click the download link and you will see the picture.
![](https://programmerah.com/wp-content/uploads/2021/02/a57d829fbe1f9e17751b89f3f5d722e1.png)
Download zip files for source and zip files for data. Since I’m using VS here, I don’t need to download Python.
After downloading, it is decompressed. I used to decompress the files extracted from Data into the files extracted from Source. I stressed that I decompressed them separately, that is, decompressed them into two folders.
Two, start compiling
(1) Create a new folder in the folder after source unzipped, habitually named build, this folder is used to put the project related files after cmake.
(2) Open cmake
![](https://programmerah.com/wp-content/uploads/2021/02/affa2851e3df9784aba2e610f3a8b138.png)
The source code bar is the path after unzips the source, and the build bar is the path of the project generated by CMAKE. The bin folder in the picture is not what I said above, so you can change the destination path to the build folder you created.
If you want to create a 64-bit VTK, you need to select the 64-bit VSXuan option. If you want to create a 64-bit VTK, you need to select the 64-bit VSXuan option
(3) Make the file options, the specific meaning of the options I will not say
![](https://programmerah.com/wp-content/uploads/2021/02/3e32119c54040dd629c0d3eaaf4200d6.png)
This is the item that should be checked in Build.
![](https://programmerah.com/wp-content/uploads/2021/02/1def83bd8e4d93d3ee972fea0556a300.png)
This is the cmake group, but watch out for CMAKE_INSTALL_PREFIX. This is a very important one. You’ll notice that most of the blogs don’t talk about it at the moment, but it will make it much easier to use VTK.
Then is the intall road strength configuration, as shown below:
![](https://programmerah.com/wp-content/uploads/2021/02/77f9bb5e25e6b97746d755195226461b.png)
Represent the DLL path, the LIB path, and the VTK header path compiled with VS respectively. You need to set it up by yourself. In the future, you can use VTK just like OpenCV.
![](https://programmerah.com/wp-content/uploads/2021/02/ed04c0bcc73b0ab3c2507934e060ecd5.png)
Because I’m using MFC, check the module_vtkguisupportMFC in the Module. Other options seem to be the default.
(4) Click the Configure button, and when the red color turns to white, click the Generate button to Generate the project.
Note: If there is an error when cmake is checked, it may be because the VS installation path has Chinese. Therefore, it is specially reminded that the installation path in Chinese should not appear.
(5) Finally, click Open ProJeroject to open the generated project in VS. As shown in figure:
![](https://programmerah.com/wp-content/uploads/2021/02/6581159d0e672db150b66c2428d7d9f0.png)
Compile all_build, only install if successful.
While I’m using VS2015, other VSs do the same, I need to remind you that there is one more step you need to take before VS2013 is compiled, and that is to install multiple character sets.
![](https://programmerah.com/wp-content/uploads/2021/02/ee5c08a7cae1c6fdf27e5912e50c0040.png)
The result after successful compilation is shown in the figure below:
![](https://programmerah.com/wp-content/uploads/2021/02/3d22b6d891e32514ef63ff26a90830f4.png)
As for the use, and you are familiar with the use of OpenCV is the same.
Because everyone’s level is different, I don’t know if it’s clear or not. If there is a lack of documents, or what questions can be left in the blog question, we discuss together.
And finally, the aforementioned book:
![](https://programmerah.com/wp-content/uploads/2021/02/635ad65101f5a67f453ead5cdd7c3814.png)
These are books about learning VTK, ITK, and CMAKE. Please leave a comment below if you need any.