<jupyter_start><jupyter_text>apply_chordsAdds chords to the void space in a predefined direction.<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
import scipy.ndimage as spim
import skimage

ps.visualization.set_mpl_style()<jupyter_output><empty_output><jupyter_text>shape<jupyter_code>shape = [200, 200]
im = ps.generators.blobs(shape=shape, porosity=0.4)
fig, ax = plt.subplots(1, 1, figsize=[4, 4])
ax.imshow(im, origin='lower', interpolation='none')
ax.axis(False);<jupyter_output><empty_output><jupyter_text>spacingSeparation between chords.  The default is 1 voxel.  This can be decreased to 0, meaning that the chords all touch each other, which automatically sets to the ``label`` argument to ``True``<jupyter_code>x = ps.filters.apply_chords(im=im, spacing=1)
xx = ps.filters.apply_chords(im=im, spacing=3)


fig, ax = plt.subplots(1, 2, figsize=[8, 4])
ax[0].imshow(x)
ax[1].imshow(xx)
ax[0].axis(False)
ax[1].axis(False)
ax[0].set_title('spacing = 1')
ax[1].set_title('spacing = 3');<jupyter_output><empty_output><jupyter_text>axisThe axis along which the chords are drawn.<jupyter_code>xx = ps.filters.apply_chords(im=im, axis=1)

fig, ax = plt.subplots(1, 2, figsize=[8, 4])
ax[0].imshow(x)
ax[1].imshow(xx)
ax[0].axis(False)
ax[1].axis(False)
ax[0].set_title('axis = 0')
ax[1].set_title('axis = 1');<jupyter_output><empty_output><jupyter_text>trim_edgesWhether or not to remove chords that touch the edges of the image. The default is ``True``.<jupyter_code>xx = ps.filters.apply_chords(im=im, trim_edges=False)


fig, ax = plt.subplots(1, 2, figsize=[8, 4])
ax[0].imshow(x)
ax[1].imshow(xx)
ax[0].axis(False)
ax[1].axis(False)
ax[0].set_title('trim_edges = True')
ax[1].set_title('trim_edges = False');<jupyter_output><empty_output><jupyter_text>labelIf ``True`` the chords in the returned image are each given a unique label, such that all voxels lying on the same chord have the same value.  This is automatically set to ``True`` if spacing is 0, but is ``False`` otherwise.<jupyter_code>xx = ps.filters.apply_chords(im=im, label=True)

fig, ax = plt.subplots(1, 2, figsize=[8, 4])
ax[0].imshow(x)
ax[1].imshow(xx)
ax[0].axis(False)
ax[1].axis(False)
ax[0].set_title('label = False')
ax[1].set_title('label = True');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15782608695652173, 'fraction_numerical': 0.026956521739130435, 'mean_word_length': 6.961937716262976, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '572531', 'license': 'MIT', 'n_tokens_mistral': 935, 'n_tokens_neox': 894, 'n_words': 203, 'path': 'examples/filters/reference/apply_chords.ipynb', 'repo_name': 'xu-kai-xu/porespy', 'size': '2300'}