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/3cd1d3bfad4a835a2dd7f22afc17681c2ecee0b79e2c8279a05033b8ad3a9b7f.svg

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/64fc2ad0780f903399bc2a52188626be5950b3df31dee259e0bdbca78b291412.svg