overlay#

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]:
im1 = np.zeros([100, 100,100])
im2 = np.zeros([51, 51,51])
im1 = ps.generators.RSA(im1, r=25, volume_fraction=0.5)
im2 = ps.generators.RSA(im2, r=5, volume_fraction=0.5)
im3 = im1.copy()

fig, ax = plt.subplots(figsize=[4, 4]);
ps.visualization.imshow(im1);
plt.axis(False)
fig, ax = plt.subplots(figsize=[4, 4]);
ps.visualization.imshow(im2);
plt.axis(False);

#default values:
c = [26,26,26]
/tmp/ipykernel_10044/2366592848.py:3: DeprecationWarning: Call to deprecated function (or staticmethod) RSA. (This function has been renamed to rsa (lowercase to meet pep8)
  im1 = ps.generators.RSA(im1, r=25, volume_fraction=0.5)
/tmp/ipykernel_10044/2366592848.py:4: DeprecationWarning: Call to deprecated function (or staticmethod) RSA. (This function has been renamed to rsa (lowercase to meet pep8)
  im2 = ps.generators.RSA(im2, r=5, volume_fraction=0.5)
../../../_images/examples_tools_reference_overlay_4_1.svg
../../../_images/examples_tools_reference_overlay_4_2.svg

Apply tool#

[3]:
im = ps.tools.overlay(im1=im1,im2=im2, c=c)
fig, ax = plt.subplots(figsize=[4, 4]);
ps.visualization.imshow(im);
plt.axis(False);
../../../_images/examples_tools_reference_overlay_6_0.svg
[4]:
im = ps.tools.overlay(im1=im3, im2=im2, c=[74, 74, 74])
fig, ax = plt.subplots(figsize=[4, 4]);
ps.visualization.imshow(im);
plt.axis(False);
../../../_images/examples_tools_reference_overlay_7_0.svg