How to extract pores from an image and export it to paraview #2751
Unanswered
UnaisAshraf
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I'm not totally sure what you're trying to do, but I don't think that assigning the result of np.where to the pore.coords is what you want. We have a number of tutorials on the porespy website that explain how pore network extraction works, so I suggest you start there. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Professor Jeff,
I hope this email finds you well. I started learning openpnm recently. I am trying to extract the pores from an image in openpnm and export it to paraview to see it in 3D but its not working. I tried different codes but its not working. Please help.
This is my code:
import numpy as np
from skimage import io, filters, morphology
import openpnm as op
import os
current_directory = os.getcwd()
from skimage import color
im = io.imread('C:/Users/unais/Downloads/poresys_2d.png')
im_gray = color.rgb2gray(im)
im_binary = im_gray > filters.threshold_otsu(im_gray)
im_binary_clean = morphology.binary_closing(im_binary)
pn = op.network.Cubic(shape=im_binary_clean.shape, spacing=1, connectivity=20)
pn['pore.all'] = True
pn['pore.coords'] = np.argwhere(im_binary_clean)
pn.add_model_collection(op.models.collections.geometry.spheres_and_cylinders)
path_to_file = current_directory
op.io._vtk.project_to_vtk(pn.project, filename=path_to_file+'/Paraview1_net')
I am trying to extract the pores from this picture below:

when i export it to paraview. It shows this " Cannot read points array from Points in piece 0. The data array in the element may be too short." Can you please tell me what the problem is?
I would really appreciate your help.
Beta Was this translation helpful? Give feedback.
All reactions