API Documentation¶
Vtk Actors¶
Vtk PolyData¶
Vtk PolyData usually wraps multiple data types (e.g. Vertices, Edges) into a single data type. In VTK, they are used to define how an actor is rendered. We return the data-only representation for an object here and define the visual options in the actors module.
-
numpy2vtk.data.vertices(points, z_index=0)[source]¶ Returns the VTK-representation of a number of vertices that are defined by the points array.
Parameters: - points (numpy.ndarray<float> or vtk.vtkPoints) – The points that the mesh consist of. If it’s a numpy array it should be of dimensions (n,2) or (n,3)
- z_index (float) – The value the z-value of 2d-points is filled with (only applicable for (n,2) input arrays)
Returns: vertices_data – VTK polydata representation of the vertices
Return type: vtk.vtkPolyData
-
numpy2vtk.data.line(points, z_index=0, closed=False)[source]¶ Returns the VTK-representation of a line that is build from the points in the numpy array.
Parameters: - points (numpy.ndarray<float> or vtk.vtkPoints) – The points that the line consist of. If it’s a numpy array it should be of dimensions (n,2) or (n,3)
- z_index (float) – The value the z-value of 2d-points is filled with (only applicable for (n,2) input arrays)
- closed (bool) – Whether the last point of the line should be connected with the first one
Returns: line_data – VTK polydata representation of the line
Return type: vtk.vtkPolyData
-
numpy2vtk.data.mesh(points, polys, z_index=0)[source]¶ Returns the VTK-representation of a mesh that is build by creating the patches specified by points and polys. Points are the considered points and polys consists of an array of patches (which consist of indices into the points array).
Parameters: - points (numpy.ndarray<float> or vtk.vtkPoints) – The points that the mesh consist of. If it’s a numpy array it should be of dimensions (n,2) or (n,3)
- polys (numpy.ndarray<int>) – Array of patches, should be of shape nxm for n patches with m points per patch
- z_index (float) – The value the z-value of 2d-points is filled with (only applicable for (n,2) input arrays)
Returns: poly_data – VTK polydata representation of the mesh
Return type: vtk.vtkPolyData
Raw Vtk Data¶
The data.raw module is the lowest representation of data in VTK. These are primarily used to update the data of the actors.
-
numpy2vtk.data.raw.points(coordinates, z_index=0)[source]¶ Returns the raw VTK-representation of the points in the passed numpy array
Parameters: - coordinates (numpy.ndarray<float>) – numpy.ndarray of shape (n,2) or (n,3) that contains the points
- z_index (float) – The value the z-value of 2d-points is filled with (only applicable for (n,2) input arrays)
Returns: vtk_points – VTK representation of the points
Return type: vtk.vtkPoints
-
numpy2vtk.data.raw.vertices(indices)[source]¶ Maps a numpy ndarray of shape (n,) to an vtkCellArray of vertex indices
Parameters: indices (numpy.ndarray<int>) – A numpy.ndarray of shape (n,) of indices that defines the n vertices Returns: vtk_vertices – VTK representation of the vertices Return type: vtk.vtkCellArray
-
numpy2vtk.data.raw.edges(indices)[source]¶ Maps a numpy ndarray to an vtkCellArray of vtkLines
Parameters: indices (numpy.ndarray<int>) – A numpy.ndarray of shape (n,2) of indices that define n edges Returns: vtk_lines – VTK representation of the edges Return type: vtk.vtkCellArray
-
numpy2vtk.data.raw.polygons(indices)[source]¶ Maps a numpy ndarray to an vtkCellArray of vtkPolygons
Parameters: indices (numpy.ndarray<int>) – A numpy.ndarray of shape (n,m) of indices that define n polygons with m points each Returns: vtk_polygons – VTK representation of the polygons Return type: vtk.vtkCellArray