region_interface_areas

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)
r = ps.filters.snow_partitioning(im)
regions = r.regions
areas = ps.metrics.region_surface_areas(regions, voxel_size=1, strel=None)
fig, ax = plt.subplots()
ax.imshow(regions, origin="lower");
../../../_images/examples_metrics_howtos_region_interface_areas_4_1.svg

Apply metric function

Output is a tuple with elements conns and area.

default

[3]:
voxel_size = 1
strel = None
x = ps.metrics.region_interface_areas(regions=regions, areas=areas)
[4]:
fig, ax = plt.subplots()
ax.plot(np.arange(0, len(x.conns)), x.area, '*')

ax.set_xlabel("throat number")
ax.set_ylabel("interface area");
../../../_images/examples_metrics_howtos_region_interface_areas_9_0.svg

voxel_size

[5]:
x = ps.metrics.region_interface_areas(regions=regions,
                                      areas=areas,
                                      voxel_size=10)
[6]:
fig, ax = plt.subplots()
ax.plot(np.arange(0, len(x.conns)), x.area, '*')

ax.set_xlabel("throat number")
ax.set_ylabel("interface area");
../../../_images/examples_metrics_howtos_region_interface_areas_12_0.svg