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()

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/1a837b3489e1688a6dcbf347f4feea43b67131e1225359406df7e81bf23e222d.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/9e8f2638c974520d1a922cdf800b342befad0c5cfc8874011c03d2fee90536d8.png