Tag Archives: ST.

The collapse pits of VTK projects that are not generated by cmake

Some of the compilation options for CMake and IDE are different, so we users need to do a little more work. And VTK officials also said:
If you are not using CMake to compile your code, you need to add some # cbb0
I. OpenGL version problem, if it is OpenGL2 version, need to add

#include <vtkAutoInit.h>

VTK_MODULE_INIT(vtkRenderingOpenGL2);

Two, about VTKRenderingFreeType, once in the interactive window render a VTKTextActor, report abnormal report vomiting (output information as shown below). When I see this solution on Stack Overflow, I need to add the next line of code

VTK_MODULE_INIT(vtkRenderingFreeType);



outputWindow ณณ:ERROR: In D:\VTK6.3\VTK-src\Rendering\Core\vtkTextActor.cxx, line 110
vtkTextActor (0509BA90): Failed to get the TextRenderer instance!

Summary of problems encountered in compiling and installing vtk7 + vs2013 / 2015 + cmake

Most of the work is done according to the online compilation tutorial. Several problems encountered in the process are summarized as follows:
1, to generate the debug and release versions of the.lib file name repeated question:
in camke carried out in accordance with the tutorial after completion of the config, do not generate, point the Add Entry;
popup dialog box Name input :CMAKE_DEBUG_POSTFIX, type select :STRING, value input :d.
set up some config again, until all turned white, the generate again can
2, compilation of project in vs, ALL_BUILD after the success of the generated during the install error:
in the operation, the following three parts which are not necessarily must
1. C:\Program Files (x86)\Common Files\ Microsoft Shared \ Msenv \ vslauncher.exe, right click – “Properties -” compatibility, check the administrator permissions at the bottom to run;
Then close the current VS software, run VS as an administrator, open vtk.sln in the build directory
ter this step, right-click Install and generate Install only, again fail
2>

br>

3
3
3
3
3
3

The last step (key) should be
the debug, right-click the install project to open its properties page, generate an event in the late generates events – “-” “used in the generated” changed to “no”. Right install generated again can success
note: under the release, install project property page at this time in “use” in the generated above should be “yes”, also, then right-click the install the success

Examples of VTK image reading and display

PNG, BMP, JPG image reading and display
Read and display.jpg images: vtkJPEGReader
VS15+VTK7.0 Console instance:

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2);
#include <vtkSmartPointer.h>
#include <vtkImageViewer2.h>
#include <vtkJPEGReader.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>

int main()
{
	//Verify input arguments
	/*	
	  Filename(.jpeg)" 
	*/

	//Read the image
	vtkSmartPointer<vtkJPEGReader> jpegReader =vtkSmartPointer<vtkJPEGReader>::New();
	jpegReader->SetFileName("F:\\vtkshuju\\lena.jpg");

	// Visualize
	vtkSmartPointer<vtkImageViewer2> imageViewer = vtkSmartPointer<vtkImageViewer2>::New();
	imageViewer->SetInputConnection(jpegReader->GetOutputPort());
	vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =vtkSmartPointer<vtkRenderWindowInteractor>::New();
	imageViewer->SetupInteractor(renderWindowInteractor);
	imageViewer->Render();
	imageViewer->GetRenderer()->ResetCamera();
	imageViewer->Render();
	imageViewer->GetRenderWindow()->SetWindowName("read and show jpg test");

	renderWindowInteractor->Start();

	return EXIT_SUCCESS;
}

Console instance under VS15+VTK7.0:

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2);
//read and show .mha
#include <vtkImageData.h>
#include <vtkMetaImageReader.h>
#include <vtkSmartPointer.h>
#include <vtkInteractorStyleImage.h>
#include <vtkRenderer.h>
#include <vtkImageActor.h>
#include <vtkImageMapper3D.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>

