-
Notifications
You must be signed in to change notification settings - Fork 18
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
Wrong chunk loaded at low-resolutions #60
Comments
Hmmm let me have a look. First thing that stands out to me is that the axis slider is labeled with a |
Related?
|
Thanks. I think the first is related. I need to inspect the metadata for the arrays, but my guess is that this is related to the We currently rely on all non-xy dims having a Update -- this is the issue. We should catch this earlier in $ curl -L https://s3.embl.de/i2k-2020/em-raw.ome.zarr/s2/.zarray
{
"chunks": [
1,
1,
96,
96,
96
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "|u1",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
1,
1,
714,
810,
860
],
"zarr_format": 2
} |
Yes, they are chunked in 3D. That explains why vizarr was trying to load too large chunk indices in the z-dimension for the lower resolutions. Is that something that's easy for you to fix? |
Good question. This is a limitation of the chunk loaders we've written for Viv, the library that powers vizarr, which we've designed to support 2D downsampling (e.g. current output of With that said, the types of images we support is really a function of what are available pubically via HTTP. We've been able to iterate rapidly on OME-Zarr mostly because @joshmoore and co have done such a wonderful job putting up examples on the web. Will this image remain available? I know for a fact @ilan-gold is eager to work with more 3D data. For example, I was able to prototype a rough idea in a few minutes this morning. We just don't have many (any!) 3D Zarr examples to play with. |
From discussion on slack:
This is a great guess, and I think exactly what is going on. I just realized a recent PR in Viv removed this behavior (hms-dbmi/viv#280) by accident. I'll open an issue.
This is related to the above, and unfortunately there is no way (that I know) to remove those The ZarrArray implementation tries to eagerly request a chunk from a store, and if a For performance reasons (and to avoid copying data in JS), the recent PR in Viv makes a direct call to the store to decode a chunk but I forgot to check if a KeyError is thrown. |
I can leave this image there for you to develop and we (at EMBL) will have a lot of 3D data use cases. |
Just looking at this again, I'm seeing a 503 Error from https://s3.embl.de/i2k-2020/em-raw.ome.zarr/.zgroup |
@will-moore It should be still there but I think they have a general problem with the S3 storage at EMBL right now. |
@will-moore Could you try again now? |
Thanks - the top level Also just wondering what the UI behaviour should be when you zoom in/out? E.g. the lowest resolution has 2853 Z-sections, so you'd expect the Z-slider to have 2853 steps at lowest resolution. But when you zoom out and have fewer Z-sections, do we expect the Z-slider to change? That would seem like a fair bit more work. Any thoughts @manzt? Is that the approach you were prototyping above? Many thanks! |
The specification of n5 allows for missing chunks. I think ome.zarr as well?! |
I'll try to look for the branch where I hacked around on this – it was just a quick hack to figure out what was going on. If I remember correctly, there were a couple of issues:
import { slice } from 'zarr';
import { ZarrLoader as _ZarrLoader } from '@hms-dbmi/viv';
class ZarrLoader extends _ZarrLoader {
async getTile({ x, y, z, loaderSelection }) {
const source = this._getSource(z); // returns ZarrArray (z is pyramidal level)
const [xIndex, yIndex] = ['x', 'y'].map(k => this._dimIndices.get(k)); // returns axis index for x and y
const dataRequests = loaderSelection.map(async sel => {
const selection = this._serializeSelection(sel); // ensures number[]
selection[yIndex] = slice(y * this.tileSize, (y + 1) * this.tileSize); // contiguous y slice
selection[xIndex] = slice(x * this.tileSize, (x + 1) * this.tileSize); // contiguous x slice
// NOTE: Zarr will throw if you index larger than shape. We used chunks before
// because they were consistent in size (even edges). You'll need to adjust the
// size of slices above if they are edge tiles.
// selection is now ~ [number, number, number, slice(), slice()];
return source.getRaw(selection);
});
const data = await Promise.all(dataRequests);
const { shape: [height, width] } = data[0]; // get dims from first image
return {
data: data.map(d => d.data), // extract TypedArray data
width,
height
};
}
@will-moore, hopefully you can get started by protoyping this all in vizarr. It could be that vizarr requires a more sophisticated Loader than most viv applications, but we could also think about moving this code to Viv so it is reusable (if we come up witha good solution!). |
For http://hms-dbmi.github.io/vizarr?source=https://s3.embl.de/i2k-2020/em-raw.ome.zarr @tischi reported that the browser hangs at this stage:
@will-moore pointed out that "it seems even at very low resolution, (where you only have 1 tile) we are getting 404 https://s3.embl.de/i2k-2020/em-raw.ome.zarr/s6/0.0.1351.0.0"
even though:
The text was updated successfully, but these errors were encountered: