Skip to content

Commit

Permalink
Test reading plate labels
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Jun 23, 2022
1 parent 5b8156f commit 0bdbdbe
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

from ome_zarr.data import create_zarr
from ome_zarr.io import parse_url
from ome_zarr.reader import Node, Plate, Reader
from ome_zarr.writer import write_image, write_plate_metadata, write_well_metadata
from ome_zarr.reader import Node, Plate, PlateLabels, Reader
from ome_zarr.writer import (
write_image,
write_labels,
write_plate_metadata,
write_well_metadata,
)


class TestReader:
Expand Down Expand Up @@ -68,12 +73,19 @@ def test_multiwells_plate(self):
write_well_metadata(well, ["0", "1", "2"])
for field in range(3):
image = well.require_group(str(field))
write_image(zeros((1, 1, 1, 256, 256)), image)
write_image(zeros((256, 256)), image)

write_labels(zeros((256, 256)), image, name="test_labels")

reader = Reader(parse_url(str(self.path)))
nodes = list(reader())
assert len(nodes) == 2
assert len(nodes[0].specs) == 1
assert isinstance(nodes[0].specs[0], Plate)
# assert len(nodes[1].specs) == 1
# assert isinstance(nodes[1].specs[0], PlateLabels)
assert len(nodes[1].specs) == 1
assert isinstance(nodes[1].specs[0], PlateLabels)
# plate shape is the single image * grid dimensions
plate_shape = (256 * len(row_names), 256 * len(col_names))
# check largest data for image and labels
assert nodes[0].data[0].shape == plate_shape
assert nodes[1].data[0].shape == plate_shape

0 comments on commit 0bdbdbe

Please sign in to comment.