ome / ome-ngff-validator

Web page for validating OME-NGFF files
https://ome.github.io/ome-ngff-validator
BSD 2-Clause "Simplified" License
4 stars 3 forks source link

V05 dev1 #35

Open will-moore opened 2 months ago

will-moore commented 2 months ago

Using schemas from https://github.com/ome/ngff/pull/249 And corresponding data at https://minio-dev.openmicroscopy.org/idr/v0.5-dev1/6001240.zarr

Test at https://deploy-preview-35--ome-ngff-validator.netlify.app/?source=https://minio-dev.openmicroscopy.org/idr/v0.5-dev1/6001240.zarr

And using tensorstore to create v3 zarr data, https://deploy-preview-35--ome-ngff-validator.netlify.app/?source=https://minio-dev.openmicroscopy.org/idr/v0.5-dev1/6001240b.zarr (needed fix in zarrita.js to work)

netlify[bot] commented 2 months ago

Deploy Preview for ome-ngff-validator ready!

Name Link
Latest commit e5b5bef98fa87f60c644f3454bab8f71124d0778
Latest deploy log https://app.netlify.com/sites/ome-ngff-validator/deploys/667ebfce592a5b0008ecee88
Deploy Preview https://deploy-preview-35--ome-ngff-validator.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

will-moore commented 2 months ago

@joshmoore @d-v-b The data above at https://minio-dev.openmicroscopy.org/idr/v0.5-dev1/6001240.zarr was generated from a local v0.4 NGFF sample with this code (NB: this isn't using ome-zarr-py, just plain zarr v3): One issue is that it doesn't preserve the chunk sizes, since it reads the data as numpy rather than with Dask, so we lose chunks info. Also this code doesn't handle labels, plates, bioformats2raw layout etc.

moved to repo ``` import numpy as np import zarr import os path = "/Users/wmoore/Desktop/ZARR/data/6001240.zarr" # remote fails - see below # path = "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0062A/6001240.zarr" rootpath = "6001240_V0.5-dev1.zarr" if os.path.exists(rootpath): import shutil shutil.rmtree(rootpath) store_class = zarr.store.LocalStore if path.startswith("http"): # TypeError: Can't instantiate abstract class RemoteStore with abstract methods get_partial_values, list, list_dir, list_prefix, set_partial_values store_class = zarr.store.RemoteStore read_store = store_class(path, mode="r") # Needs zarr_format=2 or we get ValueError("store mode does not support writing") read_root = zarr.open_group(store=read_store, zarr_format=2) # Create new Image... write_store = zarr.store.LocalStore(rootpath, mode="w") root = zarr.Group.create(write_store) # copy NGFF attrs for key in read_root.attrs.keys(): root.attrs[key] = read_root.attrs[key] # update version root.attrs["multiscales"][0]["version"] = "0.5-dev" # convert arrays multiscales = read_root.attrs.get("multiscales") for ds in multiscales[0]["datasets"]: ds_path = ds["path"] data = zarr.load(store=read_store, path=ds_path) print('array', ds_path, data.shape) a = root.create_array(str(ds_path), shape=data.shape, chunk_shape=[64] * data.ndim, dtype=data.dtype) # These 2 lines are equivalent to e.g. a[:,:] = data (for any number of dimensions) s = [np.s_[:]] * len(data.shape) a[tuple(s)] = data ```

see: https://github.com/ome/ome2024-ngff-challenge/commit/88317e697e617abd79942508cb82a5696b8164cd

imagesc-bot commented 2 months ago

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/ome2024-ngff-challenge/97363/9

will-moore commented 2 months ago

Updated the samples at https://minio-dev.openmicroscopy.org/idr/v0.5-dev1/6001240.zarr and https://minio-dev.openmicroscopy.org/idr/v0.5-dev1/6001240b.zarr with version 0.5-dev1 to corresponds to last commit above and fix of version in schemas at https://github.com/ome/ngff/pull/249 cc @joshmoore