apply_chords_3D

an example for the use of porespy.filters.apply_chords_3D

Adds chords to the void space in all three principle directions. The chords are seprated by 1 voxel plus the provided spacing. Chords in the X, Y and Z directions are labelled 1, 2 and 3 resepctively.

Import packages

[1]:
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()

Create image and variables

[2]:
im = ps.generators.blobs(shape=[100, 100, 100])
plt.figure(figsize=[7,7]);
plt.axis(False);
ps.visualization.imshow(im);
#default values:
spacing=0
trim_edges=True
/home/anaconda/Code/porespy/porespy/visualization/__plots__.py:79: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  fig = plt.subplot(1, len(im), i+1)
../../../_images/examples_filters_howtos_apply_chords_3D_5_1.png

Apply filter function

spacing

[3]:
x = ps.filters.apply_chords_3D(im, spacing, trim_edges)
xx = ps.filters.apply_chords_3D(im, 10, trim_edges)

fig, ax = plt.subplots(figsize=[7, 7]);
ps.visualization.imshow(x);
plt.axis(False);
plt.title('spacing = 1');

fig, ax = plt.subplots(figsize=[7, 7]);
ps.visualization.imshow(xx);
plt.axis(False);
plt.title('spacing = 10');
../../../_images/examples_filters_howtos_apply_chords_3D_8_0.png
../../../_images/examples_filters_howtos_apply_chords_3D_8_1.png

trim_edges

[4]:
xx = ps.filters.apply_chords_3D(im, spacing, False)

fig, ax = plt.subplots(figsize=[7, 7]);
ps.visualization.imshow(x);
plt.axis(False);
plt.title('trim_edges = True');

fig, ax = plt.subplots(figsize=[7, 7]);
ps.visualization.imshow(xx);
plt.axis(False);
plt.title('trim_edges = False');
../../../_images/examples_filters_howtos_apply_chords_3D_10_0.png
../../../_images/examples_filters_howtos_apply_chords_3D_10_1.png