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_7134/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_7134/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/bf5f08b8790d9dd75b3093de867eea9bc574be253ac1647a422a97d3340e996f.svg../../../_images/1b548e5cebfacbd7188996fc6a2252a802fa351894d23c01cf467f345209bfd8.svg

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/57ae374b3d0526f1fcd88d4f0ed6db4019c8f8de09c637d96cf2f613a10fb221.svg
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/417bdda3e1a2fd40beb852e23674d4b8641c46b9e995cbdd832ec95875c03f46.svg