Conversation
Add v0_6.OmeValidator covering coordinate systems, multiscales axes and datasets, scale-level arrays, transformations, plate, well and scene metadata. The v0.6 create methods throw a ZarrException listing all violations; the open methods log them as warnings and still open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Closing: validation isn't needed for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 3 of 3 for OME-NGFF 0.6 spec compliance.
input/outputbecome{name, path}objects instead of Strings. After it merges,OmeValidator.outputName(...), the only helper that interprets output references, needs a one-line change to readgetOutput().name.This PR adds
dev.zarr.zarrjava.experimental.ome.v0_6.OmeValidator. It checks the MUST-level rules of the 0.6 spec and returns a list of readable violations. Nothing validated metadata before this.Strictness policy
MultiscaleImage.create,createScaleLevel,Plate.createPlate,Well.createWell,Scene.createScene), aZarrExceptionis thrown that lists every violation. Nothing is written when validation fails. IncreateScaleLevel, the array is now created after validation, not before.openMultiscaleImage,openPlate,openWell,openScene, andPlate.openWellfor the plate-dependent acquisition check), violations are logged as onejava.util.loggingwarning per node, and the node still opens.MultiscaleImage.createaccepts an emptydatasetslist, because levels are added afterwards withcreateScaleLevel. Opening an image requiresdatasetsto be non-empty.Rules
Coordinate systems (in multiscales and scene)
nameis non-empty and unique within itscoordinateSystemsarray.Multiscales
coordinateSystemsis present and non-empty. If an entry uses legacyaxesinstead, it is reported, and the axis rules are applied toaxes.space, at most onetime, and at most onechannel/custom/null-type axis.datasetsis present and non-empty. Each dataset has apathandcoordinateTransformations.scale, a singleidentity, or a singlesequenceof onescalefollowed by onetranslation.createScaleLevelcurrently writes transforms without input/output (PR 1 territory).createScaleLevel: the array's ndim equals the number of intrinsic axes, and all levels share one dtype and ndim. Existing levels are opened to compare against.Transforms (checked recursively in datasets, multiscales-level and scene transforms)
rotationis N×N, orthonormal, and has det ≈ 1 (tolerance 1e-6).affinerows have the same length (N+1, with N ≥ 1).mapAxisis a permutation of 0..N-1.byDimension, each output axis appears in exactly one child's outputAxes.sequencehas a non-emptytransformationslist.Plate
pathequalsrows[rowIndex].name + "/" + columns[columnIndex].name, and both indices are in range.maximumfieldcountandfield_countare positive if present.Well
/, are not only periods, do not start with__, and use only[A-Za-z0-9._-].acquisition. Anacquisitionthat is present must match a plate acquisition id. This is only checked when the plate is known (Plate.openWell, orvalidateWell(well, plate)).Scene
coordinateTransformationsis present.Out of scope: omero (it is transitional and already warns). Also out of scope: the fields PR 2 adds.
TODO: label images must use integer dtypes. This isn't checked because main has no API for creating or opening label images. It fits naturally once PR 2's labels / image-label support has landed.
Test data
No existing test data had to change, and all existing OME tests pass unchanged.
Some upstream fixtures break MUST rules. They still open, with warnings:
2d|3d/axis_dependent/mapAxis.zarr,2d/axis_dependent/byDimension.zarr,2d|3d/nonlinear/{coordinates,displacements,invDisplacements}.zarr: a secondary coordinate system has onlyarray-typed axes. The spec applies the axis rules to all coordinate systems inside multiscales.user_stories/image_registration_3d.zarr/{FCWB,JRC2018F}: the dataset output names a coordinate system that isn't declared. The declared system isphysical.Unrelated to this PR:
3d/axis_dependent/byDimension.zarralready fails to deserialize on main. It usesinputAxes/outputAxeswith axis names, while the model expectsinput_axes/output_axeswith ints.Tests
OmeValidatorV06Test(29 tests) has:v0.6_scenefixtures, and checks that a warning is loggedmvn test -Dtest='OmeZarr*Test,OmeObjectMappersTest,*Validator*': 103 tests, 0 failures.🤖 Generated with Claude Code