<jupyter_start><jupyter_text>trim_floating_solid  Import packages<jupyter_code>import numpy as np
import porespy as ps
import scipy.ndimage as spim
import scipy
import matplotlib.pyplot as plt
import skimage
ps.visualization.set_mpl_style()<jupyter_output><empty_output><jupyter_text>Create image and variables<jupyter_code>im2d = ps.generators.blobs(shape=[500, 500])
dist = scipy.stats.norm(loc=20, scale=10)
im3d = ps.generators.blobs([100,100,100])
fig, ax = plt.subplots(figsize=[7,7]);
ax.imshow(im2d);
ax.axis(False)
plt.title('2D')


fig, ax = plt.subplots(figsize=[7,7]);
ps.visualization.imshow(im3d)
plt.axis(False)
plt.title('3D')

#default values:
conn = None<jupyter_output><empty_output><jupyter_text>Apply filter function  2DConn options are 4 or 8 for 2D images.<jupyter_code>x = ps.filters.trim_floating_solid(im=im2d, conn=conn)
xx = ps.filters.trim_floating_solid(im=im2d, conn=4)

fig, ax = plt.subplots(figsize=[7,7]);
ax.imshow(x);
ax.axis(False)
plt.title('conn = None')


fig, ax = plt.subplots(figsize=[7,7]);
ax.imshow(xx)
plt.axis(False)
plt.title('conn = 4');<jupyter_output><empty_output><jupyter_text>3DConn options are 6 and 26 for 3D options.<jupyter_code>x = ps.filters.trim_floating_solid(im=im3d, conn=conn)
xx = ps.filters.trim_floating_solid(im=im3d, conn=6)

fig, ax = plt.subplots(figsize=[7,7]);
ps.visualization.imshow(x);
plt.axis(False)
plt.title('conn = None')


fig, ax = plt.subplots(figsize=[7,7]);
ps.visualization.imshow(xx)
plt.axis(False)
plt.title('conn = 6');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1561892417368762, 'fraction_numerical': 0.03499675955930007, 'mean_word_length': 7.483516483516484, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '452699', 'license': 'MIT', 'n_tokens_mistral': 684, 'n_tokens_neox': 639, 'n_words': 106, 'path': 'examples/filters/howtos/trim_floating_solid.ipynb', 'repo_name': 'jamesobutler/porespy', 'size': '1543'}