If you'd like to use a more "pythonic" interface to VTK, consider using mayavi
/tvtk
/mlab
. (Either way, VTK is an excellent choice for this!)
tvtk
is a slightly more pythonic, low-level, python binding to VTK with a handful of really nice features (e.g. transparent usage of numpy arrays).
Mayavi and mlab give a more high-level interface to VTK.
The snippet of the data file that you showed is invalid as-is, but if we use a similar one:
# vtk DataFile Version 2.0
Simple VTK file example
ASCII
DATASET POLYDATA
POINTS 9 float
3.0 0.0 0.0
1.0 1.0 0.0
0.0 3.0 0.0
3.0 0.0 1.0
1.0 1.0 1.0
0.0 3.0 1.0
3.0 2.0 2.0
2.0 2.0 2.0
2.0 3.0 2.0
TRIANGLE_STRIPS 2 14
6 0 3 1 4 2 5
6 3 6 4 7 5 8
POINT_DATA 9
SCALARS nodal float
LOOKUP_TABLE default
0.0 0.1 0.0 0.3 0.6 0.3 0.8 1.0 0.8
Rendering contours on the surface can be as simple as:
from mayavi import mlab
source = mlab.pipeline.open('test.vtk')
lines = mlab.pipeline.contour_surface(source)
mlab.show()
Or we can get a bit fancier:
from mayavi import mlab
# Make a figure with a black background
fig = mlab.figure(bgcolor=(0,0,0))
# Also see methods like: fig.scene.z_plus_view(), etc
fig.scene.camera.azimuth(215)
source = mlab.pipeline.open('test.vtk')
# Show the surface, colored by the scalars
surf = mlab.pipeline.surface(source)
# Draw contours of the scalars on the surface
lines = mlab.pipeline.contour_surface(source)
mlab.show()