int main()
{

//	 image.mha

	vtkSmartPointer<vtkMetaImageReader> reader =
		vtkSmartPointer<vtkMetaImageReader>::New();
	reader->SetFileName("F:\\vtkshuju\\itkBrainSliceComplex.mha");
	reader->Update();

	// Visualize
	vtkSmartPointer<vtkImageActor> actor =
		vtkSmartPointer<vtkImageActor>::New();
	actor->GetMapper()->SetInputConnection(reader->GetOutputPort());

	vtkSmartPointer<vtkRenderer> renderer =
		vtkSmartPointer<vtkRenderer>::New();
	renderer->AddActor(actor);
	renderer->ResetCamera();

	vtkSmartPointer<vtkRenderWindow> renderWindow =
		vtkSmartPointer<vtkRenderWindow>::New();
	renderWindow->AddRenderer(renderer);

	vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
		vtkSmartPointer<vtkRenderWindowInteractor>::New();
	vtkSmartPointer<vtkInteractorStyleImage> style =
		vtkSmartPointer<vtkInteractorStyleImage>::New();

	renderWindowInteractor->SetInteractorStyle(style);

	renderWindowInteractor->SetRenderWindow(renderWindow);
	renderWindowInteractor->Initialize();
	renderWindowInteractor->GetRenderWindow()->SetWindowName(".mha pic test");
	renderWindowInteractor->Start();

	return EXIT_SUCCESS;
}



PNG image read and display: vtkPNGReader:

Console instance under VS15+VTK7.0:

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2);
//read and show png
#include <vtkSmartPointer.h>
#include <vtkImageViewer2.h>
#include <vtkPNGReader.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>

int main()
{
	// Verify input arguments
	
//			<< " Filename(.png)" << std::endl;
	
	// Read the image
	vtkSmartPointer<vtkPNGReader> reader =
		vtkSmartPointer<vtkPNGReader>::New();
	reader->SetFileName("F:\\vtkshuju\\BrainProtonDensitySlice.png");

	// Visualize
	vtkSmartPointer<vtkImageViewer2> imageViewer =
		vtkSmartPointer<vtkImageViewer2>::New();
	imageViewer->SetInputConnection(reader->GetOutputPort());
	vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
		vtkSmartPointer<vtkRenderWindowInteractor>::New();
	imageViewer->SetupInteractor(renderWindowInteractor);
	imageViewer->Render();
	imageViewer->GetRenderer()->ResetCamera();
	imageViewer->Render();
	imageViewer->GetRenderWindow()->SetWindowName("read and show png test");
	renderWindowInteractor->Start();

	return EXIT_SUCCESS;
}

Console instance under VS15+VTK7.0:

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingFreeType);
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2);
#include <vtkSmartPointer.h>
#include <vtkImageViewer2.h>
#include <vtkBMPReader.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>

int main(int argc, char* argv[])
{
	//Verify input arguments
	
//			<< " Filename(.bmp)" << std::endl;
	

	//Read the image
	vtkSmartPointer<vtkBMPReader> reader =
		vtkSmartPointer<vtkBMPReader>::New();
	reader->SetFileName("F:\\vtkshuju\\masonry.bmp");

	// Visualize
	vtkSmartPointer<vtkImageViewer2> imageViewer =
		vtkSmartPointer<vtkImageViewer2>::New();
	imageViewer->SetInputConnection(reader->GetOutputPort());
	vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
		vtkSmartPointer<vtkRenderWindowInteractor>::New();
	imageViewer->SetupInteractor(renderWindowInteractor);
	imageViewer->Render();
	imageViewer->GetRenderer()->ResetCamera();
	imageViewer->Render();
	imageViewer->GetRenderWindow()->SetWindowName("read and show bmp test");
	renderWindowInteractor->Start();

	return EXIT_SUCCESS;
}

Prompt “failed to load file or assembly” when VTK uses renderwindowcontrol

Possible reasons:

The Activiz.net library downloaded on the CPU version does not match the local CPU version

>

download Activiz.net source code compilation of anyCPU version of the library.

Activiz.net source: https://github.com/bitzhuwei/Kitware.VTK.git

>
>
>
>
>
>
>
>
>
>
>
>

2, select Kitware project right click modify project properties – “build -” target platform anyCPU compilation

=
=
=
=

Vtkrenderwindow and vtkrenderwindow actor

