diff --git a/.gitmodules b/.gitmodules index 37c054ac..a40eb0e8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "testdata/ome/v0.6/examples"] path = testdata/ome/v0.6/examples url = https://github.com/jo-mueller/ngff-rfc5-coordinate-transformation-examples +[submodule "testdata/ome/v0.6/ngff-spec"] + path = testdata/ome/v0.6/ngff-spec + url = https://github.com/ome/ngff-spec diff --git a/src/main/java/dev/zarr/conventions/ome/metadata/OmeroChannel.java b/src/main/java/dev/zarr/conventions/ome/metadata/OmeroChannel.java index 7ea263ef..4cbfa716 100644 --- a/src/main/java/dev/zarr/conventions/ome/metadata/OmeroChannel.java +++ b/src/main/java/dev/zarr/conventions/ome/metadata/OmeroChannel.java @@ -1,10 +1,15 @@ package dev.zarr.conventions.ome.metadata; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import javax.annotation.Nullable; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; /** OMERO channel rendering metadata. */ @JsonInclude(JsonInclude.Include.NON_NULL) @@ -16,6 +21,7 @@ public final class OmeroChannel { @Nullable public final Boolean inverted; @Nullable public final String label; @Nullable public final OmeroWindow window; + private final Map extraFields; @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) public OmeroChannel( @@ -25,7 +31,8 @@ public OmeroChannel( @Nullable @JsonProperty("family") String family, @Nullable @JsonProperty("inverted") Boolean inverted, @Nullable @JsonProperty("label") String label, - @Nullable @JsonProperty("window") OmeroWindow window + @Nullable @JsonProperty("window") OmeroWindow window, + @Nullable @JsonAnySetter Map extraFields ) { this.active = active; this.coefficient = coefficient; @@ -34,5 +41,31 @@ public OmeroChannel( this.inverted = inverted; this.label = label; this.window = window; + this.extraFields = extraFields == null + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(extraFields)); + } + + public OmeroChannel( + @Nullable Boolean active, + @Nullable Double coefficient, + @Nullable String color, + @Nullable String family, + @Nullable Boolean inverted, + @Nullable String label, + @Nullable OmeroWindow window + ) { + this(active, coefficient, color, family, inverted, label, window, null); + } + + /** + * Members zarr-java does not model, such as {@code wavelength_id}. The omero block is + * transitional and open-ended, so they are written back unchanged. + * + * @return the extra fields, never {@code null} + */ + @JsonAnyGetter + public Map extraFields() { + return extraFields; } } diff --git a/src/main/java/dev/zarr/conventions/ome/v0_6/MultiscaleImage.java b/src/main/java/dev/zarr/conventions/ome/v0_6/MultiscaleImage.java index e3443f9a..06194e8e 100644 --- a/src/main/java/dev/zarr/conventions/ome/v0_6/MultiscaleImage.java +++ b/src/main/java/dev/zarr/conventions/ome/v0_6/MultiscaleImage.java @@ -298,8 +298,8 @@ public dev.zarr.conventions.ome.metadata.MultiscalesEntry getMultiscaleNode(int mappedDatasets.add(new dev.zarr.conventions.ome.metadata.Dataset(ds.path, mapped)); } List axes = entry.axes; - if ((axes == null || axes.isEmpty()) && entry.coordinateSystems != null && !entry.coordinateSystems.isEmpty()) { - axes = entry.coordinateSystems.get(0).axes; + if ((axes == null || axes.isEmpty()) && entry.intrinsicCoordinateSystem() != null) { + axes = entry.intrinsicCoordinateSystem().axes; } return new dev.zarr.conventions.ome.metadata.MultiscalesEntry( axes != null ? axes : Collections.emptyList(), diff --git a/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/MultiscalesEntry.java b/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/MultiscalesEntry.java index 1648e6d6..9461bd1d 100644 --- a/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/MultiscalesEntry.java +++ b/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/MultiscalesEntry.java @@ -1,13 +1,18 @@ package dev.zarr.conventions.ome.v0_6.metadata; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import dev.zarr.conventions.ome.metadata.Axis; +import dev.zarr.conventions.ome.v0_6.metadata.transform.CoordinateSystemRef; import dev.zarr.conventions.ome.v0_6.metadata.transform.CoordinateTransformation; import javax.annotation.Nullable; import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -21,6 +26,7 @@ public final class MultiscalesEntry { @Nullable public final String name; @Nullable public final String type; @Nullable public final Map metadata; + private final Map extraFields; @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) public MultiscalesEntry( @@ -30,7 +36,8 @@ public MultiscalesEntry( @Nullable @JsonProperty("coordinateSystems") List coordinateSystems, @Nullable @JsonProperty("name") String name, @Nullable @JsonProperty("type") String type, - @Nullable @JsonProperty("metadata") Map metadata + @Nullable @JsonProperty("metadata") Map metadata, + @Nullable @JsonAnySetter Map extraFields ) { this.axes = axes; this.datasets = datasets; @@ -39,16 +46,69 @@ public MultiscalesEntry( this.name = name; this.type = type; this.metadata = metadata; + this.extraFields = extraFields == null + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(extraFields)); + } + + public MultiscalesEntry( + @Nullable List axes, + List datasets, + @Nullable List coordinateTransformations, + @Nullable List coordinateSystems, + @Nullable String name, + @Nullable String type, + @Nullable Map metadata + ) { + this(axes, datasets, coordinateTransformations, coordinateSystems, name, type, metadata, null); } public MultiscalesEntry(List datasets, List coordinateSystems, String name) { this(null, datasets, null, coordinateSystems, name, null, null); } + /** + * The coordinate system the datasets map into (named by the {@code output} of their + * transformations), or the first listed coordinate system if no dataset names one. + */ + @Nullable + public CoordinateSystem intrinsicCoordinateSystem() { + if (coordinateSystems == null || coordinateSystems.isEmpty()) { + return null; + } + for (Dataset dataset : datasets) { + if (dataset.coordinateTransformations == null || dataset.coordinateTransformations.isEmpty()) { + continue; + } + CoordinateSystemRef output = dataset.coordinateTransformations.get(0).getOutput(); + if (output == null || output.name == null) { + continue; + } + for (CoordinateSystem coordinateSystem : coordinateSystems) { + if (output.name.equals(coordinateSystem.name)) { + return coordinateSystem; + } + } + break; + } + return coordinateSystems.get(0); + } + /** Returns a new MultiscalesEntry with the given dataset appended. */ public MultiscalesEntry withDataset(Dataset dataset) { List updated = new ArrayList<>(this.datasets); updated.add(dataset); - return new MultiscalesEntry(axes, updated, coordinateTransformations, coordinateSystems, name, type, metadata); + return new MultiscalesEntry(axes, updated, coordinateTransformations, coordinateSystems, name, type, metadata, extraFields); + } + + /** + * Members zarr-java does not model, such as the JSON-LD key {@code @id}. + * They are written back unchanged, so that a metadata rewrite does not drop them. + * + * @return the extra fields, never {@code null} + */ + @JsonAnyGetter + public Map extraFields() { + return extraFields; } } diff --git a/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/OmeMetadata.java b/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/OmeMetadata.java index 23d395da..66856d17 100644 --- a/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/OmeMetadata.java +++ b/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/OmeMetadata.java @@ -1,5 +1,7 @@ package dev.zarr.conventions.ome.v0_6.metadata; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -9,7 +11,10 @@ import dev.zarr.conventions.ome.metadata.WellMetadata; import javax.annotation.Nullable; +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; /** OME-Zarr v0.6 metadata stored under {@code attributes["ome"]}. */ @JsonInclude(JsonInclude.Include.NON_NULL) @@ -32,6 +37,7 @@ public final class OmeMetadata { public final ImageLabel imageLabel; /** Image paths of a bioformats2raw collection, present in the metadata of the {@code OME} group. */ @Nullable public final List series; + private final Map extraFields; @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) public OmeMetadata( @@ -44,7 +50,8 @@ public OmeMetadata( @Nullable @JsonProperty("well") WellMetadata well, @Nullable @JsonProperty("labels") List labels, @Nullable @JsonProperty("image-label") ImageLabel imageLabel, - @Nullable @JsonProperty("series") List series + @Nullable @JsonProperty("series") List series, + @Nullable @JsonAnySetter Map extraFields ) { this.version = version; this.multiscales = multiscales; @@ -56,6 +63,24 @@ public OmeMetadata( this.labels = labels; this.imageLabel = imageLabel; this.series = series; + this.extraFields = extraFields == null + ? Collections.emptyMap() + : Collections.unmodifiableMap(new LinkedHashMap<>(extraFields)); + } + + public OmeMetadata( + String version, + @Nullable List multiscales, + @Nullable OmeroMetadata omero, + @Nullable Integer bioformats2rawLayout, + @Nullable SceneMetadata scene, + @Nullable PlateMetadata plate, + @Nullable WellMetadata well, + @Nullable List labels, + @Nullable ImageLabel imageLabel, + @Nullable List series + ) { + this(version, multiscales, omero, bioformats2rawLayout, scene, plate, well, labels, imageLabel, series, null); } public OmeMetadata( @@ -94,6 +119,17 @@ public OmeMetadata( /** Returns a copy with {@code multiscales} replaced and all other fields preserved. */ public OmeMetadata withMultiscales(@Nullable List multiscales) { return new OmeMetadata(version, multiscales, omero, bioformats2rawLayout, scene, plate, well, - labels, imageLabel, series); + labels, imageLabel, series, extraFields); + } + + /** + * Members zarr-java does not model, such as the JSON-LD keys {@code @id} and {@code @type}. + * They are written back unchanged, so that a metadata rewrite does not drop them. + * + * @return the extra fields, never {@code null} + */ + @JsonAnyGetter + public Map extraFields() { + return extraFields; } } diff --git a/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/transform/GenericCoordinateTransformation.java b/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/transform/GenericCoordinateTransformation.java index 0d52fcd5..110058c0 100644 --- a/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/transform/GenericCoordinateTransformation.java +++ b/src/main/java/dev/zarr/conventions/ome/v0_6/metadata/transform/GenericCoordinateTransformation.java @@ -1,7 +1,9 @@ package dev.zarr.conventions.ome.v0_6.metadata.transform; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import javax.annotation.Nullable; @@ -15,6 +17,7 @@ * rather than rejecting the entire OME payload. */ public final class GenericCoordinateTransformation extends BaseCoordinateTransformation { + @JsonIgnore public final Map raw = new LinkedHashMap<>(); @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) @@ -31,4 +34,9 @@ public GenericCoordinateTransformation( public void capture(String key, Object value) { raw.put(key, value); } + + @JsonAnyGetter + Map rawProperties() { + return raw; + } } diff --git a/src/test/java/dev/zarr/conventions/ome/OmeZarrV06CoordinateSystemRefTest.java b/src/test/java/dev/zarr/conventions/ome/OmeZarrV06CoordinateSystemRefTest.java index 673c514b..d9aafc47 100644 --- a/src/test/java/dev/zarr/conventions/ome/OmeZarrV06CoordinateSystemRefTest.java +++ b/src/test/java/dev/zarr/conventions/ome/OmeZarrV06CoordinateSystemRefTest.java @@ -212,8 +212,8 @@ void createScaleLevelWithoutCoordinateSystemsFails() throws Exception { @Test void legacyStringFixtureOpensAndIsWrittenBackAsObjects() throws Exception { - // the rfc5 examples still use the pre-release string form ("input": "s0", "output": "physical") - Path fixture = TESTDATA.resolve("ome/v0.6/examples/2d/basic/scale_multiscale.zarr"); + // written in the pre-release string form ("input": "s0", "output": "physical") of 0.6.dev3 + Path fixture = TESTDATA.resolve("ome/v0.6_legacy/scale_multiscale.zarr"); JsonNode raw = readOmeAttributes(fixture).get("multiscales").get(0).get("datasets").get(0) .get("coordinateTransformations").get(0); assertTrue(raw.get("input").isTextual()); diff --git a/src/test/java/dev/zarr/conventions/ome/OmeZarrV06RoundTripTest.java b/src/test/java/dev/zarr/conventions/ome/OmeZarrV06RoundTripTest.java new file mode 100644 index 00000000..5a9bb62d --- /dev/null +++ b/src/test/java/dev/zarr/conventions/ome/OmeZarrV06RoundTripTest.java @@ -0,0 +1,162 @@ +package dev.zarr.conventions.ome; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import dev.zarr.zarrjava.ZarrTest; +import dev.zarr.conventions.ome.v0_6.metadata.OmeMetadata; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +/** + * Reads every OME-Zarr v0.6 metadata document we have test data for and checks that writing it + * back yields the same JSON. + */ +public class OmeZarrV06RoundTripTest extends ZarrTest { + + private static final Path RFC5_EXAMPLES = TESTDATA.resolve("ome/v0.6/examples"); + private static final Path NGFF_SPEC_TESTS = TESTDATA.resolve("ome/v0.6/ngff-spec/tests/attributes"); + private static final Path SCENE_EXAMPLES = TESTDATA.resolve("ome/v0.6_scene"); + + private static final ObjectMapper RAW = new ObjectMapper(); + + static Stream rfc5Examples() throws IOException { + List out = new ArrayList<>(); + for (Path zarrJson : zarrJsonFiles(RFC5_EXAMPLES)) { + JsonNode node = RAW.readTree(zarrJson.toFile()); + // Displacement/coordinate field arrays in these examples still carry + // ome.coordinateSystems directly on the array; final v0.6 stores fields as + // multiscales groups, so only groups are OME documents here. + if (!"group".equals(node.path("node_type").asText()) || !node.path("attributes").has("ome")) { + continue; + } + out.add(Arguments.of(RFC5_EXAMPLES.relativize(zarrJson.getParent()).toString(), + node.path("attributes").get("ome"))); + } + return out.stream(); + } + + /** The {@code valid} attribute documents of the official ngff-spec conformance suite. */ + static Stream ngffSpecValidAttributes() throws IOException { + List out = new ArrayList<>(); + for (String flavor : new String[]{"spec", "strict"}) { + Path validDir = NGFF_SPEC_TESTS.resolve(flavor).resolve("valid"); + try (Stream files = Files.walk(validDir)) { + for (Path file : files.filter(p -> p.toString().endsWith(".json")).sorted().collect(Collectors.toList())) { + out.add(Arguments.of(NGFF_SPEC_TESTS.relativize(file).toString(), + RAW.readTree(file.toFile()).get("ome"))); + } + } + } + return out.stream(); + } + + static Stream sceneExamples() throws IOException { + List out = new ArrayList<>(); + for (Path zarrJson : zarrJsonFiles(SCENE_EXAMPLES)) { + JsonNode attributes = RAW.readTree(zarrJson.toFile()).path("attributes"); + if (attributes.has("ome")) { + out.add(Arguments.of(SCENE_EXAMPLES.relativize(zarrJson.getParent()).toString(), attributes.get("ome"))); + } + } + return out.stream(); + } + + /** Members outside the spec that must survive a rewrite as well. */ + static Stream extensionMembers() { + String image = "{\"version\":\"0.6\",\"multiscales\":[{\"name\":\"image\"," + + "\"coordinateSystems\":[{\"name\":\"physical\",\"axes\":[{\"name\":\"y\",\"type\":\"space\"}," + + "{\"name\":\"x\",\"type\":\"space\"}]}]," + + "\"datasets\":[{\"path\":\"s0\",\"coordinateTransformations\":[{\"type\":\"scale\"," + + "\"input\":{\"path\":\"s0\"},\"output\":{\"name\":\"physical\"},\"scale\":[1,1]}]}]%s}]%s}"; + return Stream.of( + Arguments.of("vendor transform type", String.format(image, + ",\"coordinateTransformations\":[{\"type\":\"vendorWarp\",\"input\":{\"name\":\"physical\"}," + + "\"output\":{\"name\":\"warped\"},\"strength\":3.5,\"vendor\":{\"id\":7}}]", "")), + Arguments.of("omero wavelength_id", String.format(image, "", + ",\"omero\":{\"channels\":[{\"label\":\"H2B\",\"wavelength_id\":\"H2B-mCherry\"}]}"))); + } + + @ParameterizedTest(name = "{0}") + @MethodSource("extensionMembers") + void roundTripExtensionMembers(String name, String ome) throws Exception { + assertRoundTrip(RAW.readTree(ome)); + } + + @ParameterizedTest(name = "{0}") + @MethodSource("rfc5Examples") + void roundTripRfc5Examples(String name, JsonNode ome) throws Exception { + assertRoundTrip(ome); + } + + @ParameterizedTest(name = "{0}") + @MethodSource("ngffSpecValidAttributes") + void roundTripNgffSpecConformanceSuite(String name, JsonNode ome) throws Exception { + assertRoundTrip(ome); + } + + @ParameterizedTest(name = "{0}") + @MethodSource("sceneExamples") + void roundTripSceneExamples(String name, JsonNode ome) throws Exception { + assertRoundTrip(ome); + } + + static void assertRoundTrip(JsonNode ome) throws Exception { + ObjectMapper mapper = OmeObjectMappers.makeV3Mapper(); + OmeMetadata parsed = mapper.treeToValue(ome, OmeMetadata.class); + JsonNode written = mapper.valueToTree(parsed); + List differences = new ArrayList<>(); + diff("", ome, written, differences); + if (!differences.isEmpty()) { + fail("Written metadata differs from the original:\n " + String.join("\n ", differences)); + } + // the written document must also read back to the same JSON + assertTrue(written.equals(mapper.valueToTree(mapper.treeToValue(written, OmeMetadata.class)))); + } + + private static void diff(String path, JsonNode expected, JsonNode actual, List out) { + if (expected.isNumber() && actual.isNumber()) { + if (expected.doubleValue() != actual.doubleValue()) { + out.add(path + ": expected " + expected + " but was " + actual); + } + } else if (expected.isObject() && actual.isObject()) { + for (Map.Entry field : expected.properties()) { + String fieldPath = path + "/" + field.getKey(); + if (actual.has(field.getKey())) { + diff(fieldPath, field.getValue(), actual.get(field.getKey()), out); + } else { + out.add(fieldPath + ": missing in written metadata"); + } + } + for (Map.Entry field : actual.properties()) { + if (!expected.has(field.getKey())) { + out.add(path + "/" + field.getKey() + ": added in written metadata: " + field.getValue()); + } + } + } else if (expected.isArray() && actual.isArray() && expected.size() == actual.size()) { + for (int i = 0; i < expected.size(); i++) { + diff(path + "[" + i + "]", expected.get(i), actual.get(i), out); + } + } else if (!expected.equals(actual)) { + out.add(path + ": expected " + expected + " but was " + actual); + } + } + + private static List zarrJsonFiles(Path root) throws IOException { + try (Stream files = Files.walk(root)) { + return files.filter(p -> p.getFileName().toString().equals("zarr.json")).sorted().collect(Collectors.toList()); + } + } +} diff --git a/src/test/java/dev/zarr/conventions/ome/OmeZarrV06Test.java b/src/test/java/dev/zarr/conventions/ome/OmeZarrV06Test.java index 6e00c532..296c3506 100644 --- a/src/test/java/dev/zarr/conventions/ome/OmeZarrV06Test.java +++ b/src/test/java/dev/zarr/conventions/ome/OmeZarrV06Test.java @@ -528,4 +528,20 @@ private static void writeGroupZarrJson(StoreHandle handle, String omeJson) { handle.resolve("zarr.json").set( java.nio.ByteBuffer.wrap(zarrJson.getBytes(java.nio.charset.StandardCharsets.UTF_8))); } + + @Test + void axesComeFromIntrinsicCoordinateSystem() throws Exception { + // From the ngff-spec conformance suite: the intrinsic system "physical" is listed second. + com.fasterxml.jackson.databind.JsonNode ome = new com.fasterxml.jackson.databind.ObjectMapper().readTree( + TESTDATA.resolve("ome/v0.6/ngff-spec/tests/attributes/spec/valid/transforms/projectAxis.json").toFile()).get("ome"); + dev.zarr.conventions.ome.v0_6.metadata.OmeMetadata parsed = OmeObjectMappers.makeV3Mapper() + .treeToValue(ome, dev.zarr.conventions.ome.v0_6.metadata.OmeMetadata.class); + dev.zarr.conventions.ome.v0_6.metadata.MultiscalesEntry entry = parsed.multiscales.get(0); + assertEquals("world", entry.coordinateSystems.get(0).name); + assertEquals("physical", entry.intrinsicCoordinateSystem().name); + + StoreHandle handle = storeHandle(TESTOUTPUT.resolve("ome_v06_intrinsic_axes")); + dev.zarr.conventions.ome.v0_6.MultiscaleImage.create(handle, entry); + assertEquals(Arrays.asList("y", "x"), MultiscaleImage.open(handle).getAxisNames()); + } } diff --git a/testdata/ome/v0.6/examples b/testdata/ome/v0.6/examples index 8eb63f34..a5506161 160000 --- a/testdata/ome/v0.6/examples +++ b/testdata/ome/v0.6/examples @@ -1 +1 @@ -Subproject commit 8eb63f3401eaa73633ad9150fef9a2e971f857e6 +Subproject commit a550616136083561982ffcdda531e18a7837e326 diff --git a/testdata/ome/v0.6/ngff-spec b/testdata/ome/v0.6/ngff-spec new file mode 160000 index 00000000..89da1da5 --- /dev/null +++ b/testdata/ome/v0.6/ngff-spec @@ -0,0 +1 @@ +Subproject commit 89da1da5b0491f83b7cdde7d123aef763a457029 diff --git a/testdata/ome/v0.6_legacy/scale_multiscale.zarr/zarr.json b/testdata/ome/v0.6_legacy/scale_multiscale.zarr/zarr.json new file mode 100644 index 00000000..cc31ad44 --- /dev/null +++ b/testdata/ome/v0.6_legacy/scale_multiscale.zarr/zarr.json @@ -0,0 +1,37 @@ +{ + "zarr_format": 3, + "node_type": "group", + "attributes": { + "ome": { + "version": "0.6.dev3", + "multiscales": [ + { + "name": "multiscales", + "coordinateSystems": [ + { + "name": "physical", + "axes": [ + {"name": "y", "type": "space", "unit": "micrometer"}, + {"name": "x", "type": "space", "unit": "micrometer"} + ] + } + ], + "datasets": [ + { + "path": "s0", + "coordinateTransformations": [ + {"type": "scale", "input": "s0", "output": "physical", "scale": [1.0, 1.0]} + ] + }, + { + "path": "s1", + "coordinateTransformations": [ + {"type": "scale", "input": "s1", "output": "physical", "scale": [2.0, 2.0]} + ] + } + ] + } + ] + } + } +} diff --git a/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument1/zarr.json b/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument1/zarr.json index 8f2d8bdb..13d32b36 100644 --- a/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument1/zarr.json +++ b/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument1/zarr.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6.dev3", + "version": "0.6", "multiscales": [ { "name": "multiscales", @@ -11,9 +11,21 @@ { "name": "physical_instrument1", "axes": [ - { "name": "z", "type": "space", "unit": "micrometer" }, - { "name": "y", "type": "space", "unit": "micrometer" }, - { "name": "x", "type": "space", "unit": "micrometer" } + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } ] } ], @@ -23,9 +35,17 @@ "coordinateTransformations": [ { "type": "scale", - "input": "s0", - "output": "physical_instrument1", - "scale": [1.0, 1.0, 1.0] + "input": { + "path": "s0" + }, + "output": { + "name": "physical_instrument1" + }, + "scale": [ + 1.0, + 1.0, + 1.0 + ] } ] } diff --git a/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument2/zarr.json b/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument2/zarr.json index 5188d51a..aab376b1 100644 --- a/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument2/zarr.json +++ b/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/sampleA_instrument2/zarr.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6.dev3", + "version": "0.6", "multiscales": [ { "name": "multiscales", @@ -11,9 +11,21 @@ { "name": "physical_instrument2", "axes": [ - { "name": "z", "type": "space", "unit": "micrometer" }, - { "name": "y", "type": "space", "unit": "micrometer" }, - { "name": "x", "type": "space", "unit": "micrometer" } + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } ] } ], @@ -23,9 +35,17 @@ "coordinateTransformations": [ { "type": "scale", - "input": "s0", - "output": "physical_instrument2", - "scale": [1.0, 1.0, 1.0] + "input": { + "path": "s0" + }, + "output": { + "name": "physical_instrument2" + }, + "scale": [ + 1.0, + 1.0, + 1.0 + ] } ] } diff --git a/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/zarr.json b/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/zarr.json index 748e6490..5a7c5c61 100644 --- a/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/zarr.json +++ b/testdata/ome/v0.6_scene/example1_instrument_registration.zarr/zarr.json @@ -3,14 +3,20 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6.dev3", + "version": "0.6", "scene": { "coordinateTransformations": [ { "type": "affine", "path": "coordinateTransformations/sampleA_instrument2-to-instrument1", - "input": { "path": "sampleA_instrument2", "name": "physical_instrument2" }, - "output": { "path": "sampleA_instrument1", "name": "physical_instrument1" } + "input": { + "path": "sampleA_instrument2", + "name": "physical_instrument2" + }, + "output": { + "path": "sampleA_instrument1", + "name": "physical_instrument1" + } } ] } diff --git a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument1/zarr.json b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument1/zarr.json index 92763b45..2a29c919 100644 --- a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument1/zarr.json +++ b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument1/zarr.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6.dev3", + "version": "0.6", "multiscales": [ { "name": "multiscales", @@ -11,9 +11,21 @@ { "name": "physical", "axes": [ - { "name": "z", "type": "space", "unit": "micrometer" }, - { "name": "y", "type": "space", "unit": "micrometer" }, - { "name": "x", "type": "space", "unit": "micrometer" } + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } ] } ], @@ -23,9 +35,17 @@ "coordinateTransformations": [ { "type": "scale", - "input": "s0", - "output": "physical", - "scale": [1.0, 1.0, 1.0] + "input": { + "path": "s0" + }, + "output": { + "name": "physical" + }, + "scale": [ + 1.0, + 1.0, + 1.0 + ] } ] } diff --git a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument2/zarr.json b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument2/zarr.json index 92763b45..2a29c919 100644 --- a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument2/zarr.json +++ b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument2/zarr.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6.dev3", + "version": "0.6", "multiscales": [ { "name": "multiscales", @@ -11,9 +11,21 @@ { "name": "physical", "axes": [ - { "name": "z", "type": "space", "unit": "micrometer" }, - { "name": "y", "type": "space", "unit": "micrometer" }, - { "name": "x", "type": "space", "unit": "micrometer" } + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } ] } ], @@ -23,9 +35,17 @@ "coordinateTransformations": [ { "type": "scale", - "input": "s0", - "output": "physical", - "scale": [1.0, 1.0, 1.0] + "input": { + "path": "s0" + }, + "output": { + "name": "physical" + }, + "scale": [ + 1.0, + 1.0, + 1.0 + ] } ] } diff --git a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument3/zarr.json b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument3/zarr.json index 92763b45..2a29c919 100644 --- a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument3/zarr.json +++ b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/instrument3/zarr.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6.dev3", + "version": "0.6", "multiscales": [ { "name": "multiscales", @@ -11,9 +11,21 @@ { "name": "physical", "axes": [ - { "name": "z", "type": "space", "unit": "micrometer" }, - { "name": "y", "type": "space", "unit": "micrometer" }, - { "name": "x", "type": "space", "unit": "micrometer" } + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } ] } ], @@ -23,9 +35,17 @@ "coordinateTransformations": [ { "type": "scale", - "input": "s0", - "output": "physical", - "scale": [1.0, 1.0, 1.0] + "input": { + "path": "s0" + }, + "output": { + "name": "physical" + }, + "scale": [ + 1.0, + 1.0, + 1.0 + ] } ] } diff --git a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/zarr.json b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/zarr.json index 58811cb3..4e5e9353 100644 --- a/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/zarr.json +++ b/testdata/ome/v0.6_scene/example2_multi_instrument_chain.zarr/zarr.json @@ -3,27 +3,69 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6.dev3", + "version": "0.6", "scene": { "coordinateTransformations": [ { "type": "affine", - "input": { "path": "instrument1", "name": "physical" }, - "output": { "path": "instrument2", "name": "physical" }, + "input": { + "path": "instrument1", + "name": "physical" + }, + "output": { + "path": "instrument2", + "name": "physical" + }, "affine": [ - [1.0, 0.0, 0.0, 10.0], - [0.0, 1.0, 0.0, 5.0], - [0.0, 0.0, 1.0, -2.0] + [ + 1.0, + 0.0, + 0.0, + 10.0 + ], + [ + 0.0, + 1.0, + 0.0, + 5.0 + ], + [ + 0.0, + 0.0, + 1.0, + -2.0 + ] ] }, { "type": "affine", - "input": { "path": "instrument3", "name": "physical" }, - "output": { "path": "instrument2", "name": "physical" }, + "input": { + "path": "instrument3", + "name": "physical" + }, + "output": { + "path": "instrument2", + "name": "physical" + }, "affine": [ - [0.9, 0.1, 0.0, 0.0], - [0.0, 1.1, 0.0, 1.0], - [0.0, 0.0, 1.2, 3.0] + [ + 0.9, + 0.1, + 0.0, + 0.0 + ], + [ + 0.0, + 1.1, + 0.0, + 1.0 + ], + [ + 0.0, + 0.0, + 1.2, + 3.0 + ] ] } ]