Validation¶
validate() checks any fileset (an image, a plate, a well or a bioformats2raw collection) and
returns a FilesetReport. The same check is available on the
command line.
- ome_zarr_io.validate(path, strict=False)¶
Validate an OME-Zarr 0.5 fileset and summarize what it contains.
Unlike
Reader, this never fails on malformed metadata: every problem found is recorded in the returned report’serrorsinstead of being raised.A plate is validated as a whole: its own metadata, every well it lists and every field of view (and label image) in those wells. A well is validated together with its fields. Each issue’s
locationsays which node it was found in.- Parameters:
- Returns:
A
FilesetReport.bool(report)is True when the fileset is valid.- Raises:
FileNotFoundError – If
pathdoes not exist (for URLs: if no Zarr group is found there).- Return type:
- class ome_zarr_io.FilesetReport(path, strict=False, kind='image', spec_version=None, zarr_format=None, creator=None, axes=<factory>, levels=<factory>, channels=<factory>, labels=<factory>, details=<factory>, errors=<factory>)¶
Validity of an OME-Zarr fileset plus a summary of what it contains.
A fileset is the whole hierarchy of Zarr groups under one path: an image, a plate (with its wells and fields), a well, or a bioformats2raw collection.
kindsays which.- Parameters:
- channels: List[ChannelInfo]¶
Channels of a root image, from its OMERO metadata.
- errors: List[ValidationIssue]¶
Every problem found; empty when the fileset is valid.
- raise_if_invalid()¶
Raise
jsonschema.exceptions.ValidationErrorif the fileset is invalid.- Return type:
None
- class ome_zarr_io.ValidationIssue(path, message, location='image')¶
A single problem found while validating a fileset.
Report details¶
These classes describe parts of a FilesetReport.
- class ome_zarr_io.report.LevelInfo(path, shape=None, chunks=None, dtype=None, scale=None, translation=None)¶
One resolution level of a multiscale pyramid.
- Parameters:
- class ome_zarr_io.report.ChannelInfo(index, label=None, color=None, window=None)¶
A channel described by the OMERO metadata.
- class ome_zarr_io.report.LabelInfo(name, n_levels=0, dtype=None, has_colors=False, has_properties=False, source=None)¶
A label image attached under the
labels/group.- Parameters:
Schema validator¶
The lower-level validator that validate() is built on.
- class ome_zarr_io.OMEZarrValidator(schema_version='0.5')¶
Validates OME-Zarr metadata against JSON schemas.
Initialize the validator with a specific schema version.
- Parameters:
schema_version (str) – The OME-Zarr schema version to use (default: “0.5”)
- validate_metadata(metadata, schema_type='ome_zarr')¶
Validate metadata against a specific schema.
- Parameters:
- Returns:
True if validation passes
- Raises:
ValidationError – If validation fails
ValueError – If schema type is not found
- Return type:
- validate_image_metadata(metadata)¶
Validate image metadata specifically.
- validate_plate_metadata(metadata)¶
Validate plate metadata specifically.
- validate_well_metadata(metadata)¶
Validate well metadata specifically.
- validate_label_metadata(metadata)¶
Validate label metadata specifically.
- iter_issues(metadata, schema_type='ome_zarr')¶
Get all validation errors as structured (path, message) pairs.
- Parameters:
- Returns:
List of (path, message) tuples, where path is the location of the offending value within
metadataas a tuple of keys/indices.- Raises:
ValueError – If schema type is not found
- Return type: