Extracting Pores from a CT Image and Visualizing in ParaView #2936
Replies: 5 comments 6 replies
-
I think the solution is simple: You need to convert your image from greyscale to binary. The numpy array needs to be True for voxels which are void and False for voxels which are solid. This is called segmentation. It's easy in principle, but takes some effort. Hopefully this tutorial helps. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Despite visualizing based on the tutorial, I was unable to resolve my concerns. I am still struggling with understanding why the throats do not connect all the pores and why, even though I input the actual voxel size of 0.055 instead of 1 in the scaling adjustment section, the pore sizes are visualized as if they are the same. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your assistance. I used basalt CT images as input
data. I have created two folders: one contains the original TIFF images,
and the other contains the binarized images. Inside the folder with the
binarized images, there is also the VTK file I used for visualization,
named final_network.vtp. Could you please check if there are any steps I
missed during the code implementation or the visualization modeling
process? I want to ensure that the visualization I conducted was done
correctly. Thank you, Professor.
https://www.dropbox.com/scl/fo/b04fniteea6is7s5ar2hz/ABSv4o3-8fER_Y7JD2DBuVg?rlkey=cth423wrewud3igx9y889rubb&e=1&st=nsdyayib&dl=0
2024년 8월 28일 (수) 오전 6:39, jgostick ***@***.***>님이 작성:
… How about you send me your image and I'll see what's wrong with them. Put
the images on dropbox (or equivalent) and send a link to my email, either
uwaterloo or gmail works.
—
Reply to this email directly, view it on GitHub
<#2936 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BKVCKR3U6H5O4X3F3ZXYOP3ZTTWZRAVCNFSM6AAAAABM2GHNCOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBWG44DQOI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I understood which part I was missing. I thought I had to zoom in to see
the connectivity of the pore closely, so I think I used low quality and a
small number of images. I think I'll have to re-implement it with the
number of photos and high quality images. I was wondering if shape 300,
300, 300 would be okay, so I'm going to re-produce it and try it, but I'm
glad if there's nothing I missed in the code I implemented. When I only
looked at the pore network model, the connectivity seemed to be low, so I
didn't get the transmittance.
2024년 8월 29일 (목) 오전 2:40, jgostick ***@***.***>님이 작성:
… I have taken a look at your images, and I think the problem starts there.
They are too small and their resolution is too low. Maybe you have only
uploaded 'low res' version, but if these are the only images you have then
they are not sufficient. Because the resolution is so low, you cannot see
any connections between the pore bodies. This is why you are getting only
isolated pores...because this is what your images has. Assuming you can get
higher resolution images, I am still not sure that you will have success.
It looks to me like these pore bodies are almost completely isolated from
their neighbors. I have never worked with Basalt, but perhaps this is one
of their main characteristics? What is the permeability of these materials?
I am guess it is quite low, meaning that these pore bodies are not well
connected.
—
Reply to this email directly, view it on GitHub
<#2936 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BKVCKR2AKD6BL2P2KGDDKV3ZTYDRNAVCNFSM6AAAAABM2GHNCOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBXHAZDOMA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Dear Professor,
I have learned from various experiments and modeling using CT images with OPENPNM, and I realized that its utility is very high. I am currently studying OPENPNM and would like to extract pores from my CT image and visualize them using ParaView.
However, as a beginner with OPENPNM, I used the snow extraction advanced method from Porespy as it is. The tutorial used artificial images, but I have converted my CT scan stack (515 TIFF images) into a numpy.ndarray format. To verify if ParaView can load 3D images, I converted the numpy.ndarray file into a VTK file, and upon opening it in ParaView, I was able to see it in 3D, as shown in the image below. Since I need to extract pores and create a pore network model from this 3D image, I used the same code as in the tutorial.
However, unlike the tutorial, I am encountering an issue where all peak values are coming out as 1, which prevents the pore network model from being constructed.
Could you please help me understand what steps I might be missing? I look forward to your detailed guidance.
Thank you.
This image does not include pore extraction; it only represents the 3D visualization of the image.
import imageio
import numpy as np
import porespy as ps
import openpnm as op
import scipy.ndimage as spim
import matplotlib.pyplot as plt
from porespy.filters import find_peaks, trim_saddle_points, trim_nearby_peaks
from porespy.tools import randomize_colors
from skimage.segmentation import watershed
ps.settings.tqdm['disable'] = True
ps.visualization.set_mpl_style()
np.random.seed(10)
file_path = r"C:\Users\user\Desktop\lab\cube_515\3d_image.npy"
im = np.load(file_path)
im.shape, type(im)
fig, ax = plt.subplots()
ax.imshow(ps.visualization.show_planes(im), cmap=plt.cm.bone);
sigma = 0.4
dt = spim.distance_transform_edt(input=im)
dt1 = spim.gaussian_filter(input=dt, sigma=sigma)
peaks = find_peaks(dt=dt)
print('Initial number of peaks: ', spim.label(peaks)[1])
peaks = trim_saddle_points(peaks=peaks, dt=dt1)
print('Peaks after trimming saddle points: ', spim.label(peaks)[1])
peaks = trim_nearby_peaks(peaks=peaks, dt=dt)
peaks, N = spim.label(peaks)
print('Peaks after trimming nearby peaks: ', N)
regions = watershed(image=-dt, markers=peaks, mask=dt > 0)
regions = randomize_colors(regions)
fig, ax = plt.subplots()
ax.imshow((regions*im), cmap=plt.cm.nipy_spectral);
net = ps.networks.regions_to_network(regions*im, voxel_size=1)
pn = op.io.network_from_porespy(net)
print(pn)
im = ps.tools.align_image_with_openpnm(im)
imageio.volsave('image.tif', np.array(im, dtype=np.int8))
op.io.project_to_vtk(project=pn.project)
Beta Was this translation helpful? Give feedback.
All reactions