Unstructured Grid to binary array #6042
Unanswered
koenterheegde0507
asked this question in
Q&A
Replies: 2 comments 1 reply
-
This isn't a full solution but you could try:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
I found out that I have another issue: The polydata I generate from the marching cubes algorithm generates a surface instead of a volume. I do need the whole volume as a binary array for the rest of my code to work. So I either have to find a way to visualize and edit this volume in 3D, so I don't need to use marching cubes anymore or I have to find a way to go from a surface mesh to a volumetric mesh and then do the steps that you gave. Do you have any idea how to solve this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First check
Commit to Help
Sample Code What is the problem, question, or error?
Write a short description telling me what you are doing, what you expect to happen, and what is currently happening.
Description
I'm currently struggling to obtain a binary array from either my mesh or an unstructured grid. Context: I generate a polydata from a marching cubes algorithm, based on a binary volume as input from a CT scan segmentation. I then want to edit this mesh in 3D and therefore have to cast it to an unstructured grid. Once I'm done editing the grid, I go back to a mesh again, and that's where this code starts. I generate the mesh using
final_mesh = grid.extract_surface()
. The reason I do this is because I saw this issue: pyvista/pyvista-support#141, in which they also start with a mesh and I can't find any solution on how to go from an unstructured grid to binary array immediately. Anyway, I use the code that was used in this issue, but it doesn't seem to work in my case.This is my unstructured grid:
And this is binary mask:
Anyone knows what I'm doing wrong or has any other approach?
Appreciate the help!
System Information
Screenshots
No response
Beta Was this translation helpful? Give feedback.
All reactions