insert_sphere#

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:27:06] ERROR    PARDISO solver not installed, run `pip install pypardiso`. Otherwise,          _workspace.py:56
                    simulations will be slow. Apple M chips not supported.                                         

Create image and variables#

im = ps.generators.blobs([100, 100,100])

fig, ax = plt.subplots(figsize=[7, 7]);
ps.visualization.imshow(im);
plt.axis(False);

#default values:
c=[50,50,50]
r=50
v=False
overwrite=True
../../../_images/ccb08823514f1246dbb1848120cb6eb437b13098a4bace3b6d56abc12b676ea9.png

Apply tool#

im = ps.tools.insert_sphere(im=im, c=c, r=r, v=v, overwrite=overwrite)
fig, ax = plt.subplots(figsize=[7, 7]);
ps.visualization.imshow(im);
plt.axis(False);
../../../_images/e999531d6f249afd0661828ef1add1eb2198bd5a6e78448cb401f41ac7f3beaa.png