Transferring PolyData Faces into a Numpy Array
See original GitHub issueA fast way to transfer the face data, as stored in the Polydata object, into a Numpy object array containing the indexes of all the points of each simplex.
This should be a fairly simple for loop in C, I would add it myself, but I A) don’t know C yet, and B) don’t know how to integrate C and Python. However, the pseudocode in Python could look something like this:
simplexes = []
index = 0
while index < face_array.shape[0]:
number_of_points = face_array[index]
points = face_array[index+1:index+1+number_of_points]
simplexes.append(points)```
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
pyvista.PolyData — PyVista 0.37.0 documentation
The line connectivity array. Like faces , this array requires padding indicating the number of points in a line segment. For example, the...
Read more >Reading a .VTK polydata file and converting it into Numpy array
You can use dataset_adapter from vtk.numpy_interface : from vtk.numpy_interface import dataset_adapter as dsa polydata = reader.
Read more >Import Surface data from Pyvista (Vertices, Face)
PolyData (arr_3d) surf = cloud.delaunay_2d() verts = surf.points # Dim: ... As you note napari above is expecting faces in an Nx3 array....
Read more >Working With Numpy Arrays - the Vascular Modelling Toolkit
Cell Data. In order to make use of the data in numpy/python, we create a unique numpy array for every VTK array defining...
Read more >Converting your NumPy arrays to VTK arrays and files
Well, as if there weren't enough deterrents in employing VTK, you will quickly realize that using your precious data – which let's face...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’d definitely be nice to have an official solution for this.
Maybe:
For meshes with uniform cell types (all tirangles or all quads), we could modify @darikg’s to the following wich would return an
ndarray
withint64
dtype