您的位置:首页 > 其它

VTK 5.8 环境配置

2011-12-14 17:06 260 查看

一、 VTK简介

Wikipedia: The Visualization Toolkit (VTK) is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK consists of a C++ class library and several interpreted interface layers including Tcl/Tk, Java, and Python. Kitware, whose team created and continues to extend the toolkit, offers professional support and consulting services for VTK. VTK supports a wide variety of visualization algorithms including: scalar, vector, tensor, texture, and volumetric methods; and advanced modeling techniques such as: implicit modeling, polygon reduction, mesh smoothing, cutting, contouring, and Delaunay triangulation. VTK has an extensive information visualization framework, has a suite of 3D interaction widgets, supports parallel processing, and integrates with various databases on GUI toolkits such as Qt and Tk. VTK is cross-platform and runs on Linux, Windows, Mac and Unix platforms. VTK also includes ancillary support for 3D interaction widgets, two and three-dimensional annotation, and parallel computing. At its core VTK is implemented as a C++ toolkit, requiring users to build applications by combining various objects into an application. The system also supports automated wrapping of the C++ core into Python, Java and Tcl, so that VTK applications may also be written using these interpreted programming languages. (http://en.wikipedia.org/wiki/VTK

VTK features (http://vtk.org/VTK/project/technical.html)

The Design and Implementation Of An Object-Oriented Toolkit For 3D Graphics and Visualization (http://vtk.org/VTK/img/dioot.pdf)

二、 VTK环境配置

VTK采用了CMake进行环境配置(或者说CMake是由VTK而生),可以根据不同的开发环境生成匹配的项目工程,具体的方法如下:

第一步-下载 CMake (http://www.cmake.org/cmake/resources/software.html)

VTK Source + VTK data (http://www.vtk.org/VTK/resources/software.html)

这里的VTK的windows installer可不下载,除非打算直接基于Tcl/Tk编程。然后,将VTK Source 和VTK Data解压到某个目录中(默认目录即可。有人说该目录名称中不能包含空格,至少对于我的情况是不成立的(Win7 + VTK5.8))。

第二步-生成项目文件 对于Windows用户,采用CMake的gui界面首先对VTK的Source,和Output路径进行设置,然后Configure,CMake会询问本机采用的编译器(我用的是VS2010)。经过相当长的一段时间后,CMake会用红色区域来提示需要用户自定义的编译选项。

在这个过程中,会有很多的标记需要勾选,其大都可以“望文知义”,将鼠标放置在每一个项目上会有简短的介绍(个人建议初学者勾选其中的Example选项,有很多例子值得学习),如果选择了第三方库的支持,比如BOOST或者MEX等,那么就需要制定这些库的路径。

需要注意的是,对于要基于MFC编程的用户来说,要勾选CMake中的Adcance选项。其中必须首先勾选VTK_USEGUISUPPORT,然后才会出现VTK_USE_MFC。另外,两者必须同时选中,否则CMake不会对其生成工程。如果在编译的过程中发现没有生成某一个模块的工程,也大可不必担心,可以再次运行CMake,将该功能勾选后重新Generate。

最后,CMake提示生成成功之后就可以进入下一步了。

第三步-编译项目 CMake会将上一步定制的VTK版本的项目文件生成在Output的目录中,直接对其进行编译(启动工程为ALL_BUILD),成功之后就可以尝试示例的应用程序了。

第四步-用户开发环境设置 参照VTK中的示例工程设置。

 

可以参考的网帖有:

http://www.divms.uiowa.edu/~cwyman/classes/common/howto/winVTK.html

http://wenku.baidu.com/view/f5b506e79b89680203d82529.html
http://www.cnblogs.com/opengl/archive/2011/11/20/2256528.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: