# Examples from pyvista.ImageDataFilters.open
# ===========================================

# Load a grayscale image `download_chest()` and show it
# for context.
from pyvista import examples
im = examples.download_chest()
clim = im.get_data_range()
kwargs = dict(
    cmap='grey',
    clim=clim,
    lighting=False,
    cpos='xy',
    zoom='tight',
    show_axes=False,
    show_scalar_bar=False,
)
im.plot(**kwargs)

# Use `open` to remove small objects in the lungs.
opened = im.open(kernel_size=15)
opened.plot(**kwargs)

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
