Annotate spheres on arbitrary planes
Summary
Annotating spheres in 3D is useful for defining regions of interest around a point. Here we describe how to annotate a sphere on an arbitrary plane in an image.
Instructions
-
To run this example, first download the script from the Examples Gallery page; the link is at the bottom of the web page. Save the file to a memorable location. Or, if you've cloned this repository, the script can be found at
napari-threedee/docs/examples/plugin/sphere_annotator_plugin.py
. -
Ensure you have activated a virtual environment with napari-threedee installed. Change directories to the script location and then execute the script using:
python sphere_annotator_plugin.py
-
The viewer is initialized in 3D rendering mode with an image layer
plane
in plane rendering mode. We are viewing a 3D volume with one plane being actively rendered. Additionally, the viewer will also have a "sphere annotator" widget andn3d spheres
Points layer and asphere meshes
Surface layer. Note that depending on your versions ofnapari-threedee
andnapari
you may see subtle visual differences between your viewer and the screenshots/videos here and the layers may have slightly different names. -
Activate the plugin. Select the
plane
layer for the "image layer" and click the "activate" button. -
You can translate the rendered orange plane along its normal vector by holding the shift key while clicking with the left mouse button and dragging the plane. Alternately, you can re-position the render plane using the render plane manipulator.
-
You can add a sphere on the rendered play by holding alt and clicking on the plane with the left mouse button. Note you must ensure that the
plane
layer is selected. A blue point marking the centroid will be placed on then3d spheres
Points layer and a mesh for the sphere will be created on thesphere meshes
Surface layer. If you alt+click again, it will reposition the center of the sphere.
- You can adjust the radius of the sphere by pressing the
r
key: the radius of the sphere mesh will snap to the position where your mouse pointer intersects the rendered plane.
- You add a new sphere by pressing the
n
key and repeating steps 6 and 7. Note that the point marking the centroid will have a new color, but the initial sphere mesh will have the same radius as previously.