andy-sweet / napari-metadata

A napari plugin to view and edit metadata
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

Switching an axis to time does not prevent it from being rendered in 3D #49

Open haesleinhuepf opened 1 year ago

haesleinhuepf commented 1 year ago

I'm just playing with the plugin and providing feedback. Feel free to ignore in case it's out of scope ;-)

I just opened the cells3d example data and the Plugins > Layer metadata widget. After changing the z-axis to time, I would expect that this exis is no longer rendered in 3D in napari.

image

I'm just wondering if this would be even technically possible? I'm maintaining a bunch of plugins which would profit from such functionaliity. So far, we are recommending users to convert their t,y,x data to t,1,y,x data to prevent napari from rendering the t-dimension in space. Read more: https://github.com/BiAPoL/napari-clusters-plotter#time-lapse-measurements

andy-sweet commented 1 year ago

Interesting idea!

I'm just wondering if this would be even technically possible?

Well, this is Python, so anything is technically possible ;) For example, in your case, on the change to the dimension type from space to time, we could change viewer.dims.ndisplay to 2. More generally, we would need to at least modify viewer.dims.order as well to ensure the time dimension is first, so that it gets pushed to the slider. We could do the same for the channel dimensions too.

My concern is that it might be a surprising side-effect of the widget. Currently we show the axes and scale bar anytime the widget is shown, which is relatively harmless. But changing the displayed dims is more aggressive and harder to undo.

Also, what happens if you change it back from time to space? Should we go back to 3D and revert any ordering changes? That then becomes a bit messy/tricky.