4D Vectors supported in napari?

Hey everyone I encountered some bizarre behavior with slicing vectors, and still didn’t figure out after a lot of trials:

My goal: plot a timeseries of 3D vectors, basically I want to visualize the tracking of particle

My try: I add timestamps as the 4th coordinates in the 3rd axis of the vector data. For the start point (vector[N, 0, 3]), I used the same indexes as those for my points. For the projection (vector[N, 1, 3]), I used 1, since I want the vector to show up in one frame. I attached the vector data structure info too.

However, when slicing, I realized the vectors are not being properly sliced and it is static. I tried a range of other possible values but I could not see a pattern from that.

So I am wondering how should I set the 4th coordinates of the start point and projection of a vector? How is napari slicing them internally? It is not as obvious as for 4D points.

Otherwise, is there a better way to view vectors frame-to-frame?

Appreciate deeply.


We actually have a convention that the last axes are the displayed ones, so you might want to try setting the 0th or first axis to be your time values, instead of the last. i.e. our default ordering is T, Z, Y, X. Apologies that this wasn’t more clearly documented. We should probably add to our tutorials.

I can try putting together a little demo of that you’re asking for, it should be possible.

You might also though be interesting in our new tracks layer. We’ve just added it and it could have some nice addition functionality if you are doing tracking. See a tutorial here https://napari.org/tutorials/fundamentals/tracks

Let us know how you get on with either of those approaches and thanks for reaching out and asking!!