hms-dbmi / vizarr

A minimal Zarr image viewer based on Viv.
https://hms-dbmi.github.io/vizarr/?source=https://minio-dev.openmicroscopy.org/idr/v0.3/idr0062-blin-nuclearsegmentation/6001240.zarr
MIT License
114 stars 16 forks source link

How to load local zarr files through imjoy_plugin.py #174

Closed jcaxle closed 1 month ago

jcaxle commented 10 months ago

I saw that Vizarr support the visualization of local zarr files through its imjoy_plugin. I want to visualize the following zarr file; however, I haven't had any luck with the plugin:

─pyramid.zarr
│   │   .zgroup
│   │   METADATA.ome.xml
│   │
│   └───data.zarr
│       │   .zgroup
│       │
│       └───0
│           │   .zattrs
│           │   .zgroup
│           │
│           ├───0
│           │       .zarray
│           │       0.0.0.0.0
│           │       0.0.0.0.1
│           │       0.0.0.1.0
│           │       0.0.0.1.1
│           │       0.0.0.2.0
│           │       0.0.0.2.1
│           │       0.1.0.0.0
│           │       0.1.0.0.1
│           │       0.1.0.1.0
│           │       0.1.0.1.1
│           │       0.1.0.2.0
│           │       0.1.0.2.1
│           │
│           ├───1
│           │       .zarray
│           │       0.0.0.0.0
│           │       0.0.0.1.0
│           │       0.1.0.0.0
│           │       0.1.0.1.0
│           │
│           ├───2
│           │       .zarray
│           │       0.0.0.0.0
│           │       0.1.0.0.0
│           │
│           └───3
│                   .zarray
│                   0.0.0.0.0
│                   0.1.0.0.0

How would I be able to load this zarr file through the plugin?

manzt commented 10 months ago

Hi there, thanks for opening the issue. The imjoy plugin can be a bit combersome to get started. I've been working on an official Jupyter integration for vizarr with anywidget #176. I published a very initial version to PyPI, which you should be able to try out:

pip install vizarr
import vizarr
import zarr
import numpy as np

viewer = vizarr.Viewer()
viewer.add_image(source=zarr.open("path/to/store.zarr"), name="image")
viewer.add_image(source=np.random.randint(0, 255, (1024, 1024), dtype=np.uint8), name="noise")
viewer

Note: The API is very new and subject to change, but hopefully usable for viewing your multiscale zarr data.

cc: @joshmoore, towards a general web-based zarr viewer in Jupyter