.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/4_applications/plot_1_landmarksetter.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_4_applications_plot_1_landmarksetter.py: Set landmarks ============= Landmarks can be set manually or using the landmark setter. .. GENERATED FROM PYTHON SOURCE LINES 7-16 .. code-block:: Python import pyvista as pv from pyvista import examples import skshapes as sks # sphinx_gallery_thumbnail_path = 'source/images/landmarks_skull.gif' .. GENERATED FROM PYTHON SOURCE LINES 17-23 Set landmark for one shape --------------------------  LandmarkSetter can be used to set landmarks interactively on a mesh. .. image:: ../../images/landmarks_skull.gif .. GENERATED FROM PYTHON SOURCE LINES 23-36 .. code-block:: Python filename = "../data/skulls/skull_erectus.vtk" shape = sks.PolyData(filename) if not pv.BUILDING_GALLERY: app = sks.LandmarkSetter(shape) app.start() else: shape.landmark_indices = [95, 114, 155, 3, 9, 65, 29, 55, 74] print(shape.landmark_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none tensor([ 95, 114, 155, 3, 9, 65, 29, 55, 74]) .. GENERATED FROM PYTHON SOURCE LINES 37-45 Set landmark in correspondence for several shape ------------------------------------------------  Using LandmarkSetter with a list of shapes will set landmarks in correspondence.  One the landmarks are selected on the first shape of the list (the reference shape),  the user can select the same landmarks on the other shapes. .. image:: ../../images/demolandmarks.gif .. GENERATED FROM PYTHON SOURCE LINES 45-64 .. code-block:: Python # shape1 = sks.PolyData(examples.download_human()) shape1 = sks.PolyData(examples.download_woman()) shape2 = sks.PolyData(examples.download_doorman()) if not pv.BUILDING_GALLERY: app = sks.LandmarkSetter([shape1, shape2]) app.start() else: landmarks1 = [4808, 147742, 1774] landmarks2 = [325, 2116, 1927] shape1.landmark_indices = landmarks1 shape2.landmark_indices = landmarks2 print("Landmarks shape 1:") print(shape1.landmark_indices) print("Landmarks shape 2:") print(shape2.landmark_indices) .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/skshapes/input_validation/converters.py:102: UserWarning: Mesh has been cleaned and points were removed. point_data is ignored. return func(*new_args, **kwargs) Landmarks shape 1: tensor([ 4808, 147742, 1774]) Landmarks shape 2: tensor([ 325, 2116, 1927]) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.419 seconds) .. _sphx_glr_download_auto_examples_4_applications_plot_1_landmarksetter.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_1_landmarksetter.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_1_landmarksetter.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_