Note
Go to the end to download the full example code.
Interactive animation#
Display a labels layer above of an image layer using the add_labels and add_image APIs
from skimage import data
from scipy import ndimage as ndi
import napari
blobs = data.binary_blobs(length=128, volume_fraction=0.1, n_dim=3)
viewer = napari.view_image(blobs.astype(float), name='blobs')
labeled = ndi.label(blobs)[0]
viewer.add_labels(labeled, name='blob ID')
viewer.window.add_plugin_dock_widget(plugin_name='napari-animation')
napari.run()
Total running time of the script: (0 minutes 1.039 seconds)