overlay#

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

Create image and variables#

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_9570/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_9570/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/aff2940a0c0dcf5e7e422331d1eb2185602216f3265189c9d0800cddec5b182d.png ../../../_images/0f3145b0ec3afff2a5f6afae9d5c623abd8e73c776fc2ac79df40507826cd759.png

Apply tool#

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/216ca955d317d9db22ce7d5a61869e584890bdb1755ec676b06dfff9ff09232e.png
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/144f724bc3305bf8d794f7494e58cc5aaf64562057e24ab0bbea1159e4ed45c8.png