snow_partitioning_n
#
Similar to snow_partitioning
except that it works on an image containing an arbitrary number of phases
Import packages#
import numpy as np
import porespy as ps
import scipy.ndimage as spim
import matplotlib.pyplot as plt
import skimage
ps.visualization.set_mpl_style()
np.random.seed(0)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/openpnm/algorithms/_invasion_percolation.py:358: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
def _find_trapped_pores(inv_seq, indices, indptr, outlets): # pragma: no cover
im
#
Generate a test 3 phase image by overlaying two 2 phase images. This works with 3D images as well.
im1 = ps.generators.blobs(shape=[200, 200], porosity=0.5, blobiness=0.75)
im2 = ps.generators.blobs(shape=[200, 200], porosity=0.5, blobiness=0.5)
im = im1.astype(int) + im2.astype(int)
plt.figure(figsize=[6, 6])
plt.axis(False)
plt.imshow(im);

Apply snow_partitioning_n
filter#
The Results
of the filter includes several images
snow = ps.filters.snow_partitioning_n(im)
print(snow)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Results of snow_partitioning_n generated at Tue Jun 6 13:50:18 2023
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
im Array of size (200, 200)
dt Array of size (200, 200)
phase_max_label [65, 102]
regions Array of size (200, 200)
peaks Array of size (200, 200)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
fig, ax = plt.subplots(1, 2, figsize=[12, 12])
ax[0].imshow(snow.dt/im/~snow.peaks, origin='lower', interpolation='none')
ax[0].axis(False)
ax[1].imshow(snow.regions/im, origin='lower', interpolation='none')
ax[1].axis(False);
