satn_to_panels#

Produces a set of images with each panel containing one saturation. This method can be applied for visualizing image-based invasion percolation algorithm ibip filter.

import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
import inspect
ps.visualization.set_mpl_style()
inspect.signature(ps.visualization.satn_to_panels)
<Signature (satn, im, bins=None, axis=0, slice=None, **kwargs)>

im#

The input image is a Boolean image True values indicating the void voxels and False for solid. Let’s create a test image:

np.random.seed(10)
im = ps.generators.blobs(shape=[50,50,50])
fig, ax = plt.subplots(1, 1, figsize=[6, 6])
ax.imshow(im[:,:,20], origin='lower', interpolation='none')
ax.axis(False);
../../../_images/cddec52a7dd77fb80a4e3b30b7ea56a468a5dea70f7a4e65a7df96b645c92508.svg

satn#

The saturation image can be generated from ibip data using seq_to_satn method. The satn is the image of porous material where each voxel indicates the global saturation at which it was invaded. Voxels with 0 values indicate solid and and -1 indicate uninvaded. As the image is large, we will be visualizing a section of the image: Note that the regions that were uninvaded at sat=0.7 are now invaded at sat=0.75 and remaining regions are invaded at sat=1:

out = ps.filters.ibip(im=im)
inv_seq, inv_size = out.inv_sequence, out.inv_sizes
satn = ps.filters.seq_to_satn(seq=inv_seq)
fig, ax =ps.visualization.satn_to_panels(satn[:15,:15,1], im[:15,:15,1]);
../../../_images/6a9964915267569627290fcab275c7efe2f29db561c14b5b54b79f3226e44f70.svg

bins#

Indicates for which saturations images should be made. By default all saturation values in the image are used. To visualize the image for a list of equally space values between 0 and 1, an int value can be passed as the input (the number of saturation points between [0,1]).

fig, ax =ps.visualization.satn_to_panels(satn, im, bins= 5);
../../../_images/13c0dd44dc5d944b6e47de1f52dd811ca15c12c01c36901edbab984a40051e45.svg

axis#

If the image is 2D this variable is ignored. If the image is 3D, a 2D image is extracted at the specified slice taken along this axis. By default axis=0 indicating the slice is extracted at x axis. Let’s extract the slices at y axis (because slice is not passed as the input, the default slice is at the mid-point of the axis):

fig, ax =ps.visualization.satn_to_panels(satn, im, bins= 5, axis=1);
../../../_images/1254f5e0f94292dd4f8ca744b7ecb8fd9261a9f30c303790cff354e750c10328.svg

slice#

If the image is 2D this variable is ignored. If the image is 3D, a 2D image is extracted from this slice along the given axis. By default a slice at the mid-point of the axis is returned. Let’s extract a slice at y=4:

fig, ax =ps.visualization.satn_to_panels(satn, im, bins= 5, axis=1, slice=4);
../../../_images/cb60b10eba77cdd2299406c8c48c1fc76514b85fd51558a6200306d18c289964.svg

Note that extracting a slice at y=25 gives the same output as we have seen in the axis example above (default slice at mid-point axis):

fig, ax =ps.visualization.satn_to_panels(satn, im, bins= 5, axis=1, slice=25);
../../../_images/b6d8bf3200868ccd9a396df0eb77257a45c3486943b38c2c45cf8bce460458ee.svg

**kwargs#

Additional keyword arguments can be sent to the imshow function, such as interpolation.

fig, ax =ps.visualization.satn_to_panels(satn, im, bins= 5, axis=1, slice=25, interpolation=None);
../../../_images/c7b379816d49de9212da50e84b502cd33c06be3bd98ddcfa4dbc305bde58b0ac.svg