mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
32 stars 13 forks source link

Create MoBIE project from existing OME-Zarrs #1111

Open tischi opened 8 months ago

tischi commented 8 months ago

Does this work?

K-Meech commented 8 months ago

@tischi I had a quick look at the code, and it should support making a MoBIE project from existing ome-zarrs. Do you have an example of an ome-zarr file that didn't work? Then I can look into fixing this issue when I have some time.

tischi commented 8 months ago

Could you please just create two OME-Zarr yourself and test it with them?

With the lasted Fiji you can do this now easily:

run("Boats");
// adapt the "containerroot" to a location on your computer; important to keep the .ome.zarr ending!!
run("HDF5/N5/Zarr/OME-NGFF ...", "containerroot=/Users/tischer/Desktop/test.ome.zarr dataset=image chunksizearg=20 createpyramidifpossible=true downsamplemethod=Sample compressionarg=gzip metadatastyle=OME-NGFF nthreads=1 overwrite=true");
K-Meech commented 8 months ago

Thanks @tischi - I can reproduce the error now: Add image failed - not a valid ome.zarr file. I'll look into fixing this.

K-Meech commented 8 months ago

Ok! I had a quick look, and I think the issue is on this line. When given a .ome.zarr directory, it currently checks if there is a .zgroup and .zattrs file at the top level. Ome-zarr made via fiji only has a .zgroup at the top level, so it errors.

What would be best to check for here @tischi ? I'm not sure if the spec requires .zgroup/.zattrs at the top level, so is there something else that could be used to check if the directory really contains a .ome.zarr file?

tischi commented 8 months ago
❯ ls -la /Users/tischer/Desktop/test.ome.zarr
total 24
drwxr-xr-x   5 tischer  staff   160 Feb 21 16:04 .
drwx------@ 77 tischer  staff  2464 Feb 28 08:54 ..
-rw-r--r--@  1 tischer  staff  6148 Feb 21 16:04 .DS_Store
-rw-r--r--@  1 tischer  staff    17 Feb 21 16:03 .zgroup
drwxr-xr-x@ 10 tischer  staff   320 Feb 28 12:39 image
~/Documents                                                                                                                                                                              base
❯ ls -la /Users/tischer/Desktop/test.ome.zarr/image
total 16
drwxr-xr-x@   10 tischer  staff    320 Feb 28 12:39 .
drwxr-xr-x     5 tischer  staff    160 Feb 21 16:04 ..
-rw-r--r--@    1 tischer  staff    977 Feb 28 12:39 .zattrs
-rw-r--r--@    1 tischer  staff     17 Feb 28 12:39 .zgroup
drwxr-xr-x@ 1048 tischer  staff  33536 Feb 28 12:39 s0
drwxr-xr-x@  274 tischer  staff   8768 Feb 28 12:39 s1
drwxr-xr-x@   76 tischer  staff   2432 Feb 28 12:39 s2
drwxr-xr-x@   24 tischer  staff    768 Feb 28 12:39 s3
drwxr-xr-x@   10 tischer  staff    320 Feb 28 12:39 s4
drwxr-xr-x@    6 tischer  staff    192 Feb 28 12:39 s5

This would be the correct path to the image: /Users/tischer/Desktop/test.ome.zarr/image, which contains both .zgroup/.zattrs.

Does it work if you point to that folder?

K-Meech commented 8 months ago

@tischi I just tried it, and it works using test.ome.zarr/image as the path. All seems good then!

tischi commented 8 months ago

@K-Meech for the scenario where we don't copy but would like to link...

public class StorageLocation
{
    // for data on disk:
    // either
    public String relativePath;
    // or
    public String absolutePath;

...wouldn't it be an option to use the absolutePath to point to the "linked" OME-Zarr?