diff --git a/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java b/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java index c2d0de0c..f2a3a17d 100644 --- a/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java +++ b/src/main/java/com/glencoesoftware/bioformats2raw/Converter.java @@ -220,6 +220,22 @@ private static Compression getCompressor( PyramidTiffReader.class, MiraxReader.class }; + @Option( + names = "--pyramid-name", + description = "Name of pyramid n5 (default: ${DEFAULT-VALUE}) " + + "[Can break compatibility with raw2ometiff]" + ) + private String pyramidName = "pyramid.n5"; + + @Option( + names = "--scale-format-string", + description = "Format string for scale paths "+ + "[Can break compatibility with raw2ometiff] " + + "(default: ${DEFAULT-VALUE})" + ) + private String scaleFormatString = "%d"; + + /** Scaling implementation that will be used during downsampling. */ private IImageScaler scaler = new SimpleImageScaler(); @@ -283,6 +299,12 @@ public Void call() public void convert() throws FormatException, IOException, InterruptedException { + if (!pyramidName.equals("pyramid.n5") || !scaleFormatString.equals("%d")) { + LOGGER.info("Output will be incompatible with raw2ometiff " + + "(pyramidName: {}, scaleFormatString: {})", + pyramidName, scaleFormatString); + } + Cache tileCache = CacheBuilder.newBuilder() .maximumSize(maxCachedTiles) .build(); @@ -427,9 +449,9 @@ private byte[] getTileDownsampled( int resolution, int plane, int xx, int yy, int width, int height) throws FormatException, IOException, InterruptedException { - String pathName = "/" + Integer.toString(resolution - 1); + String pathName = "/" + String.format(scaleFormatString, resolution - 1); N5Reader n5 = new N5FSReader( - outputPath.resolve("pyramid.n5").toString()); + outputPath.resolve(pyramidName).toString()); DatasetAttributes datasetAttributes = n5.getDatasetAttributes(pathName); long[] dimensions = datasetAttributes.getDimensions(); @@ -506,7 +528,7 @@ private void processTile( throws EnumerationException, FormatException, IOException, InterruptedException { - String pathName = "/" + Integer.toString(resolution); + String pathName = "/" + String.format(scaleFormatString, resolution); long[] gridPosition = new long[] { xx / tileWidth, yy / tileHeight, plane }; @@ -549,7 +571,7 @@ private void processTile( // TODO: ZCT // int[] zct = reader.getZCTCoords(plane); - N5Writer n5 = new N5FSWriter(outputPath.resolve("pyramid.n5").toString()); + N5Writer n5 = new N5FSWriter(outputPath.resolve(pyramidName).toString()); Slf4JStopWatch t1 = stopWatch(); try { n5.writeBlock( @@ -634,14 +656,14 @@ public void saveResolutions() Compression compression = N5Compression.getCompressor(compressionType, compressionParameter); - N5Writer n5 = new N5FSWriter(outputPath.resolve("pyramid.n5").toString()); + N5Writer n5 = new N5FSWriter(outputPath.resolve(pyramidName).toString()); for (int resCounter=0; resCounter