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