Skip to content

Commit

Permalink
Change default name to '0'
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmoore committed Aug 18, 2020
1 parent bf2bf5d commit 601173d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public class RequestHandlerForImage implements HttpHandler {

private static final Logger LOGGER = LoggerFactory.getLogger(RequestHandlerForImage.class);

private static final String DEFAULT_LABEL_NAME = "0"; // See omero-cli-zarr

/**
* Contains the dimensionality of an image.
* @author [email protected]
Expand Down Expand Up @@ -763,7 +765,7 @@ private void returnImageMasksDirectory(HttpServerResponse response, List<String>
final ImmutableList.Builder<String> contents = ImmutableList.builder();
contents.add(".zattrs");
if (labeledMasks != null) {
contents.add("labeled/");
contents.add(DEFAULT_LABEL_NAME);
}
if (isSplitMasksEnabled) {
for (long roiId : roiIdsWithMask) {
Expand Down Expand Up @@ -1140,7 +1142,7 @@ private void returnImageMasksAttrs(HttpServerResponse response, List<String> par
}
final List<String> masks = new ArrayList<>(roiIdsWithMask.size() + 1);
if (labeledMasks != null) {
masks.add("labeled");
masks.add(DEFAULT_LABEL_NAME);
}
if (isSplitMasksEnabled) {
for (final long roiId : roiIdsWithMask) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.openmicroscopy.ms.zarr;

import org.openmicroscopy.ms.zarr.mask.ImageMask;
import static org.openmicroscopy.ms.zarr.RequestHandlerForImage.DEFAULT_LABEL_NAME;

import ome.model.core.Image;
import ome.model.core.Pixels;
Expand Down Expand Up @@ -178,7 +179,7 @@ public void testMaskChunks() throws DataFormatException, IOException {
@Test
public void testLabeledMaskChunks() throws DataFormatException, IOException {
final Set<Long> seenLabels = new HashSet<>();
final JsonObject response = getResponseAsJson(image.getId(), "masks", "labeled", ".zarray");
final JsonObject response = getResponseAsJson(image.getId(), "masks", DEFAULT_LABEL_NAME, ".zarray");
final JsonArray shape = response.getJsonArray("shape");
final int maskSizeX = shape.getInteger(4);
final int maskSizeY = shape.getInteger(3);
Expand All @@ -192,7 +193,7 @@ public void testLabeledMaskChunks() throws DataFormatException, IOException {
int chunkIndexX = 0;
for (int x = 0; x < maskSizeX; x += chunkSizeX) {
mockSetup();
final byte[] chunkZipped = getResponseAsBytes(image.getId(), "masks", "labeled", 0, 0, 0, chunkIndexY, chunkIndexX);
final byte[] chunkZipped = getResponseAsBytes(image.getId(), "masks", DEFAULT_LABEL_NAME, 0, 0, 0, chunkIndexY, chunkIndexX);
final ByteBuffer chunk = ByteBuffer.wrap(uncompress(chunkZipped));
for (int cx = 0; cx < chunkSizeX; cx++) {
for (int cy = 0; cy < chunkSizeY; cy++) {
Expand Down

0 comments on commit 601173d

Please sign in to comment.