insert_cylinder#

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:00] 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 = ps.generators.blobs([100, 100, 100])

fig, ax = plt.subplots(figsize=[4, 4]);
ax.imshow(im[..., 50]);
plt.axis(False);
../../../_images/0fe4683825318272a138e5fb4131abfb82954db3e14ad8217301c62c70f5a3ee.png

Demonstrate tool#

im = ps.tools.insert_cylinder(im=im*1.0, xyz0=[20, 20, 20], xyz1=[60, 60, 50], r=20)

fig, ax = plt.subplots(figsize=[4, 4]);
ax.imshow(ps.visualization.xray(~(im > 1)));
plt.axis(False);
../../../_images/9b590db8ac7d6baab094d2591c3d76eee6efea4936ba2a964ed01b9fc5da3c32.png