VtkRenderWindowInteractor for rendering is happening on the window the mouse, keyboard, event event. This class provides platform-independent mechanisms for interacting with the render window, including picking and frame rate control. When vtkRenderWindowInteractor (in fact is he a subclass) observed in the platform of a certain event occurs, he through InvokeEvent () method to convert the incident to VTK events. This class acts as a platform specific base class to control the passing of mouse/keyboard/time messages, notifying VTKInteractorObserver and its subclasses. All observer objects, VTKInteractorObservers, registered with the interactor receive the event, and then all respond to it.
In fact, vtkRenderWindowInteractor works like this: This class will take in vtkRenderWindow associated with it (through vtkRenderWindowInteractor SetRenderWindow () method to join the render window) on the event, then vtkRenderWindowInteractor classes depending on the equipment and the operating system to instantiate an object, for example, Unix is vtkXRenderWindowInteractor, The Windows is vtkWin32RenderWindowInteractor. When vtkRenderWindowInteractor: : Start () method is invoked, the function of interception of the event is activated. Finally, the interception by the event will be sent to vtkRenderWindowInteractor: : InteractorStyle this instance for processing. InteractorStyle vtkRenderWindowInteractor is a protected data members in a class is vtkInteractorObserver types of pointer, and vtkInteractorObserver role is monitoring events on interaction, in this way, the interception by vtkRenderWindowInteractor messages have the end-result. If want to increase the new way of interaction in VTK, should start with vtkInteractorStyle derive a subclass, such as: vtkInteractorStyleTrackball, vtkInteractorStyleUser, vtkInteractorStyleJoystickActor, vtkInteractorStyleJoystickCamera, vtkInteractorStyleUser, etc. The interaction allows the user to customize the manner.

 

 
Application process: (1) a vtkRenderWindow object rWin (2) a iRen vtkRenderWindowInteractor object (3) a widget vtkWidget object
Is: iRen – & gt; setRenderWindow(rWin);
Widgets – & gt; setInteractor(iRen);
Iren takes care of the event conversion (you must specify which window’s event is converted), and then registers an observer widget with the Iren interactivator widget->; SetInteracotr (IREN), which is responsible for observing events that occur on the render window that IREN intercepts and performing relevant system custom actions when the event occurs.

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.

