From c0a835242373680c8131a7edb6687cceb0a2d077 Mon Sep 17 00:00:00 2001 From: David Gault Date: Wed, 1 May 2024 17:18:40 +0100 Subject: [PATCH] Remove unused openPlane and openZarr --- src/loci/formats/in/ZarrReader.java | 77 ----------------------------- 1 file changed, 77 deletions(-) diff --git a/src/loci/formats/in/ZarrReader.java b/src/loci/formats/in/ZarrReader.java index 7ff44a2..7814144 100644 --- a/src/loci/formats/in/ZarrReader.java +++ b/src/loci/formats/in/ZarrReader.java @@ -1242,83 +1242,6 @@ private void reloadOptionsFile(String id) { } } } - - public static byte[] openPlane(String path, byte[] buf) throws FormatException, IOException { - String rootPath = path.substring(0, path.indexOf(".zarr") + 5); - String altPath = loadAltStoreOption(rootPath); - if (altPath == null) altPath = rootPath; - ZarrService service = new JZarrServiceImpl(altPath); - openZarr(path, service); - int [] shape = {1, 1, 1, 1, 1}; - int [] zarrShape = service.getShape(); - shape[4] = zarrShape[zarrShape.length - 1]; - shape[3] = zarrShape[zarrShape.length - 2]; - int zarrArrayShapeSize = zarrShape.length; - if (zarrArrayShapeSize < 5) { - shape = getOriginalShape(shape, zarrArrayShapeSize); - } - int [] offsets = {0, 0, 0, 0, 0}; - Object image = service.readBytes(shape, offsets); - int w = shape[4]; - int h = shape[3]; - boolean little = service.isLittleEndian(); - int bpp = FormatTools.getBytesPerPixel(service.getPixelType()); - if (image instanceof byte[]) { - byte [] data = (byte []) image; - for (int i = 0; i < data.length; i++) { - DataTools.unpackBytes(data[i], buf, i, 1, little); - } - } - else if (image instanceof short[]) { - short[] data = (short[]) image; - for (int row = 0; row < h; row++) { - int base = row * w * bpp; - for (int i = 0; i < w; i++) { - DataTools.unpackBytes(data[(row * w) + i], buf, base + 2 * i, 2, little); - } - } - } - else if (image instanceof int[]) { - int[] data = (int[]) image; - for (int row = 0; row < h; row++) { - int base = row * w * bpp; - for (int i = 0; i < w; i++) { - DataTools.unpackBytes(data[(row * w) + i], buf, base + 4 * i, 4, little); - } - } - } - else if (image instanceof float[]) { - float[] data = (float[]) image; - for (int row = 0; row < h; row++) { - int base = row * w * bpp; - for (int i = 0; i < w; i++) { - int value = Float.floatToIntBits(data[(row * w) + i]); - DataTools.unpackBytes(value, buf, base + 4 * i, 4, little); - } - } - } - else if (image instanceof double[]) { - double[] data = (double[]) image; - for (int row = 0; row < h; row++) { - int base = row * w * bpp; - for (int i = 0; i < w; i++) { - long value = Double.doubleToLongBits(data[(row * w) + i]); - DataTools.unpackBytes(value, buf, base + 8 * i, 8, little); - } - } - } - return buf; - } - - private static void openZarr(String path, ZarrService service) { - try { - String canonicalPath = new Location(path).getCanonicalPath(); - LOGGER.debug("Opening zarr statically at path: {}", canonicalPath); - service.open(canonicalPath); - } catch (IOException | FormatException e) { - e.printStackTrace(); - } - } /** * Reloads the bfoptions file statically, only reading the value for the alterntiave file store