Bounding Boxes for 3D images across time in Napari

Hi everyone,

I began using Napari for a visualization task of 3D images across time, which has been terrific. It worked very nicely with the lazy_array dask example provided in the tutorial. However, in a next step I would like to generate bounding boxes corresponding to this data, meaning bounding boxes for 3D images across a time dimenstion. I am able to generate bounding boxes for a single 3D image based on thisSegmentation/Bounding Boxes and this Shapes Tutorial (3D rendering) tutorial/code snippet. The shapes layer takes an array of 4x3 arrays which specify the corner points of the bounding boxes. I thought that to visualize bounding boxes over time I could create an array of arrays that now each hold a number of bounding boxes each specified by the 4x3 array. However, this breaks down and I haven’t been able to find any other solution or example that did something like this. I hope the explanation was clear enough.

Thanks in advance!

1 Like

Ha, the answer to this is essentially the same as this one:

Specifically, rather than an array of (4,3) arrays, you actually need (4, 4) arrays, where the leading dimension is the coordinate of the box in time. ie the points need to have a position in both 3D space and in time. Does that make sense?

1 Like

That makes sense. What an easy fix and implementation. Works nicely now. Thank you so much!