Vtk7. X is compiled and installed under vs2013 and vs2015

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.
(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.

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

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

This is the item that should be checked in Build.

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:

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.

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:

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.

The result after successful compilation is shown in the figure below:

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:

These are books about learning VTK, ITK, and CMAKE. Please leave a comment below if you need any.
 
 
 
 

[VTK] vtk8.2.0 + vs2015 + win10 compilation and configuration

VTK8.2.0 + VS2015 + Win10 compilation and configuration
Special thanks to the “cook a delicious fish” blogger for technical support please refer to: VTK8.2.0+ITK4.13.2+VS2015 configuration
Only the VTK library is compiled here, not the examples and data contained in the VTK.
because the project needs to use only the VS2015 version, and the compilation process is also applicable to VS2017 and VS2019;
1 Download the source code
1.1 VTK source code can be downloaded from VTK official website
Download address: https://vtk.org/download/

in 8.2.0 release version of the Source select a package to download.
1.2 CMake official website download
Download address: https://cmake.org/download/

select the latest Release version, choose according to your Windows Platform, I am a 64 – bit system, so choose Windows win64 – X64 Installer installation package, download can be installed directly after, best as an administrator to install.
2. Generate VS2015 project file of VTK using CMAKE
Unzip the VTK source code to get the vtk-8.2.0 folder, open it and see if there is a layer of VTK8.2.0 available when creating a new folder vtk-8.2.0-build and vtk-8.2.0-prefix.

2.1 Open the installed Cmake (cmak-gui) (please ignore that my version is not the latest version) and select the VTK source path and the VTK generation path as the previous step, click Configure.

I am VS2015 64-bit version, click Finish to start loading the configuration and wait until the red area appears and the Configuring done appears.


2.3 Modify configuration parameters
2.3.1 Tickle BUILD_SHARED_LIBS under Build (I didn’t check it for example tests if I want to check it)
2.3.2 Modify the CMAKE_INSTALL_PREFIX option path to the vtk-8.2.0-prefix path created earlier
2.3.3 If you want to support MFC, check the MODULE_VTKGUISUPPORTMFC option under Module
2.3.4 Click the Configure button until the red part disappears, and click the Generate button to Generate the project file
2.3.5 Here refer to “VTK8.2.0 Compile, Installation and Test Case Run (Win10 + VS2017 + QT5, Release+Debug)” to set the value of CMAKE_DEBUG_POSTFIX. This variable represents the character added after the output filename in Debug mode, set to “_D”, then the filename generated in Debug mode will have the suffix “_D”. In order to distinguish between the files used in Release and Debug mode (I did not set it, you can set it, so that when you create a Release after the Debug version, you will not overwrite the files you created before)



3 Enter the generated VS2015 project file and compile the VTK library
3.1 Open before the new VTK-8.2.0-Build folder, use VS2015 to open VTK. SLN (it is best to open Win10 as an administrator to modify C disk data is very sensitive, may lead to compilation failure, close 360 and other defense software, close no necessary programs)
3.2 The default attribute is debug x64, right-click ALL_BUILD and select Build for compilation. It is better not to operate the computer during the Build period. After completion, check whether the output is all successful.


3.3 Copy the include, bin, lib, and share files from the vtk-8.2.0-prefix files to your own VTK library folder. For example: Create a new VTK820 folder with Debug and Release, because include and share files are shared by debug and release versions, put include and share folders in VTK820, and copy the generated bin and lib files to the corresponding folders. For example, the bin and lib files generated by vtk-8.2.0-prefix under debug environment are placed in the Debug folder of VTK820.

3.4 After changing Debug to Release in VS2015, repeat the operation of 3.2 to generate the Release version of VTK library (note: the bin and lib generated under vtk-8.2.0-prefix will be overwritten and copied ahead of time). Save the library files to the Release as described in 3.3

4. Use of VTK
Configure the VTK library, including (1) add the environment variable VTK820 bin folder directory (debug and release used to fill which is OK) (after configuration need to restart VS or restart the computer), create a new console application (2) modify the project properties contain directory and lib library directory, (3) and use the lib file name to Link->; Iput-> Additional Dependencies (there is a method to get all the lib names, create a new.txt file under the lib file, and type dir /b *.lib>;

ah
a>

Vtk8.2.0 (32bit + 64bit) compilation and installation test (win10 + vs2017 + Qt5)

This article referred to the following articles in the installation process, and I would like to express my thanks to the following bloggers! :
https://blog.csdn.net/anhec/article/details/86777302
I. Preparation before installation
Visual Studio 2017 qt5cmakevtk source (https://vtk.org/download/)
Two. VTK compilation
My compile directory is as follows

Run CMake as follows

Click Configure, select Visual Studio 15 2017 (32bit) or Visual Studio 15 2017 Win64 (64bit), and click Finish.

When configure is complete, manually modify some of the parameters as follows:

    BUILD_SHARED_LIBS, unchecked if static lib generation is needed; BUILD_EXAMPLES, which generate test cases, check the suggested box for easy post-compile testing; CMAKE_DEBUG_POSTFIX, which means that in debug mode the filename is followed by the specified character; VTK_Group_Qt, VTK supports Qt; CMAKE_INSTALL_PREFIX, set the VTK installation directory (D:\libraries\I_VTK\VTK\bin\x86 or D:\libraries\I_VTK\VTK\bin\x64);

Click Configure again to Configure the Qt path

Select the Qt path: (32bit) D:\libraries\Qt\Qt5.12.0\5.12.0\msvc2017\lib\cmake\Qt5
(64 – bit) D: \ libraries \ Qt \ Qt5.12.0\5.12.0 \ msvc2017_64 \ lib \ cmake \ Qt5
Click Configure again (change the red color if it still appears, then click Configure) and click Generate when you’re done.

III. VS2017 compilation
Open vtk.sln with vs2017, then right-click ALL_BUILD, click build, wait for some time, all compile successfully;



Right-click Install again and select Project Only –>; Only generate INSTALL, after completion you can see in the installation directory (D:\libraries\I_VTK\VTK\bin\x86), see the related lib, include, etc


In VS2017, change the configuration from Debug to Release, repeat ALL_BUILD and INSTALL above;
Test three.

Select Cube and run

 
 
 
 
 
 
 
 

VTK series: installation and introduction of VTK

Due to the need to do some three-dimensional things, learn some D3D, this thing is too low-level, what function should be realized by their own, then found the VTK toolkit, in the industry response is good, and there is a.NET version, so I decided to try.
I use VS2008, there are a lot of tutorials on the Internet, according to the tutorial to do, to the end of the toolbox are VTK controls, full of joy thought that can be successful, drag a control up a debug results prompt that the specified module can not be found. I can follow the tutorial but still make mistakes is a little puzzled. The net searched for a long time, still did not solve, want to despair. I saw a friend’s QQ in the Visualization Lab forum, added him, he is very nice, asked questions immediately back to me, the key is to help me to solve the problem. In the heart that thank ah, I can not say. The main problem is to put all the downloaded DLLs under the program’s “dubug” and it will work fine. There is a problem with the VTK control that is pulled from the Toolbox. The first time it is displayed, the form will not load when the project is closed and the second time it is opened. This problem is not solved.
After several days of hard work, I finally saw a HelloWord program. Everything is difficult at the beginning, so I can only take it slowly.
Here are a few good links, a good tutorial to get started with VTK.
http://ooplab.org/post/624.html VTK installation tutorial, which also have a step to c:/VTK file to add to the system environment variables.
http://www.cadcaecam.com/Forum/viewthread.php?tid=14832& extra=& page=1
C3P forum, but only wrote a small part of it.
http://hi.baidu.com/ophir/blog/category/%D7%CA%D4%B4%CF%C2%D4%D8%C7%F8 is good too.
Thanks to the articles written by these authors, it is really a great help for beginners.

VTK basic learning

1, vtkPolyDataMapper: : SetInputConnection () : VTK visual line of the input data interface, the corresponding output data visualization pipeline interface for GetOutPort (); Versions prior to VTK5.0 use setInput () and getOutput () as input and output interfaces. However, after the 7.1 version, it seems that this is not possible. There is no SetInput for the Mapper directly.

2. VTKMarchingCubes requires the input to be VTKImageData. If the input is VTKPolyData, the program will report an error

3, the use of VTKContourFilter can achieve contour extraction.
http://lzchenheng.blog.163.com/blog/static/8383353620108130751672/
4. Sometimes it is necessary to judge the coordinates of the intersection of a straight line and a specific object, which can be achieved with the help of VTKModifiedBSPTree. See Resources for details
http://www.vtk.org/Wiki/VTK/Examples/Cxx/DataStructures/ModifiedBSPTree_IntersectWithLine
5, the measurement of the curve, can be approximate to the length of the broken line measurement; You can also use spline curve fitting and then calculate the length of the spline curve.
According to the description in reference [1], a polyline is composed of many straight line segments, and the length of a polyline can be obtained by adding up the length of each segment.

[1]http://vtk.1045678.n5.nabble.com/get-length-of-vtkpolyline-td1228133.html
[2]http://vtk.1045678.n5.nabble.com/how-to-compute-the-length-of-spline-td5729305.html#a5729341
6. Summary of VTK 3D reconstruction
http://blog.csdn.net/q1302182594/article/details/45892995

[VTK] header file and lib file name often used in VTK

1. Commonly used header files

#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)

//vtk includes
#include "vtkButtonWidget.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkSphereSource.h"
#include "vtkSmartPointer.h"
#include "vtkBoxWidget.h"
#include "vtkCommand.h"
#include "vtkActor.h"
#include "vtkCamera.h"
#include "vtkConeSource.h"
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkTransform.h"
#include "vtkProperty2D.h"
#include "vtkVersion.h"
#include "vtkOrientationMarkerWidget.h"
#include "vtkAxesActor.h"
#include "vtkPropAssembly.h"
#include "vtkVolume.h"
#include "vtkLookupTable.h"
#include "vtkDICOMImageReader.h"
#include "vtkBMPReader.h"
#include "vtkPiecewiseFunction.h"
#include "vtkColorTransferFunction.h"
#include "vtkVolumeProperty.h"
#include "vtkVolumeRayCastCompositeFunction.h"
#include "vtkVolumeRayCastMapper.h"
#include "vtkImageCast.h"
#include "vtkOpenGLVolumeTextureMapper3D.h"
#include "vtkImageThreshold.h"
#include "vtkImageShiftScale.h"
#include "vtkImageData.h"
#include "vtkStructuredPointsWriter.h"
#include "vtkStructuredPointsReader.h"
#include "vtkImageShrink3D.h"
#include "vtkImageGaussianSmooth.h"
#include "vtkPlanes.h"
#include "vtkPlane.h"
#include "vtkFixedPointVolumeRayCastMapper.h"
#include "vtkImageMask.h"
#include "vtk3DWidget.h"
#include "vtkProperty.h"  
#include "vtkContourFilter.h"  
#include "vtkPolyDataNormals.h"  
#include "vtkOutlineFilter.h"  
#include "vtkStripper.h"  
#include "vtkSmoothPolyDataFilter.h"  
#include "vtkImagePlaneWidget.h"
#include "vtkImageFlip.h"  
#include "vtkImageViewer.h"  
#include "vtkLineSource.h"  
#include "vtkDataSetMapper.h"  
#include "vtkPolyDataWriter.h"  
#include "vtkPolyDataReader.h"
#include "vtkImageMapToColors.h"
#include "vtkImageActor.h"
#include "vtkVolume16Reader.h"
#include "vtkImplicitPlaneWidget.h"
#include "vtkLODActor.h"
#include "vtkTexturedButtonRepresentation.h"
#include "vtkGlyph3D.h"
#include "vtkAppendPolyData.h"
#include "vtkClipPolyData.h"
#include "vtkSphere.h"
#include "vtkSampleFunction.h" 
#include "vtkCubeAxesActor2D.h"
#include "vtkCutter.h"
#include "vtkLODProp3D.h"
#include "vtkWin32RenderWindowInteractor.h"
#include "vtkCubeSource.h"
#include "vtkSliderWidget.h"
#include "vtkSliderRepresentation3D.h"
#include "vtkInteractorStyleUser.h"
#include "vtkXMLImageDataWriter.h"
#include "vtkTransformPolyDataFilter.h"
#include "vtkXMLPolyDataReader.h"
#include "vtkWindowToImageFilter.h"
#include <vtkPointPicker.h>
#include <vtkObjectFactory.h>
#include <vtkRendererCollection.h>
#include "vtkAffineWidget.h"
#include "vtkAffineRepresentation2D.h"
#include "vtkPlaneSource.h"
#include <vtkAffineWidget.h>
#include <vtkAppendPolyData.h>
#include <vtkInteractorStyleSwitch.h>
#include <vtkTextWidget.h>
#include <vtkTextActor.h>
#include <vtkTextProperty.h>
#include <vtkTextRepresentation.h>
#include <vtkContourWidget.h>
#include <vtkOrientedGlyphContourRepresentation.h>
#include <vtkDebugLeaks.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkMath.h>
#include <vtkWidgetEvent.h>
#include <vtkWidgetEventTranslator.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkImplicitPlaneRepresentation.h>
#include "vtkBYUReader.h"
#include "vtkPLYReader.h"
#include "vtkSurfaceReconstructionFilter.h"
#include <vtkImageCanvasSource2D.h>
#include <vtkInteractorStyleImage.h>
#include <vtkPointHandleRepresentation2D.h>
#include <vtkSeedWidget.h>
#include <vtkSeedRepresentation.h>
#include "vtkWindowLevelLookupTable.h"
#include "vtkCaptionActor2D.h"
#include "vtkCylinderSource.h"
#include "vtkPropCollection.h"
#include "vtkTextProperty.h"
#include "vtkCylinderSource.h" 
#include "vtkAnnotatedCubeActor.h" 
#include "vtkAssembly.h" 
#include <vtkCubeAxesActor.h>
#include <vtkTextProperty.h>
#include <vtkActorCollection.h>
#include <vtkSuperquadricSource.h>
#include <vtkNew.h>
#include <vtkPlatonicSolidSource.h>
#include <vtkLODActor.h>
#include <vtkLight.h>
#include <vtkTextProperty.h>
#include <vtkObjectFactory.h>
#include <vtkActor2D.h>
#include <vtkTextProperty.h>
#include <vtkTextMapper.h>
#include <vtkTextProperty.h>
#include <vtkSliderWidget.h>
#include <vtkWidgetEvent.h>
#include <vtkCallbackCommand.h>
#include <vtkWidgetEventTranslator.h>
#include <vtkSliderWidget.h>
#include "vtkBMPWriter.h"
#include "vtkJPEGReader.h"
#include "vtkSliderRepresentation2D.h"
#include "vtkTextActor.h"
#include "vtkTexturedButtonRepresentation2D.h"
#include "vtkDistanceRepresentation3D.h"
#include "vtkDistanceWidget.h"
#include "vtkAngleRepresentation3D.h"
#include "vtkAngleWidget.h"
#include "vtkImageViewer2.h"
#include "vtkTextActor.h"
#include "vtkCornerAnnotation.h"
#include "vtkTextureMapToCylinder.h"
#include "vtkTransformTextureCoords.h"
#include "vtkImageViewer2.h"
#include "vtkDICOMImageReader.h"
#include "vtkOpenGLPolyDataMapper.h"
#include "vtkClipVolume.h"
#include "vtkImageToPolyDataFilter.h"
#include "vtkContourFilter.h"
#include "vtkImageDataGeometryFilter.h"
#include "vtkWarpScalar.h"
#include "vtkPolyDataToImageStencil.h"
#include "vtkImageStencil.h"
#include "vtkMetaImageWriter.h"
#include "vtkImageToImageStencil.h"
#include "vtkPolyDataToImageStencil.h"
#include <vtkVersion.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkImageData.h>
#include <vtkSphereSource.h>
#include <vtkMetaImageWriter.h>
#include <vtkPolyDataToImageStencil.h>
#include <vtkImageStencil.h>
#include <vtkPointData.h>
#include <vtkCutter.h>
#include <vtkPlane.h>
#include <vtkStripper.h>
#include <vtkLinearExtrusionFilter.h>
#include <vtkXMLPolyDataWriter.h>
#include <vtkImageData.h>
#include <vtkMetaImageReader.h>
#include <vtkSmartPointer.h>
#include <vtkInteractorStyleImage.h>
#include <vtkRenderer.h>
#include <vtkImageActor.h>
#include <vtkImageMapper3D.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkTesting.h>
#include "vtkAlgorithmOutput.h"
#include "vtkMassProperties.h"
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkPolyData.h>
#include <vtkSphereSource.h>
#include <vtkWindowToImageFilter.h>
#include <vtkPNGWriter.h>
#include "vtkRenderLargeImage.h"
#include "vtkPropCollection.h"
#include "vtkVolumeRayCastMapper.h"
#include "vtkFrustumCoverageCuller.h"
#include <vtkCullerCollection.h>
#include "vtkType.h"
#include "vtkImageDataGeometryFilter.h"
#include "vtkImageClip.h"
#include "vtkExtractVOI.h"
#include "vtkInformation.h"
#include "vtkTriangleFilter.h"

2. Commonly used LIB files

wbemuuid.lib
d3d9.lib
glu32.lib
opengl32.lib
libjasperd.lib
libjpegd.lib
libpngd.lib
libtiffd.lib
IlmImfd.lib
LVTCodec.lib
opencv_calib3d244d.lib
opencv_core244d.lib
opencv_features2d244d.lib
opencv_flann244d.lib
opencv_highgui244d.lib
opencv_imgproc244d.lib
opencv_legacy244d.lib
opencv_ml244d.lib
opencv_video244d.lib
vtkalglib-6.0.lib
vtkChartsCore-6.0.lib
vtkCommonColor-6.0.lib
vtkCommonComputationalGeometry-6.0.lib
vtkCommonCore-6.0.lib
vtkCommonDataModel-6.0.lib
vtkCommonExecutionModel-6.0.lib
vtkCommonMath-6.0.lib
vtkCommonMisc-6.0.lib
vtkCommonSystem-6.0.lib
vtkCommonTransforms-6.0.lib
vtkDomainsChemistry-6.0.lib
vtkDICOMParser-6.0.lib
vtkexoIIc-6.0.lib
vtkexpat-6.0.lib
vtkFiltersAMR-6.0.lib
vtkFiltersExtraction-6.0.lib
vtkFiltersCore-6.0.lib
vtkFiltersGeneral-6.0.lib
vtkFiltersFlowPaths-6.0.lib
vtkFiltersGeneric-6.0.lib
vtkFiltersGeometry-6.0.lib
vtkFiltersHybrid-6.0.lib
vtkFiltersImaging-6.0.lib
vtkFiltersHyperTree-6.0.lib
vtkFiltersModeling-6.0.lib
vtkFiltersParallel-6.0.lib
vtkFiltersParallelImaging-6.0.lib
vtkFiltersSelection-6.0.lib
vtkFiltersProgrammable-6.0.lib
vtkFiltersSources-6.0.lib
vtkFiltersTexture-6.0.lib
vtkFiltersStatistics-6.0.lib
vtkFiltersVerdict-6.0.lib
vtkfreetype-6.0.lib
vtkftgl-6.0.lib
vtkGeovisCore-6.0.lib
vtkGUISupportMFC-6.0.lib
vtkgl2ps-6.0.lib
vtkhdf5_hl-6.0.lib
vtkhdf5-6.0.lib
vtkImagingColor-6.0.lib
vtkImagingCore-6.0.lib
vtkImagingFourier-6.0.lib
vtkImagingSources-6.0.lib
vtkImagingGeneral-6.0.lib
vtkImagingHybrid-6.0.lib
vtkImagingMath-6.0.lib
vtkImagingMorphological-6.0.lib
vtkImagingStatistics-6.0.lib
vtkImagingStencil-6.0.lib
vtkInfovisCore-6.0.lib
vtkInfovisLayout-6.0.lib
vtkInteractionImage-6.0.lib
vtkInteractionStyle-6.0.lib
vtkInteractionWidgets-6.0.lib
vtkIOAMR-6.0.lib
vtkIOCore-6.0.lib
vtkIOExodus-6.0.lib
vtkIOEnSight-6.0.lib
vtkIOExport-6.0.lib
vtkIOGeometry-6.0.lib
vtkIOImage-6.0.lib
vtkIOImport-6.0.lib
vtkIOInfovis-6.0.lib
vtkIOLegacy-6.0.lib
vtkIOLSDyna-6.0.lib
vtkIOMINC-6.0.lib
vtkIOMovie-6.0.lib
vtkIONetCDF-6.0.lib
vtkIOParallel-6.0.lib
vtkIOPLY-6.0.lib
vtkIOSQL-6.0.lib
vtkIOVideo-6.0.lib
vtkIOXML-6.0.lib
vtkIOXMLParser-6.0.lib
vtkjpeg-6.0.lib
vtkjsoncpp-6.0.lib
vtklibxml2-6.0.lib
vtkmetaio-6.0.lib
vtkNetCDF_cxx-6.0.lib
vtkNetCDF-6.0.lib
vtkoggtheora-6.0.lib
vtkParallelCore-6.0.lib
vtkpng-6.0.lib
vtkRenderingOpenGL-6.0.lib
vtkproj4-6.0.lib
vtkRenderingAnnotation-6.0.lib
vtkRenderingContext2D-6.0.lib
vtkRenderingCore-6.0.lib
vtkRenderingFreeType-6.0.lib
vtkRenderingFreeTypeOpenGL-6.0.lib
vtkRenderingGL2PS-6.0.lib
vtkRenderingHybridOpenGL-6.0.lib
vtkRenderingImage-6.0.lib
vtkRenderingLabel-6.0.lib
vtkRenderingLOD-6.0.lib
vtkRenderingVolume-6.0.lib
vtkRenderingVolumeAMR-6.0.lib
vtkRenderingVolumeOpenGL-6.0.lib
vtksqlite-6.0.lib
vtksys-6.0.lib
vtkTestingGenericBridge-6.0.lib
vtkTestingIOSQL-6.0.lib
vtkTestingRendering-6.0.lib
vtktiff-6.0.lib
vtkverdict-6.0.lib
vtkViewsCore-6.0.lib
vtkViewsContext2D-6.0.lib
vtkViewsGeovis-6.0.lib
vtkViewsInfovis-6.0.lib
vtkzlib-6.0.lib