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