Skip to content

Commit

Permalink
Fix issue if 'labels' part of filename
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikl committed Oct 29, 2024
1 parent f127eef commit b2c2b9c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/loci/formats/in/ZarrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1127,18 +1127,19 @@ private Double getDouble(Map<String, Object> 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<String> usedFiles = new ArrayList<String>();
reloadOptionsFile(zarrRootPath);

boolean skipPixels = noPixels || !listPixels() || !systemEnvListPixels();
boolean includeLabels = includeLabels();
try (Stream<Path> 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")) ||
.forEach(path -> { if ((!skipPixels && includeLabels) ||
(!skipPixels && !includeLabels && !(path.toString().toLowerCase().indexOf("labels")>=rootPathLength)) ||
(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());
(skipPixels && !includeLabels && !(path.toString().toLowerCase().indexOf("labels")>=rootPathLength) &&(path.endsWith(".zgroup") || path.endsWith(".zattrs") || path.endsWith(".xml"))))
usedFiles.add(path.toFile().getAbsolutePath());
});
} catch (IOException e) {
e.printStackTrace();
Expand Down

0 comments on commit b2c2b9c

Please sign in to comment.