spateo.tdr.models.utilities.io

Functions

read_model(filename)

Read any file type supported by vtk or meshio.

save_model(model, filename[, binary, texture])

Save the pvvista/vtk model to vtk/vtm file.

Module Contents

spateo.tdr.models.utilities.io.read_model(filename: str)[source]

Read any file type supported by vtk or meshio. :param filename: The string path to the file to read.

Returns:

Wrapped PyVista dataset.

spateo.tdr.models.utilities.io.save_model(model: pyvista.DataSet | pyvista.MultiBlock, filename: str, binary: bool = True, texture: str | numpy.ndarray = None)[source]

Save the pvvista/vtk model to vtk/vtm file. :param model: A reconstructed model. :param filename: Filename of output file. Writer type is inferred from the extension of the filename.

If model is a pyvista.MultiBlock object, please enter a filename ending with .vtm; else please enter a filename ending with .vtk.

Parameters:
binary

If True, write as binary. Otherwise, write as ASCII. Binary files write much faster than ASCII and have a smaller file size.

texture

Write a single texture array to file when using a PLY file.

Texture array must be a 3 or 4 component array with the datatype np.uint8. Array may be a cell array or a point array, and may also be a string if the array already exists in the PolyData.

If a string is provided, the texture array will be saved to disk as that name. If an array is provided, the texture array will be saved as ‘RGBA’