geometrical_tortuosity

Import packages

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

ps.visualization.set_mpl_style()
np.random.seed(50);

Genearate image for testing

[2]:
im2d = ps.generators.blobs(shape=[300, 300], porosity=0.6, blobiness=2)
im3d = ps.generators.blobs(shape=[100, 100, 60], porosity=0.6, blobiness=0.8)

fig, ax = plt.subplots(1, 2, figsize=[8, 4])
ax[0].imshow(im2d)
ax[1].imshow(im3d[:, :, 5])
ax[0].set_title('2D image')
ax[1].set_title('A slice of 3D image');
../../../_images/examples_metrics_howtos_geometrical_tortuosity_4_0.svg

Apply metric functions

geometrical_tortuosity

[3]:
result2d = ps.metrics.geometrical_tortuosity(im=im2d)
print('geometrical tortuosity for 2D image=', result2d)
result3d = ps.metrics.geometrical_tortuosity(im=im3d)
print('geometrical tortuosity for 3D image=', result3d)
geometrical tortuosity for 2D image= 1.3045150669510481
geometrical tortuosity for 3D image= 1.471115613445628