@fideus-labs/ngff-zarr 0.0.1
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/LICENSE +10 -0
- package/README.md +73 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +57 -0
- package/esm/io/from_ngff_zarr.d.ts +7 -0
- package/esm/io/from_ngff_zarr.d.ts.map +1 -0
- package/esm/io/from_ngff_zarr.js +140 -0
- package/esm/io/to_ngff_zarr.d.ts +9 -0
- package/esm/io/to_ngff_zarr.d.ts.map +1 -0
- package/esm/io/to_ngff_zarr.js +57 -0
- package/esm/mod.d.ts +17 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +16 -0
- package/esm/package.json +3 -0
- package/esm/schemas/lazy_array.d.ts +8 -0
- package/esm/schemas/lazy_array.d.ts.map +1 -0
- package/esm/schemas/lazy_array.js +7 -0
- package/esm/schemas/methods.d.ts +3 -0
- package/esm/schemas/methods.d.ts.map +1 -0
- package/esm/schemas/methods.js +6 -0
- package/esm/schemas/multiscales.d.ts +4 -0
- package/esm/schemas/multiscales.d.ts.map +1 -0
- package/esm/schemas/multiscales.js +19 -0
- package/esm/schemas/ngff_image.d.ts +13 -0
- package/esm/schemas/ngff_image.d.ts.map +1 -0
- package/esm/schemas/ngff_image.js +12 -0
- package/esm/schemas/units.d.ts +13 -0
- package/esm/schemas/units.d.ts.map +1 -0
- package/esm/schemas/units.js +75 -0
- package/esm/schemas/zarr_metadata.d.ts +49 -0
- package/esm/schemas/zarr_metadata.d.ts.map +1 -0
- package/esm/schemas/zarr_metadata.js +47 -0
- package/esm/types/lazy_array.d.ts +18 -0
- package/esm/types/lazy_array.d.ts.map +1 -0
- package/esm/types/lazy_array.js +27 -0
- package/esm/types/methods.d.ts +7 -0
- package/esm/types/methods.d.ts.map +1 -0
- package/esm/types/methods.js +7 -0
- package/esm/types/multiscales.d.ts +21 -0
- package/esm/types/multiscales.d.ts.map +1 -0
- package/esm/types/multiscales.js +34 -0
- package/esm/types/ngff_image.d.ts +24 -0
- package/esm/types/ngff_image.d.ts.map +1 -0
- package/esm/types/ngff_image.js +32 -0
- package/esm/types/units.d.ts +12 -0
- package/esm/types/units.d.ts.map +1 -0
- package/esm/types/units.js +61 -0
- package/esm/types/zarr_metadata.d.ts +49 -0
- package/esm/types/zarr_metadata.d.ts.map +1 -0
- package/esm/types/zarr_metadata.js +14 -0
- package/esm/utils/factory.d.ts +13 -0
- package/esm/utils/factory.d.ts.map +1 -0
- package/esm/utils/factory.js +67 -0
- package/esm/utils/validation.d.ts +6 -0
- package/esm/utils/validation.d.ts.map +1 -0
- package/esm/utils/validation.js +72 -0
- package/package.json +47 -0
- package/script/_dnt.shims.d.ts +2 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +60 -0
- package/script/io/from_ngff_zarr.d.ts +7 -0
- package/script/io/from_ngff_zarr.d.ts.map +1 -0
- package/script/io/from_ngff_zarr.js +167 -0
- package/script/io/to_ngff_zarr.d.ts +9 -0
- package/script/io/to_ngff_zarr.d.ts.map +1 -0
- package/script/io/to_ngff_zarr.js +83 -0
- package/script/mod.d.ts +17 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +41 -0
- package/script/package.json +3 -0
- package/script/schemas/lazy_array.d.ts +8 -0
- package/script/schemas/lazy_array.d.ts.map +1 -0
- package/script/schemas/lazy_array.js +10 -0
- package/script/schemas/methods.d.ts +3 -0
- package/script/schemas/methods.d.ts.map +1 -0
- package/script/schemas/methods.js +9 -0
- package/script/schemas/multiscales.d.ts +4 -0
- package/script/schemas/multiscales.d.ts.map +1 -0
- package/script/schemas/multiscales.js +22 -0
- package/script/schemas/ngff_image.d.ts +13 -0
- package/script/schemas/ngff_image.d.ts.map +1 -0
- package/script/schemas/ngff_image.js +15 -0
- package/script/schemas/units.d.ts +13 -0
- package/script/schemas/units.d.ts.map +1 -0
- package/script/schemas/units.js +78 -0
- package/script/schemas/zarr_metadata.d.ts +49 -0
- package/script/schemas/zarr_metadata.d.ts.map +1 -0
- package/script/schemas/zarr_metadata.js +50 -0
- package/script/types/lazy_array.d.ts +18 -0
- package/script/types/lazy_array.d.ts.map +1 -0
- package/script/types/lazy_array.js +31 -0
- package/script/types/methods.d.ts +7 -0
- package/script/types/methods.d.ts.map +1 -0
- package/script/types/methods.js +10 -0
- package/script/types/multiscales.d.ts +21 -0
- package/script/types/multiscales.d.ts.map +1 -0
- package/script/types/multiscales.js +38 -0
- package/script/types/ngff_image.d.ts +24 -0
- package/script/types/ngff_image.d.ts.map +1 -0
- package/script/types/ngff_image.js +36 -0
- package/script/types/units.d.ts +12 -0
- package/script/types/units.d.ts.map +1 -0
- package/script/types/units.js +66 -0
- package/script/types/zarr_metadata.d.ts +49 -0
- package/script/types/zarr_metadata.d.ts.map +1 -0
- package/script/types/zarr_metadata.js +20 -0
- package/script/utils/factory.d.ts +13 -0
- package/script/utils/factory.d.ts.map +1 -0
- package/script/utils/factory.js +76 -0
- package/script/utils/validation.d.ts +6 -0
- package/script/utils/validation.d.ts.map +1 -0
- package/script/utils/validation.js +78 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unitValidator = exports.dimensionValidator = exports.UnitsSchema = exports.TimeUnitsSchema = exports.SpaceUnitsSchema = exports.AxesTypeSchema = exports.SpatialDimsSchema = exports.SupportedDimsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const units_js_1 = require("../types/units.js");
|
|
6
|
+
exports.SupportedDimsSchema = zod_1.z.enum([
|
|
7
|
+
"c",
|
|
8
|
+
"x",
|
|
9
|
+
"y",
|
|
10
|
+
"z",
|
|
11
|
+
"t",
|
|
12
|
+
]);
|
|
13
|
+
exports.SpatialDimsSchema = zod_1.z.enum(["x", "y", "z"]);
|
|
14
|
+
exports.AxesTypeSchema = zod_1.z.enum([
|
|
15
|
+
"time",
|
|
16
|
+
"space",
|
|
17
|
+
"channel",
|
|
18
|
+
]);
|
|
19
|
+
exports.SpaceUnitsSchema = zod_1.z.enum([
|
|
20
|
+
"angstrom",
|
|
21
|
+
"attometer",
|
|
22
|
+
"centimeter",
|
|
23
|
+
"decimeter",
|
|
24
|
+
"exameter",
|
|
25
|
+
"femtometer",
|
|
26
|
+
"foot",
|
|
27
|
+
"gigameter",
|
|
28
|
+
"hectometer",
|
|
29
|
+
"inch",
|
|
30
|
+
"kilometer",
|
|
31
|
+
"megameter",
|
|
32
|
+
"meter",
|
|
33
|
+
"micrometer",
|
|
34
|
+
"mile",
|
|
35
|
+
"millimeter",
|
|
36
|
+
"nanometer",
|
|
37
|
+
"parsec",
|
|
38
|
+
"petameter",
|
|
39
|
+
"picometer",
|
|
40
|
+
"terameter",
|
|
41
|
+
"yard",
|
|
42
|
+
"yoctometer",
|
|
43
|
+
"yottameter",
|
|
44
|
+
"zeptometer",
|
|
45
|
+
"zettameter",
|
|
46
|
+
]);
|
|
47
|
+
exports.TimeUnitsSchema = zod_1.z.enum([
|
|
48
|
+
"attosecond",
|
|
49
|
+
"centisecond",
|
|
50
|
+
"day",
|
|
51
|
+
"decisecond",
|
|
52
|
+
"exasecond",
|
|
53
|
+
"femtosecond",
|
|
54
|
+
"gigasecond",
|
|
55
|
+
"hectosecond",
|
|
56
|
+
"hour",
|
|
57
|
+
"kilosecond",
|
|
58
|
+
"megasecond",
|
|
59
|
+
"microsecond",
|
|
60
|
+
"millisecond",
|
|
61
|
+
"minute",
|
|
62
|
+
"nanosecond",
|
|
63
|
+
"petasecond",
|
|
64
|
+
"picosecond",
|
|
65
|
+
"second",
|
|
66
|
+
"terasecond",
|
|
67
|
+
"yoctosecond",
|
|
68
|
+
"yottasecond",
|
|
69
|
+
"zeptosecond",
|
|
70
|
+
"zettasecond",
|
|
71
|
+
]);
|
|
72
|
+
exports.UnitsSchema = zod_1.z.union([exports.SpaceUnitsSchema, exports.TimeUnitsSchema]);
|
|
73
|
+
exports.dimensionValidator = zod_1.z
|
|
74
|
+
.string()
|
|
75
|
+
.refine((dim) => units_js_1.supportedDims.includes(dim), { message: "Dimension must be one of: c, x, y, z, t" });
|
|
76
|
+
exports.unitValidator = zod_1.z
|
|
77
|
+
.string()
|
|
78
|
+
.refine((unit) => [...units_js_1.timeUnits, ...units_js_1.spaceUnits].includes(unit), { message: "Unit must be a valid time or space unit" });
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AxesTypeSchema, SupportedDimsSchema, UnitsSchema } from "./units.js";
|
|
3
|
+
export declare const AxisSchema: z.ZodObject<{
|
|
4
|
+
name: typeof SupportedDimsSchema;
|
|
5
|
+
type: typeof AxesTypeSchema;
|
|
6
|
+
unit: z.ZodOptional<typeof UnitsSchema>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const IdentitySchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"identity">;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const ScaleSchema: z.ZodObject<{
|
|
12
|
+
scale: z.ZodArray<z.ZodNumber>;
|
|
13
|
+
type: z.ZodLiteral<"scale">;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const TranslationSchema: z.ZodObject<{
|
|
16
|
+
translation: z.ZodArray<z.ZodNumber>;
|
|
17
|
+
type: z.ZodLiteral<"translation">;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const TransformSchema: z.ZodUnion<[
|
|
20
|
+
typeof ScaleSchema,
|
|
21
|
+
typeof TranslationSchema
|
|
22
|
+
]>;
|
|
23
|
+
export declare const DatasetSchema: z.ZodObject<{
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
coordinateTransformations: z.ZodArray<typeof TransformSchema>;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const OmeroWindowSchema: z.ZodObject<{
|
|
28
|
+
min: z.ZodNumber;
|
|
29
|
+
max: z.ZodNumber;
|
|
30
|
+
start: z.ZodNumber;
|
|
31
|
+
end: z.ZodNumber;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const OmeroChannelSchema: z.ZodObject<{
|
|
34
|
+
color: z.ZodString;
|
|
35
|
+
window: typeof OmeroWindowSchema;
|
|
36
|
+
label: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}>;
|
|
38
|
+
export declare const OmeroSchema: z.ZodObject<{
|
|
39
|
+
channels: z.ZodArray<typeof OmeroChannelSchema>;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const MetadataSchema: z.ZodObject<{
|
|
42
|
+
axes: z.ZodArray<typeof AxisSchema>;
|
|
43
|
+
datasets: z.ZodArray<typeof DatasetSchema>;
|
|
44
|
+
coordinateTransformations: z.ZodOptional<z.ZodArray<typeof TransformSchema>>;
|
|
45
|
+
omero: z.ZodOptional<typeof OmeroSchema>;
|
|
46
|
+
name: z.ZodDefault<z.ZodString>;
|
|
47
|
+
version: z.ZodDefault<z.ZodString>;
|
|
48
|
+
}>;
|
|
49
|
+
//# sourceMappingURL=zarr_metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zarr_metadata.d.ts","sourceRoot":"","sources":["../../src/schemas/zarr_metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9E,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC;IACnC,IAAI,EAAE,OAAO,mBAAmB,CAAC;IACjC,IAAI,EAAE,OAAO,cAAc,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC;CACzC,CAIC,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;CAChC,CAEC,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;CAC7B,CAGC,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC;IAC1C,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;CACnC,CAGC,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,QAAQ,CACtC;IAAC,OAAO,WAAW;IAAE,OAAO,iBAAiB;CAAC,CACH,CAAC;AAE9C,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC;IAClB,yBAAyB,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,eAAe,CAAC,CAAC;CAC/D,CAGC,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC;IAC1C,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC;IACjB,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC;IACnB,GAAG,EAAE,CAAC,CAAC,SAAS,CAAC;CAClB,CAKC,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC;IACnB,MAAM,EAAE,OAAO,iBAAiB,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CACnC,CAMC,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,kBAAkB,CAAC,CAAC;CACjD,CAEC,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;IAC3C,yBAAyB,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC;IAC7E,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;CACpC,CAOC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetadataSchema = exports.OmeroSchema = exports.OmeroChannelSchema = exports.OmeroWindowSchema = exports.DatasetSchema = exports.TransformSchema = exports.TranslationSchema = exports.ScaleSchema = exports.IdentitySchema = exports.AxisSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const units_js_1 = require("./units.js");
|
|
6
|
+
exports.AxisSchema = zod_1.z.object({
|
|
7
|
+
name: units_js_1.SupportedDimsSchema,
|
|
8
|
+
type: units_js_1.AxesTypeSchema,
|
|
9
|
+
unit: units_js_1.UnitsSchema.optional(),
|
|
10
|
+
});
|
|
11
|
+
exports.IdentitySchema = zod_1.z.object({
|
|
12
|
+
type: zod_1.z.literal("identity"),
|
|
13
|
+
});
|
|
14
|
+
exports.ScaleSchema = zod_1.z.object({
|
|
15
|
+
scale: zod_1.z.array(zod_1.z.number()),
|
|
16
|
+
type: zod_1.z.literal("scale"),
|
|
17
|
+
});
|
|
18
|
+
exports.TranslationSchema = zod_1.z.object({
|
|
19
|
+
translation: zod_1.z.array(zod_1.z.number()),
|
|
20
|
+
type: zod_1.z.literal("translation"),
|
|
21
|
+
});
|
|
22
|
+
exports.TransformSchema = zod_1.z.union([exports.ScaleSchema, exports.TranslationSchema]);
|
|
23
|
+
exports.DatasetSchema = zod_1.z.object({
|
|
24
|
+
path: zod_1.z.string(),
|
|
25
|
+
coordinateTransformations: zod_1.z.array(exports.TransformSchema),
|
|
26
|
+
});
|
|
27
|
+
exports.OmeroWindowSchema = zod_1.z.object({
|
|
28
|
+
min: zod_1.z.number(),
|
|
29
|
+
max: zod_1.z.number(),
|
|
30
|
+
start: zod_1.z.number(),
|
|
31
|
+
end: zod_1.z.number(),
|
|
32
|
+
});
|
|
33
|
+
exports.OmeroChannelSchema = zod_1.z.object({
|
|
34
|
+
color: zod_1.z.string().regex(/^[0-9A-Fa-f]{6}$/, {
|
|
35
|
+
message: "Color must be 6 hex digits",
|
|
36
|
+
}),
|
|
37
|
+
window: exports.OmeroWindowSchema,
|
|
38
|
+
label: zod_1.z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
exports.OmeroSchema = zod_1.z.object({
|
|
41
|
+
channels: zod_1.z.array(exports.OmeroChannelSchema),
|
|
42
|
+
});
|
|
43
|
+
exports.MetadataSchema = zod_1.z.object({
|
|
44
|
+
axes: zod_1.z.array(exports.AxisSchema),
|
|
45
|
+
datasets: zod_1.z.array(exports.DatasetSchema),
|
|
46
|
+
coordinateTransformations: zod_1.z.array(exports.TransformSchema).optional(),
|
|
47
|
+
omero: exports.OmeroSchema.optional(),
|
|
48
|
+
name: zod_1.z.string().default("image"),
|
|
49
|
+
version: zod_1.z.string().default("0.4"),
|
|
50
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface LazyArrayMetadata {
|
|
2
|
+
shape: number[];
|
|
3
|
+
dtype: string;
|
|
4
|
+
chunks: number[][];
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class LazyArray {
|
|
8
|
+
readonly shape: number[];
|
|
9
|
+
readonly dtype: string;
|
|
10
|
+
readonly chunks: number[][];
|
|
11
|
+
readonly name: string;
|
|
12
|
+
constructor(metadata: LazyArrayMetadata);
|
|
13
|
+
get ndim(): number;
|
|
14
|
+
get size(): number;
|
|
15
|
+
get chunksize(): number[];
|
|
16
|
+
toString(): string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=lazy_array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy_array.d.ts","sourceRoot":"","sources":["../../src/types/lazy_array.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,SAAS;IACpB,SAAgB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChC,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnC,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,QAAQ,EAAE,iBAAiB;IAOvC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,SAAS,IAAI,MAAM,EAAE,CAExB;IAED,QAAQ,IAAI,MAAM;CAUnB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LazyArray = void 0;
|
|
4
|
+
class LazyArray {
|
|
5
|
+
shape;
|
|
6
|
+
dtype;
|
|
7
|
+
chunks;
|
|
8
|
+
name;
|
|
9
|
+
constructor(metadata) {
|
|
10
|
+
this.shape = [...metadata.shape];
|
|
11
|
+
this.dtype = metadata.dtype;
|
|
12
|
+
this.chunks = metadata.chunks.map((chunk) => [...chunk]);
|
|
13
|
+
this.name = metadata.name;
|
|
14
|
+
}
|
|
15
|
+
get ndim() {
|
|
16
|
+
return this.shape.length;
|
|
17
|
+
}
|
|
18
|
+
get size() {
|
|
19
|
+
return this.shape.reduce((acc, dim) => acc * dim, 1);
|
|
20
|
+
}
|
|
21
|
+
get chunksize() {
|
|
22
|
+
return this.chunks[0] || [];
|
|
23
|
+
}
|
|
24
|
+
toString() {
|
|
25
|
+
const chunkStr = this.chunksize.length > 0
|
|
26
|
+
? `chunksize=(${this.chunksize.join(", ")})`
|
|
27
|
+
: "chunksize=()";
|
|
28
|
+
return `LazyArray(name=${this.name}, shape=(${this.shape.join(", ")}), dtype=${this.dtype}, ${chunkStr}, chunktype=TypedArray)`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.LazyArray = LazyArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/types/methods.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;CAC5C;AAED,eAAO,MAAM,aAAa,EAAE,OAAO,EAA2B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.methodsValues = exports.Methods = void 0;
|
|
4
|
+
var Methods;
|
|
5
|
+
(function (Methods) {
|
|
6
|
+
Methods["ITKWASM_GAUSSIAN"] = "itkwasm_gaussian";
|
|
7
|
+
Methods["ITKWASM_BIN_SHRINK"] = "itkwasm_bin_shrink";
|
|
8
|
+
Methods["ITKWASM_LABEL_IMAGE"] = "itkwasm_label_image";
|
|
9
|
+
})(Methods || (exports.Methods = Methods = {}));
|
|
10
|
+
exports.methodsValues = Object.values(Methods);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { NgffImage } from "./ngff_image.js";
|
|
2
|
+
import type { Metadata } from "./zarr_metadata.js";
|
|
3
|
+
import type { Methods } from "./methods.js";
|
|
4
|
+
export type ChunkSpec = number | number[] | number[][] | Record<string, number | number[] | undefined>;
|
|
5
|
+
export interface MultiscalesOptions {
|
|
6
|
+
images: NgffImage[];
|
|
7
|
+
metadata: Metadata;
|
|
8
|
+
scaleFactors: (Record<string, number> | number)[] | undefined;
|
|
9
|
+
method: Methods | undefined;
|
|
10
|
+
chunks: ChunkSpec | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare class Multiscales {
|
|
13
|
+
readonly images: NgffImage[];
|
|
14
|
+
readonly metadata: Metadata;
|
|
15
|
+
readonly scaleFactors: (Record<string, number> | number)[] | undefined;
|
|
16
|
+
readonly method: Methods | undefined;
|
|
17
|
+
readonly chunks: ChunkSpec | undefined;
|
|
18
|
+
constructor(options: MultiscalesOptions);
|
|
19
|
+
toString(): string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=multiscales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiscales.d.ts","sourceRoot":"","sources":["../../src/types/multiscales.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,EAAE,GACR,MAAM,EAAE,EAAE,GACV,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC;IAC9D,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;CAC/B;AAED,qBAAa,WAAW;IACtB,SAAgB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpC,SAAgB,QAAQ,EAAE,QAAQ,CAAC;IACnC,SAAgB,YAAY,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS,CAAC;IAC9E,SAAgB,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5C,SAAgB,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;gBAElC,OAAO,EAAE,kBAAkB;IAUvC,QAAQ,IAAI,MAAM;CAwBnB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Multiscales = void 0;
|
|
4
|
+
class Multiscales {
|
|
5
|
+
images;
|
|
6
|
+
metadata;
|
|
7
|
+
scaleFactors;
|
|
8
|
+
method;
|
|
9
|
+
chunks;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.images = [...options.images];
|
|
12
|
+
this.metadata = { ...options.metadata };
|
|
13
|
+
this.scaleFactors = options.scaleFactors
|
|
14
|
+
? [...options.scaleFactors]
|
|
15
|
+
: undefined;
|
|
16
|
+
this.method = options.method;
|
|
17
|
+
this.chunks = options.chunks;
|
|
18
|
+
}
|
|
19
|
+
toString() {
|
|
20
|
+
const imagesStr = this.images
|
|
21
|
+
.map((img, _i) => ` ${img.toString().replace(/\n/g, "\n ")}`)
|
|
22
|
+
.join(",\n");
|
|
23
|
+
const metadataStr = JSON.stringify(this.metadata, null, 4)
|
|
24
|
+
.split("\n")
|
|
25
|
+
.map((line) => ` ${line}`)
|
|
26
|
+
.join("\n");
|
|
27
|
+
return `Multiscales(
|
|
28
|
+
images=[
|
|
29
|
+
${imagesStr}
|
|
30
|
+
],
|
|
31
|
+
metadata=${metadataStr},
|
|
32
|
+
scale_factors=${JSON.stringify(this.scaleFactors)},
|
|
33
|
+
method=${this.method ? `Methods.${this.method.toUpperCase()}` : "undefined"},
|
|
34
|
+
chunks=${JSON.stringify(this.chunks)}
|
|
35
|
+
)`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Multiscales = Multiscales;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LazyArray } from "./lazy_array.js";
|
|
2
|
+
import type { Units } from "./units.js";
|
|
3
|
+
export type ComputedCallback = () => void;
|
|
4
|
+
export interface NgffImageOptions {
|
|
5
|
+
data: LazyArray;
|
|
6
|
+
dims: string[];
|
|
7
|
+
scale: Record<string, number>;
|
|
8
|
+
translation: Record<string, number>;
|
|
9
|
+
name: string | undefined;
|
|
10
|
+
axesUnits: Record<string, Units> | undefined;
|
|
11
|
+
computedCallbacks: ComputedCallback[] | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare class NgffImage {
|
|
14
|
+
readonly data: LazyArray;
|
|
15
|
+
readonly dims: string[];
|
|
16
|
+
readonly scale: Record<string, number>;
|
|
17
|
+
readonly translation: Record<string, number>;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly axesUnits: Record<string, Units> | undefined;
|
|
20
|
+
readonly computedCallbacks: ComputedCallback[];
|
|
21
|
+
constructor(options: NgffImageOptions);
|
|
22
|
+
toString(): string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=ngff_image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngff_image.d.ts","sourceRoot":"","sources":["../../src/types/ngff_image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC;IAC7C,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAAC;CACnD;AAED,qBAAa,SAAS;IACpB,SAAgB,IAAI,EAAE,SAAS,CAAC;IAChC,SAAgB,IAAI,EAAE,MAAM,EAAE,CAAC;IAC/B,SAAgB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,SAAgB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC;IAC7D,SAAgB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;gBAE1C,OAAO,EAAE,gBAAgB;IAUrC,QAAQ,IAAI,MAAM;CAcnB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NgffImage = void 0;
|
|
4
|
+
class NgffImage {
|
|
5
|
+
data;
|
|
6
|
+
dims;
|
|
7
|
+
scale;
|
|
8
|
+
translation;
|
|
9
|
+
name;
|
|
10
|
+
axesUnits;
|
|
11
|
+
computedCallbacks;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.data = options.data;
|
|
14
|
+
this.dims = [...options.dims];
|
|
15
|
+
this.scale = { ...options.scale };
|
|
16
|
+
this.translation = { ...options.translation };
|
|
17
|
+
this.name = options.name ?? "image";
|
|
18
|
+
this.axesUnits = options.axesUnits ? { ...options.axesUnits } : undefined;
|
|
19
|
+
this.computedCallbacks = [...(options.computedCallbacks ?? [])];
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
const axesUnitsStr = this.axesUnits
|
|
23
|
+
? JSON.stringify(this.axesUnits)
|
|
24
|
+
: "None";
|
|
25
|
+
return `NgffImage(
|
|
26
|
+
data=${this.data.toString()},
|
|
27
|
+
dims=[${this.dims.map((d) => `'${d}'`).join(", ")}],
|
|
28
|
+
scale=${JSON.stringify(this.scale)},
|
|
29
|
+
translation=${JSON.stringify(this.translation)},
|
|
30
|
+
name='${this.name}',
|
|
31
|
+
axes_units=${axesUnitsStr},
|
|
32
|
+
computed_callbacks=[${this.computedCallbacks.length} callbacks]
|
|
33
|
+
)`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.NgffImage = NgffImage;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type SupportedDims = "c" | "x" | "y" | "z" | "t";
|
|
2
|
+
export type SpatialDims = "x" | "y" | "z";
|
|
3
|
+
export type AxesType = "time" | "space" | "channel";
|
|
4
|
+
export type SpaceUnits = "angstrom" | "attometer" | "centimeter" | "decimeter" | "exameter" | "femtometer" | "foot" | "gigameter" | "hectometer" | "inch" | "kilometer" | "megameter" | "meter" | "micrometer" | "mile" | "millimeter" | "nanometer" | "parsec" | "petameter" | "picometer" | "terameter" | "yard" | "yoctometer" | "yottameter" | "zeptometer" | "zettameter";
|
|
5
|
+
export type TimeUnits = "attosecond" | "centisecond" | "day" | "decisecond" | "exasecond" | "femtosecond" | "gigasecond" | "hectosecond" | "hour" | "kilosecond" | "megasecond" | "microsecond" | "millisecond" | "minute" | "nanosecond" | "petasecond" | "picosecond" | "second" | "terasecond" | "yoctosecond" | "yottasecond" | "zeptosecond" | "zettasecond";
|
|
6
|
+
export type Units = SpaceUnits | TimeUnits;
|
|
7
|
+
export declare const supportedDims: SupportedDims[];
|
|
8
|
+
export declare const spaceUnits: SpaceUnits[];
|
|
9
|
+
export declare const timeUnits: TimeUnits[];
|
|
10
|
+
export declare function isDimensionSupported(dim: string): dim is SupportedDims;
|
|
11
|
+
export declare function isUnitSupported(unit: string): unit is Units;
|
|
12
|
+
//# sourceMappingURL=units.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/types/units.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE1C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpD,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,YAAY,GACZ,MAAM,GACN,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,WAAW,GACX,OAAO,GACP,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,WAAW,GACX,WAAW,GACX,WAAW,GACX,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,CAAC;AAEjB,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,aAAa,GACb,KAAK,GACL,YAAY,GACZ,WAAW,GACX,aAAa,GACb,YAAY,GACZ,aAAa,GACb,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,aAAa,GACb,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,YAAY,GACZ,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3C,eAAO,MAAM,aAAa,EAAE,aAAa,EAA8B,CAAC;AAExE,eAAO,MAAM,UAAU,EAAE,UAAU,EA2BlC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAAS,EAwBhC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,aAAa,CAEtE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,KAAK,CAK3D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.timeUnits = exports.spaceUnits = exports.supportedDims = void 0;
|
|
4
|
+
exports.isDimensionSupported = isDimensionSupported;
|
|
5
|
+
exports.isUnitSupported = isUnitSupported;
|
|
6
|
+
exports.supportedDims = ["x", "y", "z", "c", "t"];
|
|
7
|
+
exports.spaceUnits = [
|
|
8
|
+
"angstrom",
|
|
9
|
+
"attometer",
|
|
10
|
+
"centimeter",
|
|
11
|
+
"decimeter",
|
|
12
|
+
"exameter",
|
|
13
|
+
"femtometer",
|
|
14
|
+
"foot",
|
|
15
|
+
"gigameter",
|
|
16
|
+
"hectometer",
|
|
17
|
+
"inch",
|
|
18
|
+
"kilometer",
|
|
19
|
+
"megameter",
|
|
20
|
+
"meter",
|
|
21
|
+
"micrometer",
|
|
22
|
+
"mile",
|
|
23
|
+
"millimeter",
|
|
24
|
+
"nanometer",
|
|
25
|
+
"parsec",
|
|
26
|
+
"petameter",
|
|
27
|
+
"picometer",
|
|
28
|
+
"terameter",
|
|
29
|
+
"yard",
|
|
30
|
+
"yoctometer",
|
|
31
|
+
"yottameter",
|
|
32
|
+
"zeptometer",
|
|
33
|
+
"zettameter",
|
|
34
|
+
];
|
|
35
|
+
exports.timeUnits = [
|
|
36
|
+
"attosecond",
|
|
37
|
+
"centisecond",
|
|
38
|
+
"day",
|
|
39
|
+
"decisecond",
|
|
40
|
+
"exasecond",
|
|
41
|
+
"femtosecond",
|
|
42
|
+
"gigasecond",
|
|
43
|
+
"hectosecond",
|
|
44
|
+
"hour",
|
|
45
|
+
"kilosecond",
|
|
46
|
+
"megasecond",
|
|
47
|
+
"microsecond",
|
|
48
|
+
"millisecond",
|
|
49
|
+
"minute",
|
|
50
|
+
"nanosecond",
|
|
51
|
+
"petasecond",
|
|
52
|
+
"picosecond",
|
|
53
|
+
"second",
|
|
54
|
+
"terasecond",
|
|
55
|
+
"yoctosecond",
|
|
56
|
+
"yottasecond",
|
|
57
|
+
"zeptosecond",
|
|
58
|
+
"zettasecond",
|
|
59
|
+
];
|
|
60
|
+
function isDimensionSupported(dim) {
|
|
61
|
+
return exports.supportedDims.includes(dim);
|
|
62
|
+
}
|
|
63
|
+
function isUnitSupported(unit) {
|
|
64
|
+
return (exports.timeUnits.includes(unit) ||
|
|
65
|
+
exports.spaceUnits.includes(unit));
|
|
66
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { AxesType, SupportedDims, Units } from "./units.js";
|
|
2
|
+
export interface Axis {
|
|
3
|
+
name: SupportedDims;
|
|
4
|
+
type: AxesType;
|
|
5
|
+
unit: Units | undefined;
|
|
6
|
+
}
|
|
7
|
+
export interface Identity {
|
|
8
|
+
type: "identity";
|
|
9
|
+
}
|
|
10
|
+
export interface Scale {
|
|
11
|
+
scale: number[];
|
|
12
|
+
type: "scale";
|
|
13
|
+
}
|
|
14
|
+
export interface Translation {
|
|
15
|
+
translation: number[];
|
|
16
|
+
type: "translation";
|
|
17
|
+
}
|
|
18
|
+
export type Transform = Scale | Translation;
|
|
19
|
+
export interface Dataset {
|
|
20
|
+
path: string;
|
|
21
|
+
coordinateTransformations: Transform[];
|
|
22
|
+
}
|
|
23
|
+
export interface OmeroWindow {
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
26
|
+
start: number;
|
|
27
|
+
end: number;
|
|
28
|
+
}
|
|
29
|
+
export interface OmeroChannel {
|
|
30
|
+
color: string;
|
|
31
|
+
window: OmeroWindow;
|
|
32
|
+
label: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
export interface Omero {
|
|
35
|
+
channels: OmeroChannel[];
|
|
36
|
+
}
|
|
37
|
+
export interface Metadata {
|
|
38
|
+
axes: Axis[];
|
|
39
|
+
datasets: Dataset[];
|
|
40
|
+
coordinateTransformations: Transform[] | undefined;
|
|
41
|
+
omero: Omero | undefined;
|
|
42
|
+
name: string;
|
|
43
|
+
version: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function validateColor(color: string): void;
|
|
46
|
+
export declare function createScale(scale: number[]): Scale;
|
|
47
|
+
export declare function createTranslation(translation: number[]): Translation;
|
|
48
|
+
export declare function createIdentity(): Identity;
|
|
49
|
+
//# sourceMappingURL=zarr_metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zarr_metadata.d.ts","sourceRoot":"","sources":["../../src/types/zarr_metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,WAAW,CAAC;AAE5C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB,EAAE,SAAS,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,yBAAyB,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC;IACnD,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAMjD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAElD;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,WAAW,CAEpE;AAED,wBAAgB,cAAc,IAAI,QAAQ,CAEzC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateColor = validateColor;
|
|
4
|
+
exports.createScale = createScale;
|
|
5
|
+
exports.createTranslation = createTranslation;
|
|
6
|
+
exports.createIdentity = createIdentity;
|
|
7
|
+
function validateColor(color) {
|
|
8
|
+
if (!/^[0-9A-Fa-f]{6}$/.test(color)) {
|
|
9
|
+
throw new Error(`Invalid color '${color}'. Must be 6 hex digits.`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function createScale(scale) {
|
|
13
|
+
return { scale: [...scale], type: "scale" };
|
|
14
|
+
}
|
|
15
|
+
function createTranslation(translation) {
|
|
16
|
+
return { translation: [...translation], type: "translation" };
|
|
17
|
+
}
|
|
18
|
+
function createIdentity() {
|
|
19
|
+
return { type: "identity" };
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NgffImage } from "../types/ngff_image.js";
|
|
2
|
+
import { Multiscales } from "../types/multiscales.js";
|
|
3
|
+
import type { Axis, Dataset, Metadata, Scale, Translation } from "../types/zarr_metadata.js";
|
|
4
|
+
import type { AxesType, SupportedDims, Units } from "../types/units.js";
|
|
5
|
+
import type { Methods } from "../types/methods.js";
|
|
6
|
+
export declare function createNgffImage(_data: ArrayBuffer | number[], shape: number[], dtype: string, dims: string[], scale: Record<string, number>, translation: Record<string, number>, name?: string): NgffImage;
|
|
7
|
+
export declare function createAxis(name: SupportedDims, type: AxesType, unit?: Units): Axis;
|
|
8
|
+
export declare function createScale(scale: number[]): Scale;
|
|
9
|
+
export declare function createTranslation(translation: number[]): Translation;
|
|
10
|
+
export declare function createDataset(path: string, scale: number[], translation: number[]): Dataset;
|
|
11
|
+
export declare function createMetadata(axes: Axis[], datasets: Dataset[], name?: string, version?: string): Metadata;
|
|
12
|
+
export declare function createMultiscales(images: NgffImage[], metadata: Metadata, scaleFactors?: (Record<string, number> | number)[], method?: Methods): Multiscales;
|
|
13
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/utils/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EACV,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,KAAK,EACL,WAAW,EACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE,EAC7B,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,IAAI,SAAU,GACb,SAAS,CAiBX;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,QAAQ,EACd,IAAI,CAAC,EAAE,KAAK,GACX,IAAI,CAMN;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAKlD;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,WAAW,CAKpE;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAQT;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EAAE,EACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,IAAI,SAAU,EACd,OAAO,SAAQ,GACd,QAAQ,CASV;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EAAE,EACnB,QAAQ,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EAClD,MAAM,CAAC,EAAE,OAAO,GACf,WAAW,CAQb"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNgffImage = createNgffImage;
|
|
4
|
+
exports.createAxis = createAxis;
|
|
5
|
+
exports.createScale = createScale;
|
|
6
|
+
exports.createTranslation = createTranslation;
|
|
7
|
+
exports.createDataset = createDataset;
|
|
8
|
+
exports.createMetadata = createMetadata;
|
|
9
|
+
exports.createMultiscales = createMultiscales;
|
|
10
|
+
const lazy_array_js_1 = require("../types/lazy_array.js");
|
|
11
|
+
const ngff_image_js_1 = require("../types/ngff_image.js");
|
|
12
|
+
const multiscales_js_1 = require("../types/multiscales.js");
|
|
13
|
+
function createNgffImage(_data, shape, dtype, dims, scale, translation, name = "image") {
|
|
14
|
+
const lazyArray = new lazy_array_js_1.LazyArray({
|
|
15
|
+
shape,
|
|
16
|
+
dtype,
|
|
17
|
+
chunks: [shape],
|
|
18
|
+
name,
|
|
19
|
+
});
|
|
20
|
+
return new ngff_image_js_1.NgffImage({
|
|
21
|
+
data: lazyArray,
|
|
22
|
+
dims,
|
|
23
|
+
scale,
|
|
24
|
+
translation,
|
|
25
|
+
name,
|
|
26
|
+
axesUnits: undefined,
|
|
27
|
+
computedCallbacks: undefined,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function createAxis(name, type, unit) {
|
|
31
|
+
return {
|
|
32
|
+
name,
|
|
33
|
+
type,
|
|
34
|
+
unit: unit || undefined,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function createScale(scale) {
|
|
38
|
+
return {
|
|
39
|
+
scale: [...scale],
|
|
40
|
+
type: "scale",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function createTranslation(translation) {
|
|
44
|
+
return {
|
|
45
|
+
translation: [...translation],
|
|
46
|
+
type: "translation",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function createDataset(path, scale, translation) {
|
|
50
|
+
return {
|
|
51
|
+
path,
|
|
52
|
+
coordinateTransformations: [
|
|
53
|
+
createScale(scale),
|
|
54
|
+
createTranslation(translation),
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function createMetadata(axes, datasets, name = "image", version = "0.4") {
|
|
59
|
+
return {
|
|
60
|
+
axes: [...axes],
|
|
61
|
+
datasets: [...datasets],
|
|
62
|
+
coordinateTransformations: undefined,
|
|
63
|
+
omero: undefined,
|
|
64
|
+
name,
|
|
65
|
+
version,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createMultiscales(images, metadata, scaleFactors, method) {
|
|
69
|
+
return new multiscales_js_1.Multiscales({
|
|
70
|
+
images: [...images],
|
|
71
|
+
metadata,
|
|
72
|
+
scaleFactors: scaleFactors || undefined,
|
|
73
|
+
method: method || undefined,
|
|
74
|
+
chunks: undefined,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Metadata } from "../types/zarr_metadata.js";
|
|
2
|
+
export declare function validateMetadata(metadata: unknown): Metadata;
|
|
3
|
+
export declare function validateColor(color: string): void;
|
|
4
|
+
export declare function isValidDimension(dim: string): boolean;
|
|
5
|
+
export declare function isValidUnit(unit: string): boolean;
|
|
6
|
+
//# sourceMappingURL=validation.d.ts.map
|