porosity

Import packages

[1]:
import matplotlib.pyplot as plt
import numpy as np
import porespy as ps

ps.visualization.set_mpl_style()
np.random.seed(10)

Genearate image for testing

[2]:
skel = ps.generators.blobs(shape=[500, 500])
im = ps.filters.prune_branches(skel)
fig, ax = plt.subplots()
ax.imshow(im, origin="lower");
../../../_images/examples_metrics_howtos_porosity_4_0.svg

Apply metric function

Output is the porosity of the input.

[3]:
ps.metrics.porosity(im=im)
[3]:
0.487568