diff --git a/src/loci/formats/in/ZarrReader.java b/src/loci/formats/in/ZarrReader.java index 48e3756..bf8822f 100644 --- a/src/loci/formats/in/ZarrReader.java +++ b/src/loci/formats/in/ZarrReader.java @@ -1119,6 +1119,7 @@ private Number getDouble(Map src, String key) { public String[] getUsedFiles(boolean noPixels) { FormatTools.assertId(currentId, true, 1); String zarrRootPath = currentId.substring(0, currentId.indexOf(".zarr") + 5); + int rootPathLength = zarrRootPath.length(); ArrayList usedFiles = new ArrayList(); reloadOptionsFile(zarrRootPath); @@ -1126,12 +1127,17 @@ public String[] getUsedFiles(boolean noPixels) { boolean includeLabels = includeLabels(); try (Stream paths = Files.walk(Paths.get(zarrRootPath), FileVisitOption.FOLLOW_LINKS)) { paths.filter(Files::isRegularFile) - .forEach(path -> {if ((!skipPixels && includeLabels) || - (!skipPixels && !includeLabels && !path.toString().toLowerCase().contains("labels")) || - (skipPixels && includeLabels && (path.endsWith(".zgroup") || path.endsWith(".zattrs") || path.endsWith(".xml"))) || - (skipPixels && !includeLabels && !path.toString().toLowerCase().contains("labels") &&(path.endsWith(".zgroup") || path.endsWith(".zattrs") || path.endsWith(".xml")))) - usedFiles.add(path.toFile().getAbsolutePath()); - }); + .forEach(path -> { + if ( + (!skipPixels && includeLabels) || + (!skipPixels && !includeLabels && (path.toString().toLowerCase().lastIndexOf("labels")