New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure Loading s3 zarr OME-NGFF on web app (possible windows issue with zarr) #1167
Comments
Can you share your view config? A url to your data? Or any of the network logs showing exactly how the requests failed? |
Sure - it's just the confocal image example on the page, but I changed the url to mine: Sorry, I don't know how to view the network logs in the web app, just that all the other panes don't load anything, but in the 'Status' pane, it says "Failed to fetch"
|
Thanks - never really used those developer tools! It looks like the example s3 CORS on http://vitessce.io/docs/data-hosting/ is missing an additional term in "ExposeHeaders". It needs to have "Access-Control-Allow-Origin" in addition to "Content-Range". After doing that, I no longer get the 'Access-Control-Allow-Origin" error that you linked above. Instead I get "Path for image not valid". Attached are the errors and also the contents of my-first.ome.zarr. In the config, for the url, I again tried ending it in .zarr and .zarr/ |
Hi @DippedPretzels, it looks like this image does not have the https://lstest1.s3.us-east-2.amazonaws.com/my-first.ome.zarr/.zattrs vs https://minio-dev.openmicroscopy.org/idr/v0.3/idr0062-blin-nuclearsegmentation/6001240.zarr/.zattrs Apologies that this is not well documented (and this error message is not very clear), but here in the loader if there is no |
@keller-mark Thanks you're right - it didn't have an omero field. The example .zattrs for a czyx is helpful. It looks like the issue I have now is creating a proper czyx .zarr file. Both examples on ome-py-zarr (here) and ngff-writer (here) do not show a case creating a czyx file. ngff-writer, when only 2 .tff z stacks are input, would yield a .zarr with only two sub directories (/0 and /1, my .zarr here). Trying to load this .zarr in the Vitessce actually works with one channel, but obviously fails to load the other. I know support for czyx data was a fairly recent addition in OME-NGFF, but is there example code of creating one with any of the existing tools (ome-py-zarr, ngff-writer, bio-formats)? |
I just realized that there is a new spec for OME-NGFF (v4.0) that changed part of the JSON schema. Until this new version is supported in viv (and then here in Vitessce) you may want to use a previous version of ome-zarr-py that writes v3.0 OME-NGFFs ( from tifffile import imread
import zarr
from ome_zarr import writer
my_image = imread("my_image.tif")
z_root = zarr.open_group("my_image.zarr", mode = "w")
default_window = {
"start": 0,
"min": 0,
"max": 65_535, # may need to change depending on the numpy dtype of the my_image array
"end": 65_535 # may need to change depending on the numpy dtype of the my_image array
}
writer.write_image(
image = my_image,
group = z_root,
axes = "czyx",
omero = {
"name": "My image",
"version": "0.3",
"rdefs": {},
"channels": [
{
"label": f"Channel {i}",
"color": "FF0000", # may want to change to a different color for each iteration or channel
"window": default_window
} for i in range(my_image.shape[0])
]
}
) |
@keller-mark Ah - thanks for all your help on this. After trying your code above on ome-zarr==0.2.1, the result on Vitessce looked goofy. I realized ImageJ spits out merged TIFF files (say 2 channel, 10 z steps, 1024x pixels, 1024y pixels) in ZCXY, so the .zarr file gets created this way, then Vitesse reads it as 10 channels and 2 Z steps. Is there a way around this? |
One option would be to transpose the axes after reading the image import numpy as np
my_image = imread("my_image.tif")
my_image = np.transpose(my_image, axes=(1, 0, 3, 2)) # zcxy to czyx Also you may need to use the chunks argument of writer.write_image(
image = my_image,
# ...,
chunks=(1, 1, 256, 256)
) |
That worked! Thanks! I did not use the chunks argument. In the 3D view, the Z-axis looks spaced equally to x and y, so for zxy of 10 x 1024 x 1024, the 3D volume looks squished in the Z axis. Adding new interpolated frames in z fixes this - but I'm trying to figure out how to scale the z so that's not required. It looks like the 0.4 version of NGFF has some way to define this, bit I can't see how the 0.3 version NGFF scales an axis: I know Vitessce doesn't yet support downscaling across the Z axis, but at least in the full, undownscaled dataset, I'm not sure how to space out across Z. |
I generated an ome.zarr file using the example image from ome-zarr-py:
https://gist.github.com/constantinpape/69e3cb8e0401621365d814b4d6fda0bc
However, in Windows 10, the file explorer views this as a folder named "my-first.ome.zarr". The contents of the folder appear to me to be formatted properly, and loading the folder works in ome-zarr-py.
When uploading to s3, I can only upload "my-first.ome.zarr" as a folder, and copying the URL yields "https://....[excluded]...amazonaws.com/my-first.ome.zarr/". This is a public URL, and I followed the instructions on http://vitessce.io/docs/data-hosting/ for setting up the S3 bucket properly. I checked and was able to download contents inside the subfolders just fine.
Then, on vitessce.io, on the examples page, using Blin et al., PLoS Biol 2019, I simply replaced the image URL with mine. When I try to load this image, in status, it claims "Failed to fetch"
I think this may be due to vitessce expecting a url ending in .zarr, and the url I provided ending in .zarr/. I'm not sure how linux recognizes .zarr - a file or folder, but this might be the issue with windows here. I tried uploading in the windows aws cli, and the web interface, and neither supported me uploading the .zarr folder as a file.
The text was updated successfully, but these errors were encountered: