<jupyter_start><jupyter_text>flood  Import packages<jupyter_code>import numpy as np
import porespy as ps
import scipy.ndimage as spim
import matplotlib.pyplot as plt
import skimage
from edt import edt

ps.visualization.set_mpl_style()<jupyter_output><empty_output><jupyter_text>Create image and variables<jupyter_code>im = ps.generators.blobs(shape=[200, 200])
regions = ps.filters.snow_partitioning(im, r_max=4, sigma=0.4)
dt = edt(im)

fig, ax = plt.subplots(1, 3, figsize=[8, 4])
ax[0].axis(False)
ax[0].imshow(im)
ax[1].axis(False)
ax[1].imshow(regions.regions/im)
ax[2].axis(False)
ax[2].imshow(dt/im);<jupyter_output><empty_output><jupyter_text>Apply filter  modeThe mode indicates how the values from ``im`` are interpreted. The following shows the results of each support option:<jupyter_code>region_max = ps.filters.flood(im=dt, labels=regions.regions, mode='max')
region_min = ps.filters.flood(im=dt, labels=regions.regions, mode='min')
region_ave = ps.filters.flood(im=dt, labels=regions.regions, mode='mean')
region_size = ps.filters.flood(im=im, labels=regions.regions, mode='sum')

fig, ax = plt.subplots(2, 2, figsize=[8, 8])
ax[0][0].imshow(region_max)
ax[0][0].axis(False)
ax[0][0].set_title('mode = max')
ax[0][1].imshow(region_min)
ax[0][1].axis(False)
ax[0][1].set_title('mode = min')
ax[1][0].imshow(region_ave)
ax[1][0].axis(False)
ax[1][0].set_title('mode = mean')
ax[1][1].imshow(region_size)
ax[1][1].axis(False)
ax[1][1].set_title('mode = sum');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1765489673550966, 'fraction_numerical': 0.0313124583610926, 'mean_word_length': 7.940476190476191, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '612461', 'license': 'MIT', 'n_tokens_mistral': 633, 'n_tokens_neox': 605, 'n_words': 105, 'path': 'examples/filters/howtos/flood.ipynb', 'repo_name': 'jamesobutler/porespy', 'size': '1501'}