Thanks for your reply. Yes, certainly, I hope this is what you need. The Viewer opens but the error then gets thrown once you go across the time dimension.
# 3D images for 20 timesteps
test_img_stack = np.zeros((20,25,500,500))
# create corners sort of centered in the middle of image
corners = np.random.uniform(100, 300, size=(100, 4, 2))
# time component same for all coordinates
t = np.random.randint(0, 20, size=(100, 1, 1))
t = np.repeat(t, repeats=4, axis=1)
# z coordinate same for all corner points
z = np.random.randint(0, 25, size=(100,1,1))
z= np.repeat(z, repeats=4, axis=1)
shapes = np.concatenate((t, z, corners), axis=2)
# one label per box
labels = np.random.randint(0, 20, (100))
# specify properties and text
properties = {
'label': labels
}
text_parameters = {
'text': 'label: {label}',
'size': 4,
'color': 'green',
'anchor': 'center',
}
with napari.gui_qt():
viewer = napari.Viewer()
viewer.add_shapes(shapes, shape_type='polygon', face_color='transparent',
edge_color='green',name='Box', blending='additive',
properties=properties, text=text_parameters)
viewer.add_image(test_img_stack, name='Image', colormap='gray', blending='additive')