@fideus-labs/ngff-zarr 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/browser-mod.d.ts +6 -5
- package/esm/browser-mod.d.ts.map +1 -1
- package/esm/browser-mod.js +5 -4
- package/esm/browser-mod.js.map +1 -1
- package/esm/io/from_ngff_zarr-browser.d.ts +8 -4
- package/esm/io/from_ngff_zarr-browser.d.ts.map +1 -1
- package/esm/io/from_ngff_zarr-browser.js +6 -4
- package/esm/io/from_ngff_zarr-browser.js.map +1 -1
- package/esm/io/from_ngff_zarr.d.ts +7 -3
- package/esm/io/from_ngff_zarr.d.ts.map +1 -1
- package/esm/io/from_ngff_zarr.js +5 -3
- package/esm/io/from_ngff_zarr.js.map +1 -1
- package/esm/io/hcs.d.ts.map +1 -1
- package/esm/io/hcs.js +11 -3
- package/esm/io/hcs.js.map +1 -1
- package/esm/io/to_ngff_zarr-browser.d.ts +24 -7
- package/esm/io/to_ngff_zarr-browser.d.ts.map +1 -1
- package/esm/io/to_ngff_zarr-browser.js +18 -10
- package/esm/io/to_ngff_zarr-browser.js.map +1 -1
- package/esm/io/to_ngff_zarr.d.ts +30 -13
- package/esm/io/to_ngff_zarr.d.ts.map +1 -1
- package/esm/io/to_ngff_zarr.js +30 -23
- package/esm/io/to_ngff_zarr.js.map +1 -1
- package/esm/io/to_ngff_zarr_ozx_common.d.ts +8 -8
- package/esm/io/to_ngff_zarr_ozx_common.d.ts.map +1 -1
- package/esm/io/to_ngff_zarr_ozx_common.js +5 -5
- package/esm/io/to_ngff_zarr_ozx_common.js.map +1 -1
- package/esm/mod.d.ts +4 -3
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -2
- package/esm/mod.js.map +1 -1
- package/esm/process/to_multiscales-browser.d.ts +3 -3
- package/esm/process/to_multiscales-browser.d.ts.map +1 -1
- package/esm/process/to_multiscales-browser.js +1 -1
- package/esm/process/to_multiscales-node.d.ts +3 -3
- package/esm/process/to_multiscales-node.d.ts.map +1 -1
- package/esm/process/to_multiscales-node.js +1 -1
- package/esm/process/to_multiscales-shared.d.ts +3 -3
- package/esm/process/to_multiscales-shared.d.ts.map +1 -1
- package/esm/process/to_multiscales-shared.js +3 -3
- package/esm/process/to_multiscales-shared.js.map +1 -1
- package/esm/schemas/multiscales.d.ts +2 -1
- package/esm/schemas/multiscales.d.ts.map +1 -1
- package/esm/schemas/multiscales.js +3 -1
- package/esm/schemas/multiscales.js.map +1 -1
- package/esm/types/hcs.d.ts +10 -3
- package/esm/types/hcs.d.ts.map +1 -1
- package/esm/types/hcs.js +19 -6
- package/esm/types/hcs.js.map +1 -1
- package/esm/types/multiscales.d.ts +6 -3
- package/esm/types/multiscales.d.ts.map +1 -1
- package/esm/types/multiscales.js +3 -2
- package/esm/types/multiscales.js.map +1 -1
- package/esm/utils/codecs.d.ts +27 -0
- package/esm/utils/codecs.d.ts.map +1 -1
- package/esm/utils/codecs.js +84 -0
- package/esm/utils/codecs.js.map +1 -1
- package/esm/utils/compute_omero.d.ts +4 -4
- package/esm/utils/compute_omero.d.ts.map +1 -1
- package/esm/utils/compute_omero.js +3 -3
- package/esm/utils/compute_omero.js.map +1 -1
- package/esm/utils/factory.d.ts +3 -2
- package/esm/utils/factory.d.ts.map +1 -1
- package/esm/utils/factory.js +5 -3
- package/esm/utils/factory.js.map +1 -1
- package/esm/utils/from_zarr_attrs.d.ts.map +1 -1
- package/esm/utils/from_zarr_attrs.js +40 -0
- package/esm/utils/from_zarr_attrs.js.map +1 -1
- package/esm/utils/py_format.d.ts +18 -0
- package/esm/utils/py_format.d.ts.map +1 -0
- package/esm/utils/py_format.js +22 -0
- package/esm/utils/py_format.js.map +1 -0
- package/esm/utils/rfc4_validation.d.ts +8 -0
- package/esm/utils/rfc4_validation.d.ts.map +1 -1
- package/esm/utils/rfc4_validation.js +13 -2
- package/esm/utils/rfc4_validation.js.map +1 -1
- package/esm/utils/structural_validation.d.ts +379 -0
- package/esm/utils/structural_validation.d.ts.map +1 -0
- package/esm/utils/structural_validation.js +739 -0
- package/esm/utils/structural_validation.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural validation for OME-Zarr v0.4 image/multiscales metadata.
|
|
3
|
+
*
|
|
4
|
+
* Where the Zod schema validation in {@link validateMetadata} answers "is this
|
|
5
|
+
* shaped like OME-Zarr?", the rules in this module answer "does this obey the
|
|
6
|
+
* specification's structural invariants?" -- axis counts, axis ordering,
|
|
7
|
+
* coordinate-transformation arity, finest-to-coarsest dataset ordering, and
|
|
8
|
+
* OMERO channel color format. These are spec MUSTs that a JSON Schema cannot
|
|
9
|
+
* express.
|
|
10
|
+
*
|
|
11
|
+
* Each rule is identified by a stable, kebab-case {@link SpecRule} value that is
|
|
12
|
+
* part of the observable surface: the identifiers, their evaluation order, and
|
|
13
|
+
* the dotted-segment location strings are kept byte-for-byte identical to the
|
|
14
|
+
* package's Python implementation so the two stay in lockstep (a property the
|
|
15
|
+
* cross-language parity tests assert). Rules fail fast -- the orchestrator
|
|
16
|
+
* throws a {@link ValidationError} on the first violation, in canonical
|
|
17
|
+
* specification order.
|
|
18
|
+
*
|
|
19
|
+
* This module provides the image/multiscales rule surface -- including the
|
|
20
|
+
* RFC 4 anatomical-orientation checks -- plus the HCS plate/well rules, which
|
|
21
|
+
* operate on separate metadata objects and are dispatched by the companion
|
|
22
|
+
* {@link validatePlate} and {@link validateWell} entry points.
|
|
23
|
+
*/
|
|
24
|
+
import { type Metadata } from "../types/zarr_metadata.js";
|
|
25
|
+
import type { PlateMetadata, WellMetadata } from "../types/hcs.js";
|
|
26
|
+
/**
|
|
27
|
+
* Stable, kebab-case identifiers for the structural specification rules.
|
|
28
|
+
*
|
|
29
|
+
* The string values are the observable surface -- they appear in
|
|
30
|
+
* {@link ValidationError.rule}, logs, and tests -- and must match the package's
|
|
31
|
+
* Python implementation exactly. Members are listed in canonical
|
|
32
|
+
* specification-MUST evaluation order.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SpecRule: {
|
|
35
|
+
/** Axis count within the v0.4 range of 2..5 inclusive. */
|
|
36
|
+
readonly AxisCount: "axis-count";
|
|
37
|
+
/** At most one `time` axis and at most one `channel` axis. */
|
|
38
|
+
readonly AxisType: "axis-type";
|
|
39
|
+
/** time before channel before space; spatial names suffix (z, y, x). */
|
|
40
|
+
readonly AxisOrder: "axis-order";
|
|
41
|
+
/** Every scale/translation vector length equals the axis count. */
|
|
42
|
+
readonly ScaleLengthMismatch: "scale-length-mismatch";
|
|
43
|
+
/** Exactly one scale per dataset; a translation must follow it. */
|
|
44
|
+
readonly GlobalCoordTransformAfterPerLevel: "global-coord-transform-after-per-level";
|
|
45
|
+
/** Datasets ordered finest to coarsest; spatial scale must not shrink. */
|
|
46
|
+
readonly DatasetOrderHighestToLowest: "dataset-order-highest-to-lowest";
|
|
47
|
+
/** Each OMERO channel color is exactly six hexadecimal digits. */
|
|
48
|
+
readonly OmeroChannelColorFormat: "omero-channel-color-format";
|
|
49
|
+
/** All spatial-axis RFC 4 orientations share one `type`. */
|
|
50
|
+
readonly AxisOrientationConsistentType: "axis-orientation-consistent-type";
|
|
51
|
+
/** If any spatial axis declares an orientation, all spatial axes do. */
|
|
52
|
+
readonly AxisOrientationCompleteness: "axis-orientation-completeness";
|
|
53
|
+
/** Each well's rowIndex/columnIndex agrees with the row/column in its path. */
|
|
54
|
+
readonly PlateRowIndexConsistency: "plate-row-index-consistency";
|
|
55
|
+
/** Each well image references an acquisition when the plate declares many. */
|
|
56
|
+
readonly WellAcquisitionMissing: "well-acquisition-missing";
|
|
57
|
+
};
|
|
58
|
+
/** Union of the {@link SpecRule} string values. */
|
|
59
|
+
export type SpecRule = (typeof SpecRule)[keyof typeof SpecRule];
|
|
60
|
+
/**
|
|
61
|
+
* How much validation {@link validateStructural} performs.
|
|
62
|
+
*
|
|
63
|
+
* `"strict"` is the default and runs every structural image/multiscales rule.
|
|
64
|
+
* `"schema_only"` skips them -- schema validation is the separate concern of
|
|
65
|
+
* {@link validateMetadata}, which checks the raw attributes via Zod.
|
|
66
|
+
*/
|
|
67
|
+
export declare const ValidationLevel: {
|
|
68
|
+
/** Skip structural rules; rely on Zod schema validation only. */
|
|
69
|
+
readonly SchemaOnly: "schema_only";
|
|
70
|
+
/** Run every structural image/multiscales rule (the default). */
|
|
71
|
+
readonly Strict: "strict";
|
|
72
|
+
};
|
|
73
|
+
/** Union of the {@link ValidationLevel} string values. */
|
|
74
|
+
export type ValidationLevel = (typeof ValidationLevel)[keyof typeof ValidationLevel];
|
|
75
|
+
/**
|
|
76
|
+
* Options controlling structural validation.
|
|
77
|
+
*/
|
|
78
|
+
export interface ValidateOptions {
|
|
79
|
+
/**
|
|
80
|
+
* Validation level to run. Defaults to {@link ValidationLevel.Strict}
|
|
81
|
+
* (`"strict"`).
|
|
82
|
+
*/
|
|
83
|
+
level?: ValidationLevel;
|
|
84
|
+
/**
|
|
85
|
+
* Whether unknown metadata fields are tolerated. Defaults to `true`,
|
|
86
|
+
* mirroring the parser, which warns on rather than rejects unknown fields.
|
|
87
|
+
*/
|
|
88
|
+
allowUnknownFields?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Raised when a structural specification rule is violated.
|
|
92
|
+
*
|
|
93
|
+
* Carries the offending {@link SpecRule} and an optional `location` identifying
|
|
94
|
+
* the offending metadata node in dotted-segment (JSON-Pointer-style) form, e.g.
|
|
95
|
+
* `multiscales[0].datasets[2].coordinateTransformations[0]`. The `message` is
|
|
96
|
+
* formatted as `Spec rule [<rule>] violated: <message>`.
|
|
97
|
+
*/
|
|
98
|
+
export declare class ValidationError extends Error {
|
|
99
|
+
/** The structural rule that was violated. */
|
|
100
|
+
readonly rule: SpecRule;
|
|
101
|
+
/** Dotted-segment location of the offending metadata node, if known. */
|
|
102
|
+
readonly location?: string;
|
|
103
|
+
constructor(rule: SpecRule, message: string, location?: string);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Validate that the axis count is within the v0.4-permitted range.
|
|
107
|
+
*
|
|
108
|
+
* OME-Zarr v0.4 requires between 2 and 5 axes, inclusive.
|
|
109
|
+
*
|
|
110
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
111
|
+
* @throws {ValidationError} With {@link SpecRule.AxisCount} when
|
|
112
|
+
* `metadata.axes.length` lies outside `2..5`; location `multiscales[0].axes`.
|
|
113
|
+
*/
|
|
114
|
+
export declare function validateAxisCount(metadata: Metadata): void;
|
|
115
|
+
/**
|
|
116
|
+
* Validate axis-type multiplicity.
|
|
117
|
+
*
|
|
118
|
+
* At most one `time` axis and at most one `channel` axis may be present.
|
|
119
|
+
*
|
|
120
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
121
|
+
* @throws {ValidationError} With {@link SpecRule.AxisType} when more than one
|
|
122
|
+
* `time` axis or more than one `channel` axis is present; location
|
|
123
|
+
* `multiscales[0].axes`.
|
|
124
|
+
*/
|
|
125
|
+
export declare function validateAxisType(metadata: Metadata): void;
|
|
126
|
+
/**
|
|
127
|
+
* Validate the class ordering of axes.
|
|
128
|
+
*
|
|
129
|
+
* Axes are ranked by type (`time` < `channel` < `space`) and must be listed in
|
|
130
|
+
* non-decreasing rank order: every `time` axis precedes every `channel` axis,
|
|
131
|
+
* which precedes every `space` axis. The first adjacent pair that inverts this
|
|
132
|
+
* ranking is reported. Pairs involving an axis type with no rank (e.g. `array`)
|
|
133
|
+
* are skipped.
|
|
134
|
+
*
|
|
135
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
136
|
+
* @throws {ValidationError} With {@link SpecRule.AxisOrder} for the first
|
|
137
|
+
* adjacent pair where a lower-ranked axis type follows a higher-ranked one;
|
|
138
|
+
* location `multiscales[0].axes[i+1]`.
|
|
139
|
+
*/
|
|
140
|
+
export declare function validateAxisOrder(metadata: Metadata): void;
|
|
141
|
+
/**
|
|
142
|
+
* Validate the count and names of spatial axes.
|
|
143
|
+
*
|
|
144
|
+
* The `space` axes, taken in order, must be the matching-length suffix of
|
|
145
|
+
* `(z, y, x)`: one spatial axis must be `(x)`, two must be `(y, x)`, and three
|
|
146
|
+
* must be `(z, y, x)`. At most three `space` axes are permitted.
|
|
147
|
+
*
|
|
148
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
149
|
+
* @throws {ValidationError} With {@link SpecRule.AxisOrder} when there are more
|
|
150
|
+
* than three `space` axes, or when their names are not the expected suffix of
|
|
151
|
+
* `(z, y, x)`; location `multiscales[0].axes` or the first offending axis.
|
|
152
|
+
*/
|
|
153
|
+
export declare function validateSpatialAxisOrder(metadata: Metadata): void;
|
|
154
|
+
/**
|
|
155
|
+
* Validate that each dataset defines exactly one `scale` transform.
|
|
156
|
+
*
|
|
157
|
+
* Every dataset's `coordinateTransformations` must contain exactly one `scale`
|
|
158
|
+
* (the per-level voxel size). This shares the per-dataset
|
|
159
|
+
* coordinate-transform-shape rule identifier
|
|
160
|
+
* ({@link SpecRule.GlobalCoordTransformAfterPerLevel}); there is no dedicated
|
|
161
|
+
* identifier for the scale count.
|
|
162
|
+
*
|
|
163
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
164
|
+
* @throws {ValidationError} With
|
|
165
|
+
* {@link SpecRule.GlobalCoordTransformAfterPerLevel} when a dataset has zero or
|
|
166
|
+
* more than one `scale` transform; location
|
|
167
|
+
* `multiscales[0].datasets[i].coordinateTransformations`.
|
|
168
|
+
*/
|
|
169
|
+
export declare function validatePerDatasetScaleCount(metadata: Metadata): void;
|
|
170
|
+
/**
|
|
171
|
+
* Validate coordinate-transform vector lengths against the axis count.
|
|
172
|
+
*
|
|
173
|
+
* Every `scale` and `translation` vector -- in the global
|
|
174
|
+
* `coordinateTransformations` (if present) and in each dataset -- must have
|
|
175
|
+
* exactly one entry per axis. The first mismatch, scanned
|
|
176
|
+
* global-then-per-dataset, is reported. The length invariant itself lives in
|
|
177
|
+
* {@link transformLenMismatch}.
|
|
178
|
+
*
|
|
179
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
180
|
+
* @throws {ValidationError} With {@link SpecRule.ScaleLengthMismatch} for the
|
|
181
|
+
* first transform whose vector length disagrees with `metadata.axes.length`;
|
|
182
|
+
* location identifies the offending transform.
|
|
183
|
+
*/
|
|
184
|
+
export declare function validateScaleLength(metadata: Metadata): void;
|
|
185
|
+
/**
|
|
186
|
+
* Validate coordinate-transform ordering within each dataset.
|
|
187
|
+
*
|
|
188
|
+
* Within a dataset's `coordinateTransformations`, a `translation` (if present)
|
|
189
|
+
* must follow its `scale` -- a `scale` must never appear after a `translation`.
|
|
190
|
+
*
|
|
191
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
192
|
+
* @throws {ValidationError} With
|
|
193
|
+
* {@link SpecRule.GlobalCoordTransformAfterPerLevel} for the first dataset
|
|
194
|
+
* where a `scale` follows a `translation`; location identifies the offending
|
|
195
|
+
* `scale`.
|
|
196
|
+
*/
|
|
197
|
+
export declare function validateTransformOrder(metadata: Metadata): void;
|
|
198
|
+
/**
|
|
199
|
+
* Validate that datasets are ordered finest to coarsest.
|
|
200
|
+
*
|
|
201
|
+
* Multiscale datasets must be listed from highest resolution (finest, i.e.
|
|
202
|
+
* smallest spatial `scale`) to lowest (coarsest). For each adjacent pair, the
|
|
203
|
+
* later level's `scale` must not be smaller than the earlier level's on any
|
|
204
|
+
* `space` axis. Pairs whose `scale` vectors are missing or too short to index a
|
|
205
|
+
* spatial axis are skipped -- those shapes are the concern of
|
|
206
|
+
* {@link validatePerDatasetScaleCount} and {@link validateScaleLength} -- so
|
|
207
|
+
* this rule never indexes out of bounds.
|
|
208
|
+
*
|
|
209
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
210
|
+
* @throws {ValidationError} With {@link SpecRule.DatasetOrderHighestToLowest}
|
|
211
|
+
* for the first adjacent pair whose later (coarser) level has a smaller spatial
|
|
212
|
+
* scale; location `multiscales[0].datasets[i+1]`.
|
|
213
|
+
*/
|
|
214
|
+
export declare function validateDatasetOrder(metadata: Metadata): void;
|
|
215
|
+
/**
|
|
216
|
+
* Validate the color format of each OMERO channel.
|
|
217
|
+
*
|
|
218
|
+
* When OMERO rendering metadata is present, every channel `color` must be
|
|
219
|
+
* exactly six hexadecimal digits (RGB). This reuses the package's existing
|
|
220
|
+
* {@link validateColor} predicate rather than re-implementing the format check,
|
|
221
|
+
* surfacing its failure message through the unified {@link ValidationError}
|
|
222
|
+
* channel.
|
|
223
|
+
*
|
|
224
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
225
|
+
* @throws {ValidationError} With {@link SpecRule.OmeroChannelColorFormat} for
|
|
226
|
+
* the first channel whose `color` is not six hex digits; location
|
|
227
|
+
* `multiscales[0].omero.channels[i].color`.
|
|
228
|
+
*/
|
|
229
|
+
export declare function validateOmeroColorHex(metadata: Metadata): void;
|
|
230
|
+
/**
|
|
231
|
+
* Validate RFC 4 anatomical-orientation metadata on the spatial axes.
|
|
232
|
+
*
|
|
233
|
+
* This rule does not reimplement RFC 4; it wraps the package's existing
|
|
234
|
+
* logic -- {@link hasRfc4OrientationMetadata} and
|
|
235
|
+
* {@link validateRfc4Orientation} -- and surfaces its failures through the
|
|
236
|
+
* unified {@link ValidationError} channel. The parsed {@link Axis} objects are
|
|
237
|
+
* first rendered back to the record form those helpers expect (see
|
|
238
|
+
* {@link axisToValidationRecord}).
|
|
239
|
+
*
|
|
240
|
+
* Orientation is optional in RFC 4, so when no spatial axis carries it the rule
|
|
241
|
+
* is a no-op.
|
|
242
|
+
*
|
|
243
|
+
* @param metadata - The parsed multiscales metadata to validate.
|
|
244
|
+
* @throws {ValidationError} With {@link SpecRule.AxisOrientationConsistentType}
|
|
245
|
+
* when the spatial axes' orientations do not all share one `type`, or
|
|
246
|
+
* {@link SpecRule.AxisOrientationCompleteness} when orientation is defined for
|
|
247
|
+
* some but not all spatial axes; location `multiscales[0].axes`. The original
|
|
248
|
+
* RFC 4 message text is preserved. Any other failure from
|
|
249
|
+
* {@link validateRfc4Orientation} -- e.g. an orientation value outside the
|
|
250
|
+
* RFC 4 vocabulary, a schema-level concern with no dedicated structural rule
|
|
251
|
+
* -- propagates unchanged.
|
|
252
|
+
*/
|
|
253
|
+
export declare function validateAxisOrientation(metadata: Metadata): void;
|
|
254
|
+
/**
|
|
255
|
+
* Validate each plate well's recorded indices against its `path`.
|
|
256
|
+
*
|
|
257
|
+
* Every `PlateWell` records a `path` of the form `"<row>/<column>"` (e.g.
|
|
258
|
+
* `"B/03"`) alongside numeric `rowIndex` and `columnIndex` fields. OME-Zarr v0.4
|
|
259
|
+
* requires these to agree: the row segment must name an entry in `plate.rows`
|
|
260
|
+
* whose position equals `rowIndex`, and the column segment must name an entry in
|
|
261
|
+
* `plate.columns` whose position equals `columnIndex`. The first offending well,
|
|
262
|
+
* scanned in order, is reported.
|
|
263
|
+
*
|
|
264
|
+
* @param plate - The plate metadata whose wells are validated.
|
|
265
|
+
* @throws {ValidationError} With {@link SpecRule.PlateRowIndexConsistency} for
|
|
266
|
+
* the first well whose `path` is not `"<row>/<column>"`, whose row/column
|
|
267
|
+
* segment is absent from `plate.rows`/`plate.columns`, or whose recorded
|
|
268
|
+
* `rowIndex`/`columnIndex` disagrees with that segment's position; location
|
|
269
|
+
* `plate.wells[i]`.
|
|
270
|
+
*/
|
|
271
|
+
export declare function validatePlateWellIndexConsistency(plate: PlateMetadata): void;
|
|
272
|
+
/**
|
|
273
|
+
* Validate that well images reference an acquisition when required.
|
|
274
|
+
*
|
|
275
|
+
* When a plate declares more than one acquisition, every image in each of its
|
|
276
|
+
* wells must carry an `acquisition` reference so the field can be attributed to
|
|
277
|
+
* a specific acquisition. Plates with zero or one acquisition impose no such
|
|
278
|
+
* requirement, so this rule is a no-op for them. The first image missing its
|
|
279
|
+
* reference, scanned in order, is reported.
|
|
280
|
+
*
|
|
281
|
+
* @param plate - The plate metadata declaring the acquisitions.
|
|
282
|
+
* @param well - The well metadata whose images are validated.
|
|
283
|
+
* @throws {ValidationError} With {@link SpecRule.WellAcquisitionMissing} for the
|
|
284
|
+
* first `WellImage` whose `acquisition` is absent while the plate declares
|
|
285
|
+
* multiple acquisitions; location `well.images[i].acquisition`.
|
|
286
|
+
*/
|
|
287
|
+
export declare function validateWellAcquisition(plate: PlateMetadata, well: WellMetadata): void;
|
|
288
|
+
/**
|
|
289
|
+
* Run the structural image/multiscales rules in canonical specification order.
|
|
290
|
+
*
|
|
291
|
+
* Orchestrates the per-rule `validate*` functions in this module. It is
|
|
292
|
+
* fail-fast: the rules run in canonical specification-MUST order and the first
|
|
293
|
+
* {@link ValidationError} thrown propagates to the caller -- later rules do not
|
|
294
|
+
* run. The rules run in this order:
|
|
295
|
+
*
|
|
296
|
+
* 1. {@link validateAxisCount}
|
|
297
|
+
* 2. {@link validateAxisType}
|
|
298
|
+
* 3. {@link validateAxisOrder}
|
|
299
|
+
* 4. {@link validateSpatialAxisOrder}
|
|
300
|
+
* 5. {@link validatePerDatasetScaleCount}
|
|
301
|
+
* 6. {@link validateScaleLength}
|
|
302
|
+
* 7. {@link validateTransformOrder}
|
|
303
|
+
* 8. {@link validateDatasetOrder}
|
|
304
|
+
* 9. {@link validateOmeroColorHex}
|
|
305
|
+
* 10. {@link validateAxisOrientation}
|
|
306
|
+
*
|
|
307
|
+
* Under {@link ValidationLevel.SchemaOnly} this function returns immediately
|
|
308
|
+
* without running any structural rule -- shape/schema validation is the
|
|
309
|
+
* separate concern of {@link validateMetadata}, which checks the raw
|
|
310
|
+
* attributes via Zod. The default level is {@link ValidationLevel.Strict}.
|
|
311
|
+
*
|
|
312
|
+
* This orchestrator covers the image/multiscales rules, including the RFC 4
|
|
313
|
+
* anatomical-orientation checks ({@link validateAxisOrientation}, a no-op when
|
|
314
|
+
* no axis declares orientation). The HCS plate/well structural rules operate on
|
|
315
|
+
* separate metadata objects and are dispatched by the companion
|
|
316
|
+
* {@link validatePlate} and {@link validateWell} entry points.
|
|
317
|
+
*
|
|
318
|
+
* @param metadata - The parsed OME-Zarr v0.4 multiscales metadata to validate.
|
|
319
|
+
* @param options - Validation options; defaults to
|
|
320
|
+
* `{ level: "strict", allowUnknownFields: true }`.
|
|
321
|
+
* @throws {ValidationError} For the first structural rule violated, carrying
|
|
322
|
+
* the offending {@link SpecRule} and `location`. Never thrown under
|
|
323
|
+
* {@link ValidationLevel.SchemaOnly}, which runs no structural rule.
|
|
324
|
+
*/
|
|
325
|
+
export declare function validateStructural(metadata: Metadata, options?: ValidateOptions): void;
|
|
326
|
+
/**
|
|
327
|
+
* Run the structural HCS plate rules in canonical specification order.
|
|
328
|
+
*
|
|
329
|
+
* The plate-level counterpart to {@link validateStructural}: it orchestrates
|
|
330
|
+
* the structural rules that operate on a parsed {@link PlateMetadata}. Like its
|
|
331
|
+
* image/multiscales sibling it is fail-fast -- the first {@link ValidationError}
|
|
332
|
+
* thrown propagates to the caller and later rules do not run. The rules run in
|
|
333
|
+
* this order:
|
|
334
|
+
*
|
|
335
|
+
* 1. {@link validatePlateWellIndexConsistency}
|
|
336
|
+
*
|
|
337
|
+
* Per-well image rules (e.g. acquisition references) are the separate concern
|
|
338
|
+
* of {@link validateWell}, called where each well's own metadata is loaded.
|
|
339
|
+
*
|
|
340
|
+
* Under {@link ValidationLevel.SchemaOnly} this function returns immediately
|
|
341
|
+
* without running any structural rule -- shape/schema validation is the
|
|
342
|
+
* separate concern of {@link validateMetadata}, which checks the raw attributes
|
|
343
|
+
* via Zod. The default level is {@link ValidationLevel.Strict}.
|
|
344
|
+
*
|
|
345
|
+
* @param plate - The parsed OME-Zarr v0.4 plate metadata to validate.
|
|
346
|
+
* @param options - Validation options; defaults to
|
|
347
|
+
* `{ level: "strict", allowUnknownFields: true }`.
|
|
348
|
+
* @throws {ValidationError} For the first structural plate rule violated,
|
|
349
|
+
* carrying the offending {@link SpecRule} and `location`. Never thrown under
|
|
350
|
+
* {@link ValidationLevel.SchemaOnly}, which runs no structural rule.
|
|
351
|
+
*/
|
|
352
|
+
export declare function validatePlate(plate: PlateMetadata, options?: ValidateOptions): void;
|
|
353
|
+
/**
|
|
354
|
+
* Run the structural HCS well rules in canonical specification order.
|
|
355
|
+
*
|
|
356
|
+
* Validates a single {@link WellMetadata} in the context of its parent
|
|
357
|
+
* {@link PlateMetadata} -- the plate's acquisition declarations govern whether
|
|
358
|
+
* each well image must reference an acquisition. Fail-fast, like
|
|
359
|
+
* {@link validateStructural} and {@link validatePlate}. The rules run in this
|
|
360
|
+
* order:
|
|
361
|
+
*
|
|
362
|
+
* 1. {@link validateWellAcquisition}
|
|
363
|
+
*
|
|
364
|
+
* Under {@link ValidationLevel.SchemaOnly} this function returns immediately
|
|
365
|
+
* without running any structural rule -- shape/schema validation is the
|
|
366
|
+
* separate concern of {@link validateMetadata}, which checks the raw attributes
|
|
367
|
+
* via Zod. The default level is {@link ValidationLevel.Strict}.
|
|
368
|
+
*
|
|
369
|
+
* @param plate - The parsed plate metadata that owns `well`; supplies the
|
|
370
|
+
* acquisition context the well rules consult.
|
|
371
|
+
* @param well - The parsed well metadata to validate.
|
|
372
|
+
* @param options - Validation options; defaults to
|
|
373
|
+
* `{ level: "strict", allowUnknownFields: true }`.
|
|
374
|
+
* @throws {ValidationError} For the first structural well rule violated,
|
|
375
|
+
* carrying the offending {@link SpecRule} and `location`. Never thrown under
|
|
376
|
+
* {@link ValidationLevel.SchemaOnly}, which runs no structural rule.
|
|
377
|
+
*/
|
|
378
|
+
export declare function validateWell(plate: PlateMetadata, well: WellMetadata, options?: ValidateOptions): void;
|
|
379
|
+
//# sourceMappingURL=structural_validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural_validation.d.ts","sourceRoot":"","sources":["../../src/utils/structural_validation.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAGL,KAAK,QAAQ,EAGd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAOnE;;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