VTK/FAQ 1
VTK/FAQ
General information and availability
What is the Visualization Toolkit?
The Visualization ToolKit (vtk) is a software system for 3D Computer Graphics and Visualization.
VTK includes a textbook published by Kitware Inc. (The Visualization Toolkit, An Object-Oriented Approach to 3D
Graphics [1]), a C++ class library, and Tcl, Python and Java implementations based on the class library.
For more information, see http:/ / www. vtk. org and http:/ / www. kitware. com.
What is the current release?
The current release of vtk is 5.4.0 (released on 2009-3-26). This release for download available from:
http:/ / www. vtk. org/ VTK/ resources/ software. html
Nightly development releases are available at:
http:/ / www. vtk. org/ files/ nightly
Can I contribute code or bug fixes?
We encourage people to contribute bug fixes as well as new contributions to the code. We will try to incorporate
these into future releases so that the entire user community will benefit from them.
See http:/ / www. vtk. org/ contribute. php for information on contributing to VTK.
For some ideas take a look at some of the entries in the "Changes to the VTK API" FAQ section, for example: What
changes are being considered for VTK
We now have a bug tracker that allow keeping track of any bug you could find. See BugTracker [2]. You'll need an
email to report a bug. To improve the chance of a bug being fixed, do not hesisitate to add as many details as
possible, a demo sample code + sample data is always a good idea. Providing a patch almost guarantees that your
patch will be incorporated into VTK.
Can I contribute money?
Please don't send money. Not that we think you're going to send in unsolicited money. But if you were thinking
about it, stop. It would just complicate our lives and make for all sorts of tax problems.
(Note: if you are a company or funding institution, and would like to fund features or development, please contact
Kitware http:/ / www. kitware. com .)
Is there a mailing list or Usenet newsgroup for VTK?
There is a mailing list: vtkusers@vtk.org
To subscribe or unsubscribe to the mailing list, go to: http:/ / www. vtk. org/ mailman/ listinfo/ vtkusers
To search the list archives go to: http:/ / www. kitware. com/ search. html
There is also a newsgroup that mirrors the mailinglist. At this point it seems that mirror is down. Mail to the
mailinglist used to be posted the newsgroup, but posts on the newsgroup were not sent to the mailinglist. The
newsgroup was located at: news://scully.esat.kuleuven.ac.be/vtk.mailinglist
http:/ / www. gmane. org is a bidirectional mail-to-news gateway that carries the vtkusers mailing list. Its located
here: news://news.gmane.org/gmane.comp.lib.vtk.user or here: http:/ / news. gmane. org/ gmane. comp. lib. vtk.
VTK/FAQ 2
user. vtkusers mails have been archived since April 2002 and they never expire. You can read and send mails to the
vtkusers list but sent mail will bounce back without having subscribed to the list first.
Is the VTK mailing list archived anywhere?
The mailing list is archived at: http:/ / www. vtk. org/ pipermail/ vtkusers/
You can search the archive at: http:/ / www. kitware. com/ search. html
Are answers for the exercises in the VTK book available?
Not anymore.
The answers to the exercises of the textbook used to be maintained by Martin Stoufer (kudos), and will be made
available by Kitware in the near future.
Is VTK regression tested on a regular basis? Can I help?
Yes, it is.
You can view the current regression test results at: http:/ / public. kitware. com/ dashboard. php?name=vtk
VTK uses Dart to perform builds, run tests, and generate dashboards. You can find more information about Dart at:
http:/ / public. kitware. com/ Dart/
You can help improve the quality of VTK by supplying the authors with Tcl scripts that can be used as or turned into
regression tests. A good regression test will:
1. Cover code that is not already covered.
2. Illustrate a bug that is occuring now or that has occurred in the past.
3. Use data that is on the 2nd Edition book CDROM or use "small" data files or use no data at all.
4. Optionally, produce an interesting result.
Currently almost all regression tests are written in Tcl.
Please send your Tcl regression tests to: mailto:wlorens1@mail. nycap. rr. com
Bill will evaluate them for applicability and integrate them into the nightly test process.
What's the best way to learn VTK?
There are six things you might want to try:
1. Purchase the book The Visualization Toolkit [1] from Kitware Inc.
2. Purchase the book VTK Users Guide [3] from Kitware Inc.
3. Check out some of the material at VTK Courses, Classes, Presentations.
4. Download the source code and/or binaries [4] (available on Windows) and look at the examples (there are
hundreds).
5. To learn the innards of VTK, you can attend a VTK course [5] or sponsor a VTK course at your site [6] through
Kitware. http:/ / www. kitware. com/ products/ index. html
6. Buy Bill a beer and get him talking about VTK
VTK/FAQ 3
How should I ask questions on the mailing lists?
The best online resource for this question is Eric S. Raymond's excellent guide on the topic titled [How to ask
questions the smart way [7]]. [Getting Answers [8]] is a good starting point too.
Please do read it and follow his advice. Thanks!
Please also remember the following when you post your messages to the VTK mailing lists.
• Mention the version of VTK you are using and the version of the compiler or scripting language you are using.
• Mention your platform, OS and their versions.
• Include hardware details if relevant.
• Include all relevant error messages (appropriately trimmed of course).
• The lists have a very large number of subscribers (in the thousands), so please keep messages to the point.
• Avoid HTML emails.
• Use a sensible and descriptive subject line.
• Do NOT post large data files or images to the list. Instead put them in your web page and mention the URLs.
• Quote the messages you reply to appropriately. Remove unnecessary details.
When asking a question or reporting a problem try to include a small example program that demonstrates the
problem. Make sure that this example program is as small as you can make it, simple (and uses VTK alone),
complete and demonstrates the problem adequately. Doing this will go a *long way* towards getting a quick and
meaningful response.
Sometimes you might not get any acceptable response. This happens bacause the others think the question has either
been already answered elsewhere (the archives, FAQ and google are your friends), or believe that you have not done
enough homework to warrant their attention, or they don't know the answer or simply don't have the time to answer.
Please do be patient and understanding. Most questions are answered by people volunteering their time to help you.
Happy posting!
How NOT to go about a programming assignment
This is really a link you should read before posting to the mailing list. [This article is an attempt to show these
irrational attitudes in an ironical way, intending to make our students aware of bad habits without admonishing
them.]
http:/ / www. di. uniovi. es/ ~cernuda/ noprog_ENG. html
Accessing VTK CVS from behind a firewall
Use the sourceforge project:
http:/ / cvsgrab. sourceforge. net/
Just download the script and type something like:
cvsgrab -rootUrl http:/ / public. kitware. com/ cgi-bin/ cvsweb. cgi/ -packagePath VTK -destDir .
-proxyUser xxx -proxyPassword xxx -proxyHost xxx -proxyPort xx
(Thanks to Ingo H. de Boer)
Also cvsgrab support the following option to access a particular branch:
-tag [optional] The version tag of the files to download
For example to get the latest 4.4 branch:
VTK/FAQ 4
cvsgrab -rootUrl http:/ / public. kitware. com/ cgi-bin/ cvsweb. cgi/ -packagePath VTK -destDir .
-proxyUser xxx -proxyPassword xxx -proxyHost xxx -proxyPort xxx
-tag release-4-4
Where can I obtain test and sample datasets?
See this page for details on downloading datasets that VTK can read.
Language bindings
Are there bindings to languages other than Tcl?
Aside from C++ (which it's written in) and Tcl, vtk is also bound into Java as of JDK 1.1 and Python 1.5, 1.6 and
2.X. All of the Tcl/Java/Python wrapper code is generated from some LEX and YACC code that parses our classes
and extracts the required information to generate the wrapper code.
What version of Tcl/Tk should I use with VTK?
Currently we recommend that you use Tcl/Tk 8.2.3 with VTK. This is the best-supported version combination at this
time.
VTK has also been tested with Tcl/Tk 8.3.2 and works well.
Tcl/Tk 8.3.4 has been tested to a limited extent but seems to have more memory leaks that Tcl 8.3.2 has.
Tcl/Tk 8.4.x seems to work well with VTK too, but you might have to change a couple of configuration settings
depending on the version of VTK you are using. Check the Does VTK support Tcl/Tk 8.4?.
Where can I find Python 2.x binaries?
All of the Python binaries available on the kitware site are built for Python 1.5.2. This includes the official release
VTK3.2 and the nightly builds (as at 2001-07-16).
For Python 2.x binaries, you will have to compile your own from source. It is worth checking the mailing list
archives for comments by others who have been through this process.
There are some user-contributed binaries available at other sites. Check the mailing list archives for possible leads.
Some win32 binaries for Python 2.1 are available at;
http:/ / basic. netmeg. net/ godzilla/
YMMV...
Why do I get the Python error -- ValueError: method requires a VTK object?
You just built VTK with Python support and everything went smoothly. After you install everything and try running
a Python-VTK script you get a traceback with this error:
ValueError: method requires a VTK object.
This error occurs if you have two copies of the VTK libraries on your system. These copies need not be in your
linkers path. The VTK libraries are usually built with an rpath flag (under *nix). This is necessary to be able to test
the build in place. When you install VTK into another directory in your linkers path and then run a Python script the
Python modules remember the old path and load the libraries in the build directory as well. This triggers the above
error since the object you passed the method was instantiated from the other copy.
So how do you fix it? The easiest solution is to simply delete the copy of the libraries inside your build directory or
move the build directory to another place. For example, if you build the libraries in VTK/bin then move VTK/bin to
VTK/FAQ 5
VTK/bin1 or remove all the VTK/bin/*.so files. The error should no longer occur.
Another way to fix the error is to turn the CMAKE_SKIP_RPATH boolean to ON in your CMakeCache.txt file and
then rebuild VTK. You shouldn't have to rebuild all of VTK, just delete the libraries (*.so files) and then re-run
cmake and make. The only trouble with this approach is that you cannot have BUILD_TESTING to ON when you
do this.
Alternatively, starting with recent VTK CVS versions (post Dec. 6, 2002) and with VTK versions greater than 4.1
(i.e. 4.2 and beyond) there is a special VTK-Python interpreter built as part of VTK called 'vtkpython' that should
eliminate this problem. Simply use vtkpython in place of the usual python interpreter when you use VTK-Python
scripts and the problem should not occur. This is because vtkpython uses the libraries inside the build directory.
2002 by Prabhu Ramachandran
Does VTK support Tcl/Tk 8.4 ?
Short answer: yes, but it might require some adjustments, depending on the VTK and CMake versions you are using.
1. The VTK 4.x CVS nightly/development distribution supports Tcl/Tk 8.4 as long as you use a release version of
CMake > 1.4.5. Since VTK 4.2 will require CMake 1.6, the next release version will support Tcl/Tk 8.4.
2. The VTK 4.0 release distribution does not support Tcl/Tk 8.4 out-of-the-box.
In either cases, the following solutions will adress the problem. This basically involves setting two definition
symbols that will make Tcl/Tk 8.4 backward compatible with previous versions of Tcl/Tk (i.e. discard the "const
correctness" and Tk_PhotoPutBlock compositing rule features) :
a) Edit your C/C++ flags:
Run your favorite CMake cache editor (i.e. CMakeSetup, or ccmake), display the advanced values and add the
USE_NON_CONST and USE_COMPOSITELESS_PHOTO_PUT_BLOCK definition symbols to the end of any of
the following CMake variables (if they exist): CMAKE_CXX_FLAGS, CMAKE_C_FLAGS.
Example: On Unix your CMAKE_CXX_FLAGS will probably look like:
-g -O2 -DUSE_NON_CONST -DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK
On Windows (Microsoft MSDev nmake mode):
/W3 /Zm1000 /GX /GR /YX /DUSE_NON_CONST /DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK
b) or a more intrusive solution:
Edit the top VTK/CMakeList.txt file and the following lines add at the top of this file:
ADD_DEFINITIONS(
-DUSE_NON_CONST
-DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK
)
VTK/FAQ 6
When I try to run my program with Java-wrapped VTK, why do I get
"java.lang.NoClassDefFoundError: vtk/vtkSomeClassName"?
The file vtk.jar is not in your CLASSPATH in your execution environment.
When I try to run my program with Java-wrapped VTK, why do I get
"java.lang.UnsatisfiedLinkError: no vtkSomeLibraryName"?
Some or all of the library (e.g., dll) files cannot be found. Make sure the files exist and that the PATH environment
variable of your execution environment points to them.
Using VTK
The C++ compiler cannot convert some pointer type to another pointer type in my little
program
For instance, the C++ compiler cannot convert a vtkDataSet * type to a vtkImageData * type.
It means the compiler does not know the relationship between a vtkDataSet and a vtkImageData. This
relationship is actually inheritance: vtkImageData is a subclass of vtkDataSet. The only way for the
compiler to know this relationship is to include the header file of the subclass, that is:
#include "vtkImageData.h"
If you wonder why the compiler did not complain about an unknown type, it is because somewhere (probably in a
filter header file) there is a forward class declaration, like:
class vtkImageData;
Accessing a pointer in Python
If you use VTK code with Python and need to pass some VTK data onto them, there are 2 approaches to wrap your
code:
1. first, you can use the VTK wrapper (already used for the wrapping of VTK code)
2. you can use SWIG, which results in a light-weight module.
In the second case, you will need to convert some VTK data, say a vtkPolyData, to a void pointer (no, it is not
sufficient to just pass the object). For that, you can use the __this__ member variable in Python for the VTK data -
see mailing archives:
• vtk, Python and SWIG - 'state of the union' [9]
What object/filter should I use to do ???
Frequently when starting out with a large visualization system people are not sure what object to use to achieve a
desired effect.
The most up-to-date information can be found in the VTK User's Guide (http:/ / www. kitware. com/ products/
vtkguide. html).
Alternative sources for information are the appendix of the book which has nice one line descriptions of what the
different objects do and the VTK man pages (http:/ / www. vtk. org/ doc/ nightly/ html/ classes. html).
Additionally, the VTK man pages feature a "Related" section that provide links from each class to all the examples
or tests using that class (http:/ / www. vtk. org/ doc/ nightly/ html/ pages. html). This information is also provided in
each class man page under the "Tests" or "Examples" sub-section.
Some useful books are listed at http:/ / www. vtk. org/ buy-books. php
VTK/FAQ 7
What 3D file formats can VTK import and export?
The following table identifies the file formats that VTK can read and write. Importer and Exporter classes move full
scene information into or out of VTK. Reader and Writer classes move just geometry.
File Format Read Write
3D Studio vtk3DSImporter
AVS "UCD" format vtkAVSucdReader
Movie BYU vtkBYUReader vtkBYUWriter
Renderman vtkRIBExporter
Open Inventor 2.0 vtkIVExporter/vtkIVWriter
CAD STL vtkSTLReader vtkSTLWriter
Fluent GAMBIT ASCII vtkGAMBITReader
Unigraphics Facet Files vtkUGFacetReader
Marching Cubes vtkMCubesReader vtkMCubesWriter
Wavefront OBJ vtkOBJExporter
VRML 2.0 vtkVRMLExporter
VTK Structured Grid † vtkStructuredGridReader vtkStructuredWriter
VTK Poly Data † vtkPolyDataReader vtkPolyDataWriter
PLOT3D vtkPLOT3DReader
CGM vtkCGMWriter
OBJ vtkOBJReader
Particle vtkParticleReader
PDB vtkPDBReader
PLY vtkPLYReader vtkPLYWriter
Gaussian vtkGaussianCubeReader
Facet vtkFacetReader vtkFacetWriter
XYZ vtkXYZMolReader
Ensight ‡ vtkGenericEnSightReader
† See the books The Visualization Toolkit, An Object-Oriented Approach to 3D Graphics [1] or the User's Guide [3]
for details about structured grid and poly data file formats.
‡ The class vtkGenericEnSightReader allows the user to read an EnSight data set without a priori knowledge of what
type of EnSight data set it is (among vtkEnSight6BinaryReader, vtkEnSight6Reader, vtkEnSightGoldBinaryReader,
vtkEnSightGoldReader, vtkEnSightMasterServerReader, vtkEnSightReader).
For any other file format you may want to search for a converter to a known VTK file format, more info on: http:/ /
www. tech-edv. co. at/ lunix/ UTILlinks. html
VTK/FAQ 8
Why can't I find vtktcl (vtktcl.c)?
In versions of VTK prior to 4.0 VTK Tcl scripts would require a:
catch {load vtktcl}
so that they could be executed directly from wish. In VTK 4.0 the correct mechanism is to use:
package require vtk
For people using versions earlier than 4.0, vtktcl is a shared library that is built only on the PC. Most examples used
the "catch" notation so that they will work on UNIX and on the PC. On UNIX you must use the vtk executable/shell
which should be in vtk/tcl/vtk.
Why does this filter not produce any output? eg. GetPoints()==0
This is a very common question for VTK users. VTK uses a pipeline mechanism for rendering, which has multiple
benefits, including the fact that filters that aren't used don't get called. This means that when you call a function such
as x->GetOutput()->GetPoints() this will return 0 if the filter has not yet been executed. Just call x->Update()
beforehand to make the pipeline update everything up to that point and it should work. -timh
Problems with vtkDecimate and vtkDecimatePro
vtkDecimate and vtkDecimatePro have been tested fairly heavily so all known bugs have been removed. However,
there are three situations where you can encounter weird behavior:
1. The mesh is not all triangles. Solution: use vtkTriangleFilter to triangulate polygons.
2. The mesh consists of independent triangles (i.e., not joined at vertices - no decimation occurs). Solution: use
vtkCleanPolyData to link triangles.
3. Bad triangles are present: e.g., triangles with duplicate vertices such as (1,2,1) or (100,100,112), or (57,57,57),
and so on. Solution: use vtkCleanPolyData.
How can I read DICOM files ?
Starting with VTK 4.4, you can use the vtkDICOMImageReader class [10] to read DICOM files. Note however that
DICOM is a huge protocol, and vtkDICOMImageReader is not able to read every DICOM file out there. If it does
not meet your needs, we suggest you look for an existing converter before coding your own. Some of them are listed
in the The Medical Image Format FAQ (Part 8) [11].
GDCM
For a more elaborate DICOM library that supports more image format, you might try GDCM [12]. Specifically:
vtkGDCMImageReader [13] & vtkGDCMImageWriter [14]
Grassroots DiCoM is a C++ library for DICOM medical files. It is automatically wrapped to python/C#/Java (using
swig). It supports RAW,JPEG (lossy/lossless),J2K,JPEG-LS,RLE and deflated. It also comes with DICOM Part 3,6
& 7 of the stand
本文档为【VTK_FAQ】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。