astrovascpy.vtk_io¶
file taken from https://github.com/eleftherioszisis/VasculatureRepair.
Functions
|
Create a PolyData vtk object from a set of points. |
|
Create a cell array with specified name and assigns the numpy array arr. |
|
Convert a list of edges into vtk lines. |
|
Extract from a vtk file the points, edges, radii and types. |
|
Convert an array of numpy points to vtk points. |
|
Create a vtk legacy file and populate it with a polydata object. |
- astrovascpy.vtk_io.create_polydata_from_data(points, edges, attribute_dict={})¶
Create a PolyData vtk object from a set of points.
Points are connected with edges and optionally have a set of attributes.
- Parameters:
points (np.array) – section’s points.
edges (np.array) – edges of the graph.
attribute_dict (dict) – to store attributes.
- Returns:
PolyData vtk object.
- Return type:
vtkPolyData
- astrovascpy.vtk_io.vtk_attribute_array(name, arr)¶
Create a cell array with specified name and assigns the numpy array arr.
- Parameters:
name (str) – name of the cell array.
arr (np.array) – assigned to the cell array.
- Returns:
cell array with specified name and assigns the numpy array arr.
- Return type:
vtkCellArray
- astrovascpy.vtk_io.vtk_lines(edges)¶
Convert a list of edges into vtk lines.
- Parameters:
edges (np.array) – edges of the graph.
- Returns:
vtk lines.
- Return type:
vtkCellArray
- astrovascpy.vtk_io.vtk_loader(filename)¶
Extract from a vtk file the points, edges, radii and types.
- Parameters:
filename (str) – name of the file.
- Returns:
points, edges and radii.
- Return type:
np.array
- astrovascpy.vtk_io.vtk_points(points)¶
Convert an array of numpy points to vtk points.
- Parameters:
points (np.array) – section’ points.
- Returns:
3D points, an array of vx-vy-vz triplets accessible by (point or cell) id.
- Return type:
vtkPoints
- astrovascpy.vtk_io.vtk_writer(filename, points, edges, radii, types, mode='ascii', extra_properties=None)¶
Create a vtk legacy file and populate it with a polydata object.
Polydata object is generated using the points, edges, radii and types.
- Parameters:
filename (str) – name of the file.
points (np.array) – shape: (n_nodes, 3).
edges (np.array) – shape: (n_edges, 2).
radii (np.array) – shape: (n_edges, 2).
types (np.array) – shape: (n_edges, 2).
mode (str) – ascii or binary
extra_properties (iterable of callables) – add extra property computation functions
included. (that are not)