This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

VTK (.vtk)

Visualization Toolkit format.
Used for storage of 3D models.
Native format of the open-source Visualization Toolkit software.
ASCII or binary format.
VTK is an acronym derived from Visualization Toolkit.
Stores a single 3D object as a collection of line, point, and polygon primitives and their properties.
Can also store nonlinear graphics primitives.
Allows user-defined format elements.
Originally developed by Kitware.
  • Import and Export are fully compatible with the ASCII and binary versions of the VTK format.
  • Import imports the polygon information from a VTK file and returns it as a Graphics3D object.
  • Import imports the specified element from a VTK file.
  • Import imports multiple elements.
  • Export creates a VTK file by treating expr as specifying element elem.
  • Export treats each as specifying the corresponding .
  • Export exports expr with the specified option elements taken to have the specified values.
  • Export uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties, and settings
  • Data representation elements:
"CuboidData"cuboid data in indexed form
"CuboidObjects"list of Cuboid primitives given in absolute coordinates
"Graphics3D"VTK file represented as a Graphics3D object
"GraphicsComplex"VTK file as a GraphicsComplex object
"LineData"the line elements of a VTK file in indexed form, with integer indices referencing the vertices as given by
"LineObjects"list of Line primitives given in absolute coordinates
"PolygonData"the polygon elements in indexed form
"PolygonObjects"list of Polygon primitives given in absolute coordinates
"VertexData"list of vertex coordinates
"PointData"point data in indexed form
"PointObjects"list of Point primitives given in absolute coordinates
BackgroundAutomaticwhat background color to use
ImageSizeAutomaticoverall size of the graphics to display
LightingAutomaticwhat simulated lighting to use in coloring 3D surfaces
  • All options of Graphics3D can be given when importing from VTK.
"BinaryFormat"Falsewhether to create a binary VTK file
  • Advanced option:
"VerticalAxis"{0,0,1}orientation to assume for the coordinate system used in the file
  • By default, Mathematica assumes that in the coordinate system used by the VTK format the vertical axis corresponds to the third coordinate.
  • With the setting , Mathematica will apply the transformation to all graphics coordinates when importing from VTK, and the inverse transformation when exporting to VTK.
Import a VTK file:
Export a 3D model to an ASCII VTK file:
Retrieve a list of available elements:
Directional red light:
Points-based representation of the model:
Import a VTK file:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
 
Export a 3D model to an ASCII VTK file:
In[1]:=
Click for copyable input
Out[1]=
 
Retrieve a list of available elements:
In[1]:=
Click for copyable input
Out[1]=
Directional red light:
In[1]:=
Click for copyable input
Out[1]=
 
Points-based representation of the model:
In[1]:=
Click for copyable input
Out[1]=