Validation
ome_zarr_models.common.validation.AlphaNumericConstraint
AlphaNumericConstraint = StringConstraints(pattern='^[a-zA-Z0-9]*$')
Require a string to only contain letters and numbers
ome_zarr_models.common.validation.RGBHexConstraint
RGBHexConstraint = StringConstraints(pattern='[0-9a-fA-F]{6}')
Require a string to be a valid RGB hex string
ome_zarr_models.common.validation.check_array_path
check_array_path(group: Group, array_path: str, *, expected_zarr_version: Literal[2, 3]) -> AnyArraySpec | AnyArraySpec
Check if an array exists at a given path in a group.
Returns:
| Type | Description |
|---|---|
ArraySpec
|
If the path exists, it's ArraySpec is returned. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the array doesn't exist, or the array is not the expected Zarr version. |
ome_zarr_models.common.validation.check_array_spec
check_array_spec(spec: AnyGroupSpec, path: str) -> AnyArraySpec
check_array_spec(spec: AnyGroupSpec, path: str) -> AnyArraySpec
check_array_spec(spec: AnyGroupSpec | AnyGroupSpec, path: str) -> AnyArraySpec | AnyArraySpec
Check that a path within a group is an array.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the node at path is not an array. |
ome_zarr_models.common.validation.check_group_path
check_group_path(group: Group, group_path: str, *, expected_zarr_version: Literal[2, 3]) -> AnyGroupSpec | AnyGroupSpec
Check if a group exists at a given path in a group.
Returns:
| Type | Description |
|---|---|
GroupSpec
|
If the path exists, it's GroupSpec is returned. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the path doesn't exist. |
ValueError
|
If the group doesn't exist, or the group is not the expected Zarr version. |
ome_zarr_models.common.validation.check_group_spec
check_group_spec(spec: AnyGroupSpec, path: str) -> AnyGroupSpec
check_group_spec(spec: AnyGroupSpec, path: str) -> AnyGroupSpec
check_group_spec(spec: AnyGroupSpec | AnyGroupSpec, path: str) -> AnyGroupSpec | AnyGroupSpec
Check that a path within a group is a group.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the node at path is not a group. |
ome_zarr_models.common.validation.check_length
Check if the length of a sequence is valid.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the sequence is not a valid length. |
ome_zarr_models.common.validation.check_ordered_scales
check_ordered_scales(scales: list[VectorScale]) -> None
Given a list of scales, make sure they are ordered from low to high.
Raises:
| Type | Description |
|---|---|
ValueError
|
If any items in one set of scales is smaller than any item in the preceding set of scales. |
ome_zarr_models.common.validation.unique_items_validator
Make sure a list contains unique items.
Raises:
| Type | Description |
|---|---|
ValueError
|
If duplicate values are found in values. |