ome / napari-ome-zarr

A napari plugin for zarr backed OME-NGFF images
https://www.napari-hub.org/plugins/napari-ome-zarr
BSD 3-Clause "New" or "Revised" License
27 stars 21 forks source link

Best way to save/view RGB images #57

Closed maweigert closed 2 years ago

maweigert commented 2 years ago

Hi,

Not really an issue but more of a question:
What is currently the best way to save and view multi-resolution RGB images with ome-zarr-py/napari-ome-zarr?

E.g. how can I save a RGB array x = np.random.randint(0,100,(100,100,3)) as multi resolution ome-zarr such that it is displayed correctly in napari?

As napari expects RGB images to be in YXC format but the ome-zarr specs demand channels to come before axis dimensions I assume this might involve some custom dimension swap transform as metadata but I have no idea whether that is even possible ;)

Is there something easy that achieves what I want which I might have missed?

will-moore commented 2 years ago

Yes, I'm afraid the OME-NGFF specs currently require you to use axis order of cyx, so you will need to reshape the array accordingly.

You can generate some test rgb data with:

$ ome_zarr create test_astro --method=astronaut

This converts from yxc to cyx via code at https://github.com/ome/ome-zarr-py/blob/e1351ed0f583ba9a676ba61008bec60915e48dca/ome_zarr/data.py#L46

Apologies for the delayed response. A few of us away just now. But you can also try https://forum.image.sc/ for general questions.