Skip to content

Note

Click here to download the full example code

Points manipulator (plugin)

Example of using the points manipulator to re-position points, using napari-threedee as a napari plugin.

Enter the point selection mode and click on a point to activate the manipulator. Click and drag the arms of the manipulator to move the point. When a point is selected, hold space to rotate the view without losing the selection.

points manipulator plugin

Out:

/home/runner/work/napari-threedee/napari-threedee/src/napari_threedee/utils/napari_utils.py:64: FutureWarning: Private attribute access ('Window._qt_window') in this context (e.g. inside a plugin widget or dock widget) is deprecated and will be unavailable in version 0.6.0
  qt_viewer = viewer.window._qt_window._qt_viewer
/home/runner/work/napari-threedee/napari-threedee/src/napari_threedee/utils/napari_utils.py:64: FutureWarning: Private attribute access ('_QtMainWindow._qt_viewer') in this context (e.g. inside a plugin widget or dock widget) is deprecated and will be unavailable in version 0.6.0
  qt_viewer = viewer.window._qt_window._qt_viewer
/home/runner/work/napari-threedee/napari-threedee/src/napari_threedee/utils/napari_utils.py:65: FutureWarning: Access to QtViewer.view is deprecated since 0.5.0 and will be removed in the napari 0.6.0. Change to QtViewer.canvas.view instead.
  return qt_viewer.view.scene


import numpy as np

import napari

points_data = np.array(
    [
        [0, 0, 0],
        [0, 200, 0],
        [0, 0, 200]
    ]
)

viewer = napari.Viewer(ndisplay=3)
points_layer = viewer.add_points(points_data, size=5)

viewer.window.add_plugin_dock_widget(
    plugin_name="napari-threedee", widget_name="point manipulator"
)

napari.run()

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

Download Python source code: points_manipulator_plugin.py

Download Jupyter notebook: points_manipulator_plugin.ipynb

Gallery generated by mkdocs-gallery