@fideus-labs/ngff-zarr 0.1.0 → 0.2.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/README.md +1 -0
- package/esm/io/itk_image_to_ngff_image.d.ts +5 -0
- package/esm/io/itk_image_to_ngff_image.d.ts.map +1 -1
- package/esm/io/itk_image_to_ngff_image.js +20 -20
- package/esm/io/ngff_image_to_itk_image.d.ts.map +1 -1
- package/esm/io/ngff_image_to_itk_image.js +2 -0
- package/esm/io/to_multiscales.js +1 -1
- package/esm/io/to_ngff_zarr.js +16 -0
- package/esm/methods/itkwasm.d.ts.map +1 -1
- package/esm/methods/itkwasm.js +568 -426
- package/esm/schemas/coordinate_systems.d.ts +159 -552
- package/esm/schemas/coordinate_systems.d.ts.map +1 -1
- package/esm/schemas/coordinate_systems.js +0 -1
- package/esm/schemas/ome_zarr.d.ts +105 -69
- package/esm/schemas/ome_zarr.d.ts.map +1 -1
- package/esm/schemas/rfc4.d.ts +26 -131
- package/esm/schemas/rfc4.d.ts.map +1 -1
- package/esm/schemas/units.d.ts +70 -5
- package/esm/schemas/units.d.ts.map +1 -1
- package/esm/schemas/units.js +2 -15
- package/esm/schemas/zarr_metadata.d.ts +13 -300
- package/esm/schemas/zarr_metadata.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/io/itk_image_to_ngff_image.d.ts +5 -0
- package/script/io/itk_image_to_ngff_image.d.ts.map +1 -1
- package/script/io/itk_image_to_ngff_image.js +20 -20
- package/script/io/ngff_image_to_itk_image.d.ts.map +1 -1
- package/script/io/ngff_image_to_itk_image.js +2 -0
- package/script/io/to_multiscales.js +1 -1
- package/script/io/to_ngff_zarr.js +16 -0
- package/script/methods/itkwasm.d.ts.map +1 -1
- package/script/methods/itkwasm.js +567 -425
- package/script/schemas/coordinate_systems.d.ts +159 -552
- package/script/schemas/coordinate_systems.d.ts.map +1 -1
- package/script/schemas/coordinate_systems.js +0 -1
- package/script/schemas/ome_zarr.d.ts +105 -69
- package/script/schemas/ome_zarr.d.ts.map +1 -1
- package/script/schemas/rfc4.d.ts +26 -131
- package/script/schemas/rfc4.d.ts.map +1 -1
- package/script/schemas/units.d.ts +70 -5
- package/script/schemas/units.d.ts.map +1 -1
- package/script/schemas/units.js +2 -15
- package/script/schemas/zarr_metadata.d.ts +13 -300
- package/script/schemas/zarr_metadata.d.ts.map +1 -1
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { AxesTypeSchema, SupportedDimsSchema, UnitsSchema } from "./units.js";
|
|
3
|
+
import { AnatomicalOrientationSchema } from "./rfc4.js";
|
|
2
4
|
export declare const AxisSchema: z.ZodObject<{
|
|
3
|
-
name:
|
|
4
|
-
type:
|
|
5
|
-
unit: z.ZodOptional<
|
|
6
|
-
orientation: z.ZodOptional<
|
|
7
|
-
|
|
8
|
-
value: z.ZodEnum<{
|
|
9
|
-
"left-to-right": "left-to-right";
|
|
10
|
-
"right-to-left": "right-to-left";
|
|
11
|
-
"anterior-to-posterior": "anterior-to-posterior";
|
|
12
|
-
"posterior-to-anterior": "posterior-to-anterior";
|
|
13
|
-
"inferior-to-superior": "inferior-to-superior";
|
|
14
|
-
"superior-to-inferior": "superior-to-inferior";
|
|
15
|
-
"dorsal-to-ventral": "dorsal-to-ventral";
|
|
16
|
-
"ventral-to-dorsal": "ventral-to-dorsal";
|
|
17
|
-
"dorsal-to-palmar": "dorsal-to-palmar";
|
|
18
|
-
"palmar-to-dorsal": "palmar-to-dorsal";
|
|
19
|
-
"dorsal-to-plantar": "dorsal-to-plantar";
|
|
20
|
-
"plantar-to-dorsal": "plantar-to-dorsal";
|
|
21
|
-
"rostral-to-caudal": "rostral-to-caudal";
|
|
22
|
-
"caudal-to-rostral": "caudal-to-rostral";
|
|
23
|
-
"cranial-to-caudal": "cranial-to-caudal";
|
|
24
|
-
"caudal-to-cranial": "caudal-to-cranial";
|
|
25
|
-
"proximal-to-distal": "proximal-to-distal";
|
|
26
|
-
"distal-to-proximal": "distal-to-proximal";
|
|
27
|
-
}>;
|
|
28
|
-
}, z.core.$strip>>;
|
|
29
|
-
}, z.core.$strip>;
|
|
5
|
+
name: typeof SupportedDimsSchema;
|
|
6
|
+
type: typeof AxesTypeSchema;
|
|
7
|
+
unit: z.ZodOptional<typeof UnitsSchema>;
|
|
8
|
+
orientation: z.ZodOptional<typeof AnatomicalOrientationSchema>;
|
|
9
|
+
}>;
|
|
30
10
|
export declare const IdentitySchema: z.ZodObject<{
|
|
31
11
|
type: z.ZodLiteral<"identity">;
|
|
32
12
|
}>;
|
|
@@ -38,274 +18,7 @@ export declare const TranslationSchema: z.ZodObject<{
|
|
|
38
18
|
translation: z.ZodArray<z.ZodNumber>;
|
|
39
19
|
type: z.ZodLiteral<"translation">;
|
|
40
20
|
}>;
|
|
41
|
-
export declare const TransformSchema: z.
|
|
42
|
-
scale: z.ZodArray<z.ZodNumber>;
|
|
43
|
-
type: z.ZodLiteral<"scale">;
|
|
44
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
-
translation: z.ZodArray<z.ZodNumber>;
|
|
46
|
-
type: z.ZodLiteral<"translation">;
|
|
47
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
-
type: z.ZodLiteral<"identity">;
|
|
49
|
-
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
50
|
-
type: z.ZodLiteral<"identity">;
|
|
51
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
52
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
53
|
-
name: z.ZodOptional<z.ZodString>;
|
|
54
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
-
type: z.ZodLiteral<"mapAxis">;
|
|
56
|
-
mapAxis: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
57
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
58
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
59
|
-
name: z.ZodOptional<z.ZodString>;
|
|
60
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
-
type: z.ZodLiteral<"translation">;
|
|
62
|
-
translation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
63
|
-
path: z.ZodOptional<z.ZodString>;
|
|
64
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
65
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
66
|
-
name: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
-
type: z.ZodLiteral<"scale">;
|
|
69
|
-
scale: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
70
|
-
path: z.ZodOptional<z.ZodString>;
|
|
71
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
72
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
73
|
-
name: z.ZodOptional<z.ZodString>;
|
|
74
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
-
type: z.ZodLiteral<"affine">;
|
|
76
|
-
affine: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
77
|
-
path: z.ZodOptional<z.ZodString>;
|
|
78
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
79
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
80
|
-
name: z.ZodOptional<z.ZodString>;
|
|
81
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
-
type: z.ZodLiteral<"rotation">;
|
|
83
|
-
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
84
|
-
path: z.ZodOptional<z.ZodString>;
|
|
85
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
86
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
87
|
-
name: z.ZodOptional<z.ZodString>;
|
|
88
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
89
|
-
type: z.ZodLiteral<"sequence">;
|
|
90
|
-
transformations: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
91
|
-
type: z.ZodLiteral<"identity">;
|
|
92
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
93
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
94
|
-
name: z.ZodOptional<z.ZodString>;
|
|
95
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
-
type: z.ZodLiteral<"mapAxis">;
|
|
97
|
-
mapAxis: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
98
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
99
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
100
|
-
name: z.ZodOptional<z.ZodString>;
|
|
101
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
-
type: z.ZodLiteral<"translation">;
|
|
103
|
-
translation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
104
|
-
path: z.ZodOptional<z.ZodString>;
|
|
105
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
106
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
107
|
-
name: z.ZodOptional<z.ZodString>;
|
|
108
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
-
type: z.ZodLiteral<"scale">;
|
|
110
|
-
scale: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
111
|
-
path: z.ZodOptional<z.ZodString>;
|
|
112
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
113
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
114
|
-
name: z.ZodOptional<z.ZodString>;
|
|
115
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
116
|
-
type: z.ZodLiteral<"affine">;
|
|
117
|
-
affine: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
118
|
-
path: z.ZodOptional<z.ZodString>;
|
|
119
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
120
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
121
|
-
name: z.ZodOptional<z.ZodString>;
|
|
122
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
-
type: z.ZodLiteral<"rotation">;
|
|
124
|
-
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
125
|
-
path: z.ZodOptional<z.ZodString>;
|
|
126
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
127
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
128
|
-
name: z.ZodOptional<z.ZodString>;
|
|
129
|
-
}, z.core.$strip>]>>;
|
|
130
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
131
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
132
|
-
name: z.ZodOptional<z.ZodString>;
|
|
133
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
-
type: z.ZodLiteral<"inverseOf">;
|
|
135
|
-
transformation: z.ZodUnion<readonly [z.ZodObject<{
|
|
136
|
-
type: z.ZodLiteral<"identity">;
|
|
137
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
138
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
139
|
-
name: z.ZodOptional<z.ZodString>;
|
|
140
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
141
|
-
type: z.ZodLiteral<"mapAxis">;
|
|
142
|
-
mapAxis: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
143
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
144
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
145
|
-
name: z.ZodOptional<z.ZodString>;
|
|
146
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
147
|
-
type: z.ZodLiteral<"translation">;
|
|
148
|
-
translation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
149
|
-
path: z.ZodOptional<z.ZodString>;
|
|
150
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
151
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
152
|
-
name: z.ZodOptional<z.ZodString>;
|
|
153
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
154
|
-
type: z.ZodLiteral<"scale">;
|
|
155
|
-
scale: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
156
|
-
path: z.ZodOptional<z.ZodString>;
|
|
157
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
158
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
159
|
-
name: z.ZodOptional<z.ZodString>;
|
|
160
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
-
type: z.ZodLiteral<"affine">;
|
|
162
|
-
affine: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
163
|
-
path: z.ZodOptional<z.ZodString>;
|
|
164
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
165
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
166
|
-
name: z.ZodOptional<z.ZodString>;
|
|
167
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
168
|
-
type: z.ZodLiteral<"rotation">;
|
|
169
|
-
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
170
|
-
path: z.ZodOptional<z.ZodString>;
|
|
171
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
172
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
173
|
-
name: z.ZodOptional<z.ZodString>;
|
|
174
|
-
}, z.core.$strip>]>;
|
|
175
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
176
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
177
|
-
name: z.ZodOptional<z.ZodString>;
|
|
178
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
179
|
-
type: z.ZodLiteral<"bijection">;
|
|
180
|
-
forward: z.ZodUnion<readonly [z.ZodObject<{
|
|
181
|
-
type: z.ZodLiteral<"identity">;
|
|
182
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
183
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
184
|
-
name: z.ZodOptional<z.ZodString>;
|
|
185
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
186
|
-
type: z.ZodLiteral<"mapAxis">;
|
|
187
|
-
mapAxis: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
188
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
189
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
190
|
-
name: z.ZodOptional<z.ZodString>;
|
|
191
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
192
|
-
type: z.ZodLiteral<"translation">;
|
|
193
|
-
translation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
194
|
-
path: z.ZodOptional<z.ZodString>;
|
|
195
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
196
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
197
|
-
name: z.ZodOptional<z.ZodString>;
|
|
198
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
199
|
-
type: z.ZodLiteral<"scale">;
|
|
200
|
-
scale: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
201
|
-
path: z.ZodOptional<z.ZodString>;
|
|
202
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
203
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
204
|
-
name: z.ZodOptional<z.ZodString>;
|
|
205
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
206
|
-
type: z.ZodLiteral<"affine">;
|
|
207
|
-
affine: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
208
|
-
path: z.ZodOptional<z.ZodString>;
|
|
209
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
210
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
211
|
-
name: z.ZodOptional<z.ZodString>;
|
|
212
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
213
|
-
type: z.ZodLiteral<"rotation">;
|
|
214
|
-
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
215
|
-
path: z.ZodOptional<z.ZodString>;
|
|
216
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
217
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
218
|
-
name: z.ZodOptional<z.ZodString>;
|
|
219
|
-
}, z.core.$strip>]>;
|
|
220
|
-
inverse: z.ZodUnion<readonly [z.ZodObject<{
|
|
221
|
-
type: z.ZodLiteral<"identity">;
|
|
222
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
223
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
224
|
-
name: z.ZodOptional<z.ZodString>;
|
|
225
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
-
type: z.ZodLiteral<"mapAxis">;
|
|
227
|
-
mapAxis: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
228
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
229
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
230
|
-
name: z.ZodOptional<z.ZodString>;
|
|
231
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
232
|
-
type: z.ZodLiteral<"translation">;
|
|
233
|
-
translation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
234
|
-
path: z.ZodOptional<z.ZodString>;
|
|
235
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
236
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
237
|
-
name: z.ZodOptional<z.ZodString>;
|
|
238
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
-
type: z.ZodLiteral<"scale">;
|
|
240
|
-
scale: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
241
|
-
path: z.ZodOptional<z.ZodString>;
|
|
242
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
243
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
244
|
-
name: z.ZodOptional<z.ZodString>;
|
|
245
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
246
|
-
type: z.ZodLiteral<"affine">;
|
|
247
|
-
affine: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
248
|
-
path: z.ZodOptional<z.ZodString>;
|
|
249
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
250
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
251
|
-
name: z.ZodOptional<z.ZodString>;
|
|
252
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
253
|
-
type: z.ZodLiteral<"rotation">;
|
|
254
|
-
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
255
|
-
path: z.ZodOptional<z.ZodString>;
|
|
256
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
257
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
258
|
-
name: z.ZodOptional<z.ZodString>;
|
|
259
|
-
}, z.core.$strip>]>;
|
|
260
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
261
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
262
|
-
name: z.ZodOptional<z.ZodString>;
|
|
263
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
264
|
-
type: z.ZodLiteral<"byDimension">;
|
|
265
|
-
transformations: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
266
|
-
type: z.ZodLiteral<"identity">;
|
|
267
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
268
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
269
|
-
name: z.ZodOptional<z.ZodString>;
|
|
270
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
271
|
-
type: z.ZodLiteral<"mapAxis">;
|
|
272
|
-
mapAxis: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
273
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
274
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
275
|
-
name: z.ZodOptional<z.ZodString>;
|
|
276
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
-
type: z.ZodLiteral<"translation">;
|
|
278
|
-
translation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
279
|
-
path: z.ZodOptional<z.ZodString>;
|
|
280
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
281
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
282
|
-
name: z.ZodOptional<z.ZodString>;
|
|
283
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
284
|
-
type: z.ZodLiteral<"scale">;
|
|
285
|
-
scale: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
286
|
-
path: z.ZodOptional<z.ZodString>;
|
|
287
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
288
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
289
|
-
name: z.ZodOptional<z.ZodString>;
|
|
290
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
291
|
-
type: z.ZodLiteral<"affine">;
|
|
292
|
-
affine: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodNumber>>>;
|
|
293
|
-
path: z.ZodOptional<z.ZodString>;
|
|
294
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
295
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
296
|
-
name: z.ZodOptional<z.ZodString>;
|
|
297
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
298
|
-
type: z.ZodLiteral<"rotation">;
|
|
299
|
-
rotation: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
300
|
-
path: z.ZodOptional<z.ZodString>;
|
|
301
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
302
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
303
|
-
name: z.ZodOptional<z.ZodString>;
|
|
304
|
-
}, z.core.$strip>]>>;
|
|
305
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
306
|
-
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
307
|
-
name: z.ZodOptional<z.ZodString>;
|
|
308
|
-
}, z.core.$strip>]>]>;
|
|
21
|
+
export declare const TransformSchema: z.ZodType<unknown>;
|
|
309
22
|
export declare const DatasetSchema: z.ZodObject<{
|
|
310
23
|
path: z.ZodString;
|
|
311
24
|
coordinateTransformations: z.ZodArray<typeof TransformSchema>;
|
|
@@ -324,11 +37,11 @@ export declare const OmeroChannelSchema: z.ZodObject<{
|
|
|
324
37
|
export declare const OmeroSchema: z.ZodObject<{
|
|
325
38
|
channels: z.ZodArray<typeof OmeroChannelSchema>;
|
|
326
39
|
}>;
|
|
327
|
-
export declare const MethodMetadataSchema: z.
|
|
328
|
-
description:
|
|
329
|
-
method:
|
|
330
|
-
version:
|
|
331
|
-
}
|
|
40
|
+
export declare const MethodMetadataSchema: z.ZodType<{
|
|
41
|
+
description: string;
|
|
42
|
+
method: string;
|
|
43
|
+
version: string;
|
|
44
|
+
}>;
|
|
332
45
|
export declare const MetadataSchema: z.ZodObject<{
|
|
333
46
|
axes: z.ZodArray<typeof AxisSchema>;
|
|
334
47
|
datasets: z.ZodArray<typeof DatasetSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zarr_metadata.d.ts","sourceRoot":"","sources":["../../src/schemas/zarr_metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"zarr_metadata.d.ts","sourceRoot":"","sources":["../../src/schemas/zarr_metadata.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -9,6 +9,11 @@ export interface ItkImageToNgffImageOptions {
|
|
|
9
9
|
* @default true
|
|
10
10
|
*/
|
|
11
11
|
addAnatomicalOrientation?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Path prefix for the zarr array (e.g., "scale0/", "scale1/")
|
|
14
|
+
* @default "image"
|
|
15
|
+
*/
|
|
16
|
+
path?: string;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* Convert an ITK-Wasm Image to an NgffImage, preserving spatial metadata.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itk_image_to_ngff_image.d.ts","sourceRoot":"","sources":["../../src/io/itk_image_to_ngff_image.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAOnD,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"itk_image_to_ngff_image.d.ts","sourceRoot":"","sources":["../../src/io/itk_image_to_ngff_image.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAOnD,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,KAAK,EACf,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,SAAS,CAAC,CAmHpB"}
|
|
@@ -46,10 +46,12 @@ const zarrita_1 = require("zarrita");
|
|
|
46
46
|
* @returns Promise resolving to NgffImage
|
|
47
47
|
*/
|
|
48
48
|
async function itkImageToNgffImage(itkImage, options = {}) {
|
|
49
|
-
const { addAnatomicalOrientation = true } = options;
|
|
49
|
+
const { addAnatomicalOrientation = true, path = "image" } = options;
|
|
50
50
|
// Extract image properties from ITK-Wasm Image
|
|
51
51
|
const _data = itkImage.data;
|
|
52
|
-
|
|
52
|
+
// ITK stores size in physical space order [x, y, z], but the data buffer is in
|
|
53
|
+
// C-order (row-major) which means [z, y, x] indexing. Reverse to match data layout.
|
|
54
|
+
const shape = [...itkImage.size].reverse();
|
|
53
55
|
const spacing = itkImage.spacing;
|
|
54
56
|
const origin = itkImage.origin;
|
|
55
57
|
const ndim = shape.length;
|
|
@@ -86,32 +88,27 @@ async function itkImageToNgffImage(itkImage, options = {}) {
|
|
|
86
88
|
// Identify spatial dimensions
|
|
87
89
|
const allSpatialDims = new Set(["x", "y", "z"]);
|
|
88
90
|
const spatialDims = dims.filter((dim) => allSpatialDims.has(dim));
|
|
89
|
-
// Create scale mapping from spacing
|
|
91
|
+
// Create scale mapping from spacing
|
|
92
|
+
// ITK stores spacing/origin in physical space order (x, y, z),
|
|
93
|
+
// but we need to map them to array order (z, y, x).
|
|
94
|
+
// Reverse the arrays to convert from physical to array order, matching Python implementation.
|
|
90
95
|
const scale = {};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const spatialIndex = itkSpatialOrder.indexOf(dim);
|
|
95
|
-
if (spatialIndex === -1) {
|
|
96
|
-
throw new Error(`Unknown spatial dimension: ${dim}`);
|
|
97
|
-
}
|
|
98
|
-
scale[dim] = spacing[spatialIndex];
|
|
96
|
+
const reversedSpacing = spacing.slice().reverse();
|
|
97
|
+
spatialDims.forEach((dim, idx) => {
|
|
98
|
+
scale[dim] = reversedSpacing[idx];
|
|
99
99
|
});
|
|
100
|
-
// Create translation mapping from origin
|
|
100
|
+
// Create translation mapping from origin
|
|
101
101
|
const translation = {};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
throw new Error(`Unknown spatial dimension: ${dim}`);
|
|
106
|
-
}
|
|
107
|
-
translation[dim] = origin[spatialIndex];
|
|
102
|
+
const reversedOrigin = origin.slice().reverse();
|
|
103
|
+
spatialDims.forEach((dim, idx) => {
|
|
104
|
+
translation[dim] = reversedOrigin[idx];
|
|
108
105
|
});
|
|
109
106
|
// Create Zarr array from ITK-Wasm data
|
|
110
107
|
const store = new Map();
|
|
111
108
|
const root = zarr.root(store);
|
|
112
109
|
// Determine appropriate chunk size
|
|
113
110
|
const chunkShape = shape.map((s) => Math.min(s, 256));
|
|
114
|
-
const zarrArray = await zarr.create(root.resolve(
|
|
111
|
+
const zarrArray = await zarr.create(root.resolve(path), {
|
|
115
112
|
shape: shape,
|
|
116
113
|
chunk_shape: chunkShape,
|
|
117
114
|
data_type: imageType.componentType,
|
|
@@ -122,10 +119,13 @@ async function itkImageToNgffImage(itkImage, options = {}) {
|
|
|
122
119
|
// Create a selection that covers the entire array (null means "all" for each dimension)
|
|
123
120
|
const selection = new Array(ndim).fill(null);
|
|
124
121
|
// Create a chunk object with the ITK-Wasm data in zarrita format
|
|
122
|
+
// ITK-Wasm stores data in column-major order with size [x, y, z],
|
|
123
|
+
// which has the same memory layout as C-order (row-major) with shape [z, y, x].
|
|
124
|
+
// We reversed the shape above, and now use C-order strides for that reversed shape.
|
|
125
125
|
const dataChunk = {
|
|
126
126
|
data: itkImage.data,
|
|
127
127
|
shape: shape,
|
|
128
|
-
stride: (0, zarrita_1._zarrita_internal_get_strides)(shape, "C"), // C-order
|
|
128
|
+
stride: (0, zarrita_1._zarrita_internal_get_strides)(shape, "C"), // C-order strides for the reversed shape
|
|
129
129
|
};
|
|
130
130
|
// Write all data to the zarr array using zarrita's set function
|
|
131
131
|
// This handles chunking and encoding automatically
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngff_image_to_itk_image.d.ts","sourceRoot":"","sources":["../../src/io/ngff_image_to_itk_image.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAEV,KAAK,EAKN,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAsED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"ngff_image_to_itk_image.d.ts","sourceRoot":"","sources":["../../src/io/ngff_image_to_itk_image.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAEV,KAAK,EAKN,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAsED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,KAAK,CAAC,CAmMhB"}
|
|
@@ -194,6 +194,8 @@ async function ngffImageToItkImage(ngffImage, options = {}) {
|
|
|
194
194
|
return order.indexOf(a) - order.indexOf(b);
|
|
195
195
|
});
|
|
196
196
|
// Create ITK spacing, origin, and size arrays
|
|
197
|
+
// sortedItkDims is already in physical space order [x, y, z]
|
|
198
|
+
// Mapping from dims extracts the correct values from NGFF's array order [z, y, x]
|
|
197
199
|
const spacing = sortedItkDims.map((dim) => workingImage.scale[dim] || 1.0);
|
|
198
200
|
const origin = sortedItkDims.map((dim) => workingImage.translation[dim] || 0.0);
|
|
199
201
|
const size = sortedItkDims.map((dim) => data.shape[dims.indexOf(dim)]);
|
|
@@ -52,7 +52,7 @@ async function toMultiscales(image, options = {}) {
|
|
|
52
52
|
});
|
|
53
53
|
// Create datasets for all images
|
|
54
54
|
const datasets = images.map((img, index) => {
|
|
55
|
-
return (0, factory_js_1.createDataset)(
|
|
55
|
+
return (0, factory_js_1.createDataset)(`scale${index}`, img.dims.map((dim) => img.scale[dim]), img.dims.map((dim) => img.translation[dim]));
|
|
56
56
|
});
|
|
57
57
|
// Create metadata with method information
|
|
58
58
|
const methodMetadata = (0, method_metadata_js_1.getMethodMetadata)(method);
|
|
@@ -220,6 +220,22 @@ async function writeChunkWithGet(zarrArray, image, chunkIndex) {
|
|
|
220
220
|
// Convert chunk data to target type
|
|
221
221
|
const targetTypedArrayConstructor = getTypedArrayConstructor(zarrArray.dtype);
|
|
222
222
|
const chunkTargetData = convertChunkToTargetType(chunkSourceData, zarrArray.dtype, targetTypedArrayConstructor);
|
|
223
|
+
// Validate chunk data size
|
|
224
|
+
const expectedSize = chunkShape.reduce((a, b) => a * b, 1);
|
|
225
|
+
const actualSize = chunkTargetData.byteLength /
|
|
226
|
+
(chunkTargetData
|
|
227
|
+
.BYTES_PER_ELEMENT || 1);
|
|
228
|
+
if (actualSize !== expectedSize) {
|
|
229
|
+
console.error(`[writeChunkWithGet] Chunk data size mismatch!`);
|
|
230
|
+
console.error(` Image shape:`, shape);
|
|
231
|
+
console.error(` Chunk index:`, chunkIndex);
|
|
232
|
+
console.error(` Chunk start:`, chunkStart);
|
|
233
|
+
console.error(` Chunk end:`, chunkEnd);
|
|
234
|
+
console.error(` Chunk shape:`, chunkShape);
|
|
235
|
+
console.error(` Expected size:`, expectedSize);
|
|
236
|
+
console.error(` Actual size:`, actualSize);
|
|
237
|
+
throw new Error(`Chunk data size mismatch: expected ${expectedSize} elements, got ${actualSize}`);
|
|
238
|
+
}
|
|
223
239
|
// Create the selection for writing to the target zarr array
|
|
224
240
|
const targetSelection = chunkStart.map((start, dim) => zarr.slice(start, chunkEnd[dim]));
|
|
225
241
|
// Write the chunk using zarrita's set function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itkwasm.d.ts","sourceRoot":"","sources":["../../src/methods/itkwasm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"itkwasm.d.ts","sourceRoot":"","sources":["../../src/methods/itkwasm.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAknCnD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EACjD,SAAS,EAAE,UAAU,GAAG,YAAY,GAAG,aAAa,GACnD,OAAO,CAAC,SAAS,EAAE,CAAC,CA8HtB"}
|