Skip to content

Commit

Permalink
Add a second min-size test where the sizes do not exactly match
Browse files Browse the repository at this point in the history
  • Loading branch information
sbesson committed Aug 21, 2021
1 parent a898914 commit 886f1ee
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1207,10 +1207,10 @@ public void testChunkSizeToBig() throws Exception {
}

/**
* Convert an image with the --min-size option.
* Convert an image to produce smaller resolution of XY dimensions 32x32
*/
@Test
public void testMinSizeOption() throws Exception {
public void testMinSizeExact() throws Exception {
input = fake();
assertTool("--min-size", "32");

Expand All @@ -1229,6 +1229,29 @@ public void testMinSizeOption() throws Exception {
assertArrayEquals(new int[] {1, 1, 1, 32, 32}, array.getShape());
}

/**
* Convert an image to produce smaller resolution of XY dimensions 16x16
*/
@Test
public void testMinSizeThreshold() throws Exception {
input = fake();
assertTool("--min-size", "30");

ZarrGroup z = ZarrGroup.open(output.resolve("0").toString());
List<Map<String, Object>> multiscales = (List<Map<String, Object>>)
z.getAttributes().get("multiscales");

Map<String, Object> multiscale = multiscales.get(0);
List<Map<String, Object>> datasets =
(List<Map<String, Object>>) multiscale.get("datasets");
assertEquals(datasets.size(), 6);

ZarrArray array = z.openArray("0");
assertArrayEquals(new int[] {1, 1, 1, 512, 512}, array.getShape());
array = z.openArray("5");
assertArrayEquals(new int[] {1, 1, 1, 16, 16}, array.getShape());
}

private void checkPlateGroupLayout(Path root, int rowCount, int colCount,
int fieldCount, int x, int y)
throws IOException
Expand Down

0 comments on commit 886f1ee

Please sign in to comment.