Skip to content

Commit

Permalink
Remove unused openPlane and openZarr
Browse files Browse the repository at this point in the history
  • Loading branch information
dgault committed May 1, 2024
1 parent b1583c4 commit c0a8352
Showing 1 changed file with 0 additions and 77 deletions.
77 changes: 0 additions & 77 deletions src/loci/formats/in/ZarrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c0a8352

Please sign in to comment.