make_contiguous
¶
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()
[03:06:19] ERROR PARDISO solver not installed, run `pip install pypardiso`. Otherwise, _workspace.py:56 simulations will be slow. Apple M chips not supported.
Generate image for testing¶
im = np.random.randint(-10,10, [10,10], int)
print(im)
[[ 9 -4 -5 -6 -1 5 5 3 -10 0]
[ 8 0 7 0 4 1 8 3 4 3]
[ -5 -5 8 -8 5 -6 -1 -8 5 5]
[ -5 0 2 -7 -6 6 1 -10 -10 -2]
[ -9 8 -9 2 -5 3 4 3 7 -1]
[ 1 -4 -8 4 1 -1 -8 9 9 -1]
[ -4 3 3 -4 5 -1 -2 -8 3 -1]
[ 9 5 6 -6 -8 -6 2 -6 -5 -3]
[ 1 1 -7 -9 -2 -10 8 -5 -5 8]
[ 2 3 -3 -8 -1 9 2 -7 -1 -4]]
Demonstrate function¶
im1 = ps.tools.make_contiguous(im=im, mode='keep_zeros')