ome / ZarrReader

Other
5 stars 8 forks source link

"Unable to load library 'blosc'" error when reading pixel data #45

Closed aoles closed 1 year ago

aoles commented 1 year ago

Hi,

my attempt of reading a sample file yx.ome.zarr from ome-ngff-prototypes by using bftools with zarrreader jar obtained from GH Actions artifacts fails with the following error. The same error comes up if I try running against OMEZarrReader-0.3.1-SNAPSHOT-jar-with-dependencies.jar which has been build locally. Any ideas how to resolve this? (CC @joshmoore)

Cheers, Andrzej

$ BF_CP=/Users/oles/Projects/ZarrReader/target/OMEZarrReader-0.3.1-SNAPSHOT-jar-with-dependencies.jar ./showinf /Users/oles/Downloads/v0.4/yx.ome.zarr/.zattrs 
Checking file format [Zarr]
Initializing reader
ZarrReader initializing /Users/oles/Downloads/v0.4/yx.ome.zarr/.zattrs
Initialization took 0.333s

Reading core metadata
filename = /Users/oles/Downloads/v0.4/yx.ome.zarr/.zattrs
Used files:
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s2/.zarray
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s2/.zattrs
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s2/0/0
    /Users/oles/Downloads/v0.4/yx.ome.zarr/.DS_Store
    /Users/oles/Downloads/v0.4/yx.ome.zarr/.zattrs
    /Users/oles/Downloads/v0.4/yx.ome.zarr/.zgroup
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s1/.zarray
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s1/.DS_Store
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s1/.zattrs
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s1/0/0
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s1/0/1
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s1/1/0
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s1/1/1
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/.zarray
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/.zattrs
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/0/0
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/0/1
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/0/3
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/0/2
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/1/0
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/1/1
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/1/3
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/1/2
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/3/0
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/3/1
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/3/3
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/3/2
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/2/0
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/2/1
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/2/3
    /Users/oles/Downloads/v0.4/yx.ome.zarr/s0/2/2
Series count = 3
Series #0 :
    Image count = 1
    RGB = false (1) 
    Interleaved = false
    Indexed = false (false color)
    Width = 1024
    Height = 930
    SizeZ = 1
    SizeT = 1
    SizeC = 1
    Tile size = 256 x 256
    Thumbnail size = 128 x 116
    Endianness = intel (little)
    Dimension order = XYCTZ (uncertain)
    Pixel type = uint16
    Valid bits per pixel = 16
    Metadata complete = false
    Thumbnail series = false
    -----
    Plane #0 <=> Z 0, C 0, T 0

Series #1 :
    Image count = 1
    RGB = false (1) 
    Interleaved = false
    Indexed = false (false color)
    Width = 512
    Height = 465
    SizeZ = 1
    SizeT = 1
    SizeC = 1
    Tile size = 256 x 256
    Thumbnail size = 128 x 116
    Endianness = intel (little)
    Dimension order = XYCTZ (uncertain)
    Pixel type = uint16
    Valid bits per pixel = 16
    Metadata complete = false
    Thumbnail series = false
    -----
    Plane #0 <=> Z 0, C 0, T 0

Series #2 :
    Image count = 1
    RGB = false (1) 
    Interleaved = false
    Indexed = false (false color)
    Width = 256
    Height = 232
    SizeZ = 1
    SizeT = 1
    SizeC = 1
    Tile size = 256 x 256
    Thumbnail size = 128 x 116
    Endianness = intel (little)
    Dimension order = XYCTZ (uncertain)
    Pixel type = uint16
    Valid bits per pixel = 16
    Metadata complete = false
    Thumbnail series = false
    -----
    Plane #0 <=> Z 0, C 0, T 0

Reading series #0 pixel data (0-0)
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'blosc': Native library (darwin/libblosc.dylib) not found in resource path (/Users/oles/Downloads/bftools:/Users/oles/Downloads/bftools/bioformats_package.jar:/Users/oles/Projects/ZarrReader/target/OMEZarrReader-0.3.1-SNAPSHOT-jar-with-dependencies.jar)
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:277)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403)
    at com.sun.jna.Native.register(Native.java:1529)
    at com.sun.jna.Native.register(Native.java:1252)
    at org.blosc.IBloscDll.<clinit>(IBloscDll.java:15)
    at com.bc.zarr.CompressorFactory$BloscCompressor.cbufferSizes(CompressorFactory.java:352)
    at com.bc.zarr.CompressorFactory$BloscCompressor.uncompress(CompressorFactory.java:338)
    at com.bc.zarr.chunk.ChunkReaderWriterImpl_Short.read(ChunkReaderWriterImpl_Short.java:55)
    at com.bc.zarr.ZarrArray.read(ZarrArray.java:278)
    at com.bc.zarr.ZarrArray.read(ZarrArray.java:255)
    at loci.formats.services.JZarrServiceImpl.readBytes(JZarrServiceImpl.java:266)
    at loci.formats.in.ZarrReader.openBytes(ZarrReader.java:360)
    at loci.formats.FormatReader.openBytes(FormatReader.java:919)
    at loci.formats.ImageReader.openBytes(ImageReader.java:449)
    at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
    at loci.formats.gui.BufferedImageReader.openImage(BufferedImageReader.java:86)
    at loci.formats.tools.ImageInfo.readPixels(ImageInfo.java:821)
    at loci.formats.tools.ImageInfo.testRead(ImageInfo.java:1055)
    at loci.formats.tools.ImageInfo.main(ImageInfo.java:1121)
aoles commented 1 year ago

In order to resolve this I needed to install the blosc library. On MacOS this can be done via brew install c-blosc.

imagesc-bot commented 1 year ago

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

https://forum.image.sc/t/ome-zarr-file-size-compared-to-czi/84932/17