Giter VIP home page Giter VIP logo

zarr-java's People

Contributors

brokkoli71 avatar normanrz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zarr-java's Issues

Reading chunks only returns fill value

In experimenting a bit with writing v3 Zarr and then reading the results back, I haven't been able to read chunks that contain data other than the fill value using the most recent commit (a063c1e). This line seems to be the source of the problem:

https://github.com/zarr-developers/zarr-java/blob/main/src/main/java/dev/zarr/zarrjava/v3/Array.java#L214

If I change that line to if (!chunkIsInArray(chunkCoords)) { and re-run my test code with the patched version of zarr-java, then I can see non-fill-value data as expected. I'm not sure if I just misunderstand that logic, though - it's also possible there is something wrong with my test data or code.

Minimal test code that demonstrates the issue:

    // inputLocation is "/path/to/v3.zarr"
    Store store = new FilesystemStore(inputLocation);
    Group firstSeries = Group.open(store.resolve("0"));

    Node[] resolutions = firstSeries.listAsArray();
    for (Node r : resolutions) {
      Array resolutionArray = (Array) r;

      // only read the first chunk
      int[] chunks = resolutionArray.metadata.chunkShape();
      long[] offset = new long[] {0, 0, 0, 0, 0};
      ucar.ma2.Array tile = resolutionArray.read(offset, chunks);

      // test dataset only has uint8 arrays
      ByteBuffer buffer = tile.getDataAsByteBuffer();
      System.out.println("comparing " + buffer.limit() + " bytes against fill value");
      int nonFill = 0;
      for (int i=0; i<buffer.limit(); i++) {
        if (buffer.get(i) != ((Number) resolutionArray.metadata.fillValue).byteValue()) {
          nonFill++;
        }
      }
      // expect this to print a value greater than 0 since none of the chunks are empty
      System.out.println("bytes of non-fill: " + nonFill);
    }

And test data: v3-example.tar.gz. That is https://openslide.cs.cmu.edu/download/openslide-testdata/Aperio/CMU-1-Small-Region.svs converted with https://github.com/glencoesoftware/bioformats2raw, then copied from v2 to v3 using jzarr to read and zarr-java to write.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.