VTK ImageData#
.vti read + write eager
Summary of the specification#
.vti is the XML serial form of a VTK ImageData: a uniform grid stored entirely as metadata. A <VTKFile type="ImageData"> root holds an <ImageData> carrying WholeExtent, Origin and Spacing — the index range on each axis, the coordinate of the first node, and the constant step between nodes. There are no coordinates in the file at all; every node position follows from origin + index * spacing, and the cells are the hexahedra implied by the extent. Only <PointData> and <CellData> arrays carry actual payload, encoded like any other VTK XML file.
Specification at a glance#
root |
<VTKFile type=”ImageData”> |
extent |
WholeExtent=”i0 i1 j0 j1 k0 k1” |
geometry |
Origin + Spacing; no coordinate array |
connectivity |
implicit; cells follow from the extent |
encodings |
ascii, base64, appended (raw or base64), optionally zlib-compressed |
Reading#
import polyxios as px
mesh = px.read("volume.vti")
mesh.vertices # materialised from origin + index * spacing
Writing#
px.write(mesh, "out.vti") # base64 payloads (default)
px.write(mesh, "out.vti", binary=False) # inline ASCII
option |
meaning |
|---|---|
|
|
Quirks worth knowing#
Both the coordinates and the connectivity are materialised on read. A file of a few hundred bytes can expand to a large in-memory mesh, because the extent is all it takes to describe one.
Origindefaults to0 0 0andSpacingto1 1 1when the attributes are absent.A
<Piece>may restate a sub-extent ofWholeExtent; the piece’s own extent is what gets expanded.lazy=TrueraisesLazyReadError.
See also
Supported formats — the full format table. VTK StructuredGrid — the curvilinear structured sibling.