Picking HorizonsΒΆ

Pick a horizon along a 2.5D cross section of GPR imagery.

import pyvista as pv
from pyvista import examples

path, _ = examples.downloads._download_file("gpr-line.vtu")
mesh = pv.read(path)
p = pv.Plotter()
p.add_mesh(mesh)
p.enable_horizon_picking()
p.camera_position = [
    (-212.30873550953538, 359.730172722682, 59.10289856114311),
    (9.6039882161056, 8.329846888337428, -0.5391548951008538),
    (0.08754214189159452, -0.1127058489834577, 0.9897644997664596),
]
p.show()
horizon picking

Out:

[(-212.30873550953538, 359.730172722682, 59.10289856114311),
 (9.6039882161056, 8.329846888337428, -0.5391548951008538),
 (0.08754214189159452, -0.1127058489834577, 0.9897644997664596)]
../../_images/gpr-line.gif

Then you can access the picked surface via p.picked_horizon

See enable_horizon_picking for more details

help(p.enable_horizon_picking)

Out:

Help on method enable_horizon_picking in module pyvista.plotting.picking:

enable_horizon_picking(callback=None, normal=(0, 0, 1), width=None, show_message=True, font_size=18, color='pink', point_size=10, line_width=5, show_path=True, opacity=0.75, show_horizon=True, **kwargs) method of pyvista.plotting.plotting.Plotter instance
    Enable horizon picking.

    Helper for the ``enable_path_picking`` method to also show a
    ribbon surface along the picked path. Ribbon is saved under
    ``.picked_horizon``.

    Parameters
    ----------
    callback : callable, optional
        When given, calls this function after a pick is made.  The
        entire picked path is passed as the only parameter to this
        function.

    normal : tuple(float), optional
        The normal to the horizon surface's projection plane

    width : float, optional
        The width of the horizon surface. Default behaviour will
        dynamically change the surface width depending on its
        length.

    show_horizon : bool, optional
        Show the picked horizon surface interactively.

    show_path : bool, optional
        Show the picked path that the horizon is built from
        interactively.

    show_message : bool or str, optional
        Show the message about how to use the horizon picking
        tool. If this is a string, that will be the message shown.

    font_size : int, optional
        Sets the font size of the message.

    point_size : int, optional
        Size of picked points if ``show_horizon`` is
        ``True``. Default 10.

    color : str, optional
        The color of the horizon surface if shown.

    line_width : float, optional
        Thickness of path representation if ``show_horizon`` is
        ``True``.  Default 5.

    opacity : float, optional
        The opacity of the horizon surface if shown.

    tolerance : float, optional
        Specify tolerance for performing pick operation. Tolerance
        is specified as fraction of rendering window
        size. Rendering window size is measured across diagonal.

    kwargs : optional
        All remaining keyword arguments are used to control how
        the picked path is interactively displayed

Total running time of the script: ( 0 minutes 2.716 seconds)

Gallery generated by Sphinx-Gallery