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()
[03:27:27] ERROR    PARDISO solver not installed, run `pip install pypardiso`. Otherwise,          _workspace.py:56
                    simulations will be slow. Apple M chips not supported.                                         

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_4348/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_4348/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/811209d52c24bdbedb978423870e4e2e68cad747d7e06da3bb57add9fb51f0ea.png ../../../_images/7e0eae50d2ee6044af698a55be011f0f756551a759b84be4980b14e74a33c6a0.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/1f10403019634f2650a65d451e50a4feb1861ebe2627122750c3909bac164453.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/3938313e7f72d2f1d497e7d333464fce587a7a90ba93ec2c5e6bf0f4dec24e10.png