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()
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/openpnm/algorithms/_invasion_percolation.py:358: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
  def _find_trapped_pores(inv_seq, indices, indptr, outlets):  # pragma: no cover

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_8810/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_8810/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/d5bc12b81a27d5c34edf22a616935d91d435a5d6c56eba111a88aeab76c87246.png ../../../_images/6cb84d1ac7a9c6342d3306e7fd41de3b69628eaa39e234cf1adfd854f0729a5e.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/312e5b4e547465721b2cad343bc04cc82b88705587c0329c7c6a52ced878c0d6.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/2bc772a123029fc7351abfdbc52c27769a7b3d39a034184c9f8d1d8e428f6f3c.png