Skip to content

Commit

Permalink
Add support for environment variable OME_ZARR_LIST_PIXELS
Browse files Browse the repository at this point in the history
  • Loading branch information
dgault committed Oct 26, 2023
1 parent 7bba003 commit 290d767
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/loci/formats/in/ZarrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class ZarrReader extends FormatReader {
public static final boolean SAVE_ANNOTATIONS_DEFAULT = false;
public static final String LIST_PIXELS_KEY = "omezarr.list_pixels";
public static final boolean LIST_PIXELS_DEFAULT = false;
public static final String LIST_PIXELS_ENV_KEY = "OME_ZARR_LIST_PIXELS";
public static final String INCLUDE_LABELS_KEY = "omezarr.include_labels";
public static final boolean INCLUDE_LABELS_DEFAULT = false;
protected transient ZarrService zarrService;
Expand Down Expand Up @@ -1094,8 +1095,7 @@ public String[] getUsedFiles(boolean noPixels) {
String zarrRootPath = currentId.substring(0, currentId.indexOf(".zarr") + 5);
ArrayList<String> usedFiles = new ArrayList<String>();


boolean skipPixels = noPixels || !listPixels();
boolean skipPixels = noPixels || !listPixels() || !systemEnvListPixels();
boolean includeLabels = includeLabels();
LOGGER.error("ZarrReader getUsed files, skipPixels: {}", skipPixels);
LOGGER.error("ZarrReader fetching list of used files: {}", zarrRootPath);
Expand Down Expand Up @@ -1171,4 +1171,10 @@ public boolean includeLabels() {
return INCLUDE_LABELS_DEFAULT;
}

private boolean systemEnvListPixels() {
String value = System.getenv(LIST_PIXELS_ENV_KEY);
if (value != null && value.equalsIgnoreCase("true")) return true;
if (value != null && value.toLowerCase().equals("false")) return false;
return LIST_PIXELS_DEFAULT;
}
}

0 comments on commit 290d767

Please sign in to comment.