morphogen.io.vtk¶
VTK files: XML image data (.vti), legacy structured points (.vtk), unstructured grids (.vtu).
Voxel values are stored as cell data, x varying fastest. XML files use appended raw binary data, optionally zlib-compressed; the reader also accepts base64 and ASCII data written by other VTK-based tools.
- morphogen.io.vtk.write_vti(path, images, *, compress: bool = True) Path[source]¶
Write one or several images on the same grid to a VTK XML ImageData file.
- morphogen.io.vtk.vti_names(path) list[str][source]¶
Names of the scalar arrays of a VTK XML ImageData file, from its header alone.
- morphogen.io.vtk.read_vti(path, names=None) list[VoxelImage][source]¶
Read the cell (or point) arrays of a VTK XML ImageData file (only those called
names, if given:vti_names()lists them).
- morphogen.io.vtk.write_vtk(path, images, *, binary: bool = True) Path[source]¶
Legacy VTK STRUCTURED_POINTS with cell data (big-endian binary or ASCII).
- morphogen.io.vtk.read_vtk(path) list[VoxelImage][source]¶
Read scalar arrays of a legacy STRUCTURED_POINTS file (cell or point data).
- morphogen.io.vtk.write_vtu(path, points, cells, cell_type: int, cell_data: dict | None = None, *, point_data: dict | None = None, field_data: dict | None = None, compress: bool = True) Path[source]¶
VTK XML UnstructuredGrid with a single cell type.
Cell types: 12 hexahedron, 10 tetrahedron, 24 quadratic tetrahedron, 5 triangle.
cell_dataandpoint_datamap names to arrays of one value (shape(n,)) or several components (shape(n, k)) per cell or point;field_datato small arrays describing the whole grid.
- morphogen.io.vtk.read_vtu(path) dict[source]¶
Minimal reader of the files written by
write_vtu()(points, cells, data).
- morphogen.io.vtk.read_vtk_grid(path) dict[source]¶
A legacy VTK file of an unstructured grid (ASCII or binary; the cells as counts and nodes, or as the
OFFSETSandCONNECTIVITYof VTK 5.1), e.g. an animation of OpenRadioss converted by itsanim_to_vtk:points,offsets(n + 1),connectivity,types,cell_dataandpoint_data(name -> values:SCALARSof one or more components,VECTORS,TENSORS(n, 9),NORMALSand the arrays ofFIELDblocks) andfield_data(theFIELDarrays given before the data of the points and cells).cells_of_type()picks the cells of one type.
- morphogen.io.vtk.cells_of_type(grid: dict, cell_type: int) tuple[ndarray, ndarray][source]¶
The cells of one VTK type of a grid of
read_vtk_grid(): their nodes (n, k) and their indices among the cells (for their data).