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()
[20:03:33] 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)
[[ 8 3 -5 1 -1 8 -4 -3 -6 5]
[ 6 0 -9 2 -6 0 -5 -7 -10 -8]
[ -7 -4 2 -7 -9 1 -5 6 -10 7]
[ 4 -2 -3 9 9 7 1 -9 4 7]
[ -8 -2 -8 7 9 5 4 9 -6 -2]
[ 3 4 2 6 -1 -3 0 -7 1 1]
[ 7 5 -9 -3 -7 5 6 8 1 6]
[ 8 9 4 6 -4 0 4 -9 -8 9]
[ -4 5 9 -10 -5 9 8 -9 9 0]
[ 7 4 7 0 7 4 6 2 3 4]]
Demonstrate function¶
im1 = ps.tools.make_contiguous(im=im, mode='keep_zeros')