diff --git a/build.gradle b/build.gradle index 0f249663..afeff82e 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ dependencies { implementation 'ome:formats-gpl:6.9.1' implementation 'info.picocli:picocli:4.6.1' implementation 'com.univocity:univocity-parsers:2.8.4' - implementation 'com.bc.zarr:jzarr:0.3.3-gs-SNAPSHOT' + implementation 'com.bc.zarr:jzarr:0.3.5' // implementation 'org.carlspring.cloud.aws:s3fs-nio:1.0-SNAPSHOT' // implementation 'io.nextflow:nxf-s3fs:1.1.0' implementation 'org.lasersonlab:s3fs:2.2.3' diff --git a/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java b/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java index 8fdf84c1..bae8e811 100644 --- a/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java +++ b/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java @@ -69,6 +69,7 @@ import com.bc.zarr.ArrayParams; import com.bc.zarr.CompressorFactory; import com.bc.zarr.DataType; +import com.bc.zarr.DimensionSeparator; import com.bc.zarr.ZarrArray; import com.bc.zarr.ZarrGroup; import com.glencoesoftware.bioformats2raw.MiraxReader.TilePointer; @@ -1217,7 +1218,7 @@ public void saveResolutions(int series) .chunks(new int[] {1, 1, activeChunkDepth, activeTileHeight, activeTileWidth}) .dataType(dataType) - .nested(nested) + .dimensionSeparator(getDimensionSeparator()) .compressor(CompressorFactory.create( compressionType.toString(), compressionProperties)); ZarrArray.create(getRootPath().resolve(resolutionString), arrayParams); @@ -1853,6 +1854,10 @@ public static DataType getZarrType(int type) { } } + private DimensionSeparator getDimensionSeparator() { + return nested ? DimensionSeparator.SLASH : DimensionSeparator.DOT; + } + private void checkOutputPaths() { if (pyramidName != null || !scaleFormatString.equals("%d/%d")) { LOGGER.info("Output will be incompatible with raw2ometiff " + diff --git a/src/test/java/com/glencoesoftware/bioformats2raw/test/ZarrTest.java b/src/test/java/com/glencoesoftware/bioformats2raw/test/ZarrTest.java index ef975e97..ae2774c8 100644 --- a/src/test/java/com/glencoesoftware/bioformats2raw/test/ZarrTest.java +++ b/src/test/java/com/glencoesoftware/bioformats2raw/test/ZarrTest.java @@ -240,7 +240,12 @@ public void testDefaultLayoutIsSetAndIsNested() throws Exception { Integer layout = (Integer) z.getAttributes().get("bioformats2raw.layout"); ZarrArray series0 = ZarrGroup.open(output.resolve("0")).openArray("0"); - assertTrue(series0.getNested()); + + // no getter for DimensionSeparator in ZarrArray + // check that the correct separator was used by checking + // that the expected first chunk file exists + assertTrue(output.resolve("0/0/0/0/0/0/0").toFile().exists()); + // Also ensure we're using the latest .zarray metadata ObjectMapper objectMapper = new ObjectMapper(); JsonNode root = objectMapper.readTree( @@ -878,6 +883,12 @@ public void testDownsampleTypes(Downsampling type) throws IOException { public void testNestedStorage(boolean nested) throws IOException { input = fake(); assertTool(nested ? "--nested" : "--no-nested"); + if (nested) { + assertTrue(output.resolve("0/0/0/0/0/0/0").toFile().exists()); + } + else { + assertTrue(output.resolve("0/0/0.0.0.0.0").toFile().exists()); + } } /**