Note
Click here to download the full example code
Layer manipulator (library)
An example controlling the layer manipulator, using napari-threedee as a library.
Out:
/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/site-packages/pydantic/_migration.py:283: UserWarning: `pydantic.generics:GenericModel` has been moved to `pydantic.BaseModel`.
warnings.warn(f'`{import_path}` has been moved to `{new_location}`.')
/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/site-packages/pydantic/_internal/_config.py:373: UserWarning: Valid config keys have changed in V2:
* 'allow_mutation' has been removed
warnings.warn(message, UserWarning)
import napari
import numpy as np
from napari_threedee.manipulators._qt import QtLayerManipulatorWidget
data = np.random.random((100, 100, 100))
viewer = napari.view_image(data)
image_layer = viewer.layers[0]
viewer.dims.ndisplay = 3
widget = QtLayerManipulatorWidget(viewer)
viewer.window.add_dock_widget(widget)
napari.run()
Total running time of the script: ( 0 minutes 4.330 seconds)
Download Python source code: layer_manipulator_library.py