extract_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])

Apply tool and visualize#

This tool is useful for extracting a cylindrical core from an otherwise cubic image. This might be helpful if a cylindrical domain is needed, or to test a workflow on a tomogram that has has not been cropped yet.

cyl = ps.tools.extract_cylinder(im=im, r=40, axis=2)

fig, ax = plt.subplots(1, 2, figsize=[8, 4]);
ax[0].imshow(im[..., 50]);
ax[0].axis(False)
ax[1].imshow(cyl[..., 50]);
ax[1].axis(False);
../../../_images/6b6f2a2df50fc85e98c148fdbf1e7512423351b12c679f49b571cc255fd9f4eb.png