@fideus-labs/ngff-zarr 0.0.1 → 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.
Files changed (176) hide show
  1. package/README.md +10 -2
  2. package/esm/io/from_ngff_zarr.d.ts +4 -1
  3. package/esm/io/from_ngff_zarr.d.ts.map +1 -1
  4. package/esm/io/from_ngff_zarr.js +94 -27
  5. package/esm/io/hcs.d.ts +18 -0
  6. package/esm/io/hcs.d.ts.map +1 -0
  7. package/esm/io/hcs.js +51 -0
  8. package/esm/io/itk_image_to_ngff_image.d.ts +30 -0
  9. package/esm/io/itk_image_to_ngff_image.d.ts.map +1 -0
  10. package/esm/io/itk_image_to_ngff_image.js +127 -0
  11. package/esm/io/ngff_image_to_itk_image.d.ts +30 -0
  12. package/esm/io/ngff_image_to_itk_image.d.ts.map +1 -0
  13. package/esm/io/ngff_image_to_itk_image.js +218 -0
  14. package/esm/io/to_multiscales.d.ts +18 -0
  15. package/esm/io/to_multiscales.d.ts.map +1 -0
  16. package/esm/io/to_multiscales.js +62 -0
  17. package/esm/io/to_ngff_image.d.ts +17 -0
  18. package/esm/io/to_ngff_image.d.ts.map +1 -0
  19. package/esm/io/to_ngff_image.js +136 -0
  20. package/esm/io/to_ngff_zarr.d.ts +3 -2
  21. package/esm/io/to_ngff_zarr.d.ts.map +1 -1
  22. package/esm/io/to_ngff_zarr.js +289 -26
  23. package/esm/methods/itkwasm.d.ts +6 -0
  24. package/esm/methods/itkwasm.d.ts.map +1 -0
  25. package/esm/methods/itkwasm.js +958 -0
  26. package/esm/mod.d.ts +9 -2
  27. package/esm/mod.d.ts.map +1 -1
  28. package/esm/mod.js +10 -2
  29. package/esm/schemas/coordinate_systems.d.ts +251 -0
  30. package/esm/schemas/coordinate_systems.d.ts.map +1 -0
  31. package/esm/schemas/coordinate_systems.js +139 -0
  32. package/esm/schemas/index.d.ts +9 -0
  33. package/esm/schemas/index.d.ts.map +1 -0
  34. package/esm/schemas/index.js +38 -0
  35. package/esm/schemas/methods.d.ts.map +1 -1
  36. package/esm/schemas/methods.js +2 -0
  37. package/esm/schemas/multiscales.d.ts.map +1 -1
  38. package/esm/schemas/multiscales.js +2 -0
  39. package/esm/schemas/ngff_image.d.ts +9 -2
  40. package/esm/schemas/ngff_image.d.ts.map +1 -1
  41. package/esm/schemas/ngff_image.js +11 -2
  42. package/esm/schemas/ome_zarr.d.ts +617 -0
  43. package/esm/schemas/ome_zarr.d.ts.map +1 -0
  44. package/esm/schemas/ome_zarr.js +208 -0
  45. package/esm/schemas/rfc4.d.ts +334 -0
  46. package/esm/schemas/rfc4.d.ts.map +1 -0
  47. package/esm/schemas/rfc4.js +129 -0
  48. package/esm/schemas/units.d.ts +70 -5
  49. package/esm/schemas/units.d.ts.map +1 -1
  50. package/esm/schemas/units.js +4 -12
  51. package/esm/schemas/zarr_metadata.d.ts +10 -4
  52. package/esm/schemas/zarr_metadata.d.ts.map +1 -1
  53. package/esm/schemas/zarr_metadata.js +22 -1
  54. package/esm/types/array_interface.d.ts +7 -0
  55. package/esm/types/array_interface.d.ts.map +1 -0
  56. package/esm/types/array_interface.js +1 -0
  57. package/esm/types/hcs.d.ts +70 -0
  58. package/esm/types/hcs.d.ts.map +1 -0
  59. package/esm/types/hcs.js +204 -0
  60. package/esm/types/methods.d.ts.map +1 -1
  61. package/esm/types/methods.js +2 -0
  62. package/esm/types/multiscales.d.ts.map +1 -1
  63. package/esm/types/ngff_image.d.ts +6 -3
  64. package/esm/types/ngff_image.d.ts.map +1 -1
  65. package/esm/types/ngff_image.js +13 -1
  66. package/esm/types/rfc4.d.ts +94 -0
  67. package/esm/types/rfc4.d.ts.map +1 -0
  68. package/esm/types/rfc4.js +135 -0
  69. package/esm/types/units.d.ts +1 -1
  70. package/esm/types/units.d.ts.map +1 -1
  71. package/esm/types/zarr_metadata.d.ts +14 -5
  72. package/esm/types/zarr_metadata.d.ts.map +1 -1
  73. package/esm/utils/create_queue.d.ts +6 -0
  74. package/esm/utils/create_queue.d.ts.map +1 -0
  75. package/esm/utils/create_queue.js +11 -0
  76. package/esm/utils/factory.d.ts +1 -1
  77. package/esm/utils/factory.d.ts.map +1 -1
  78. package/esm/utils/factory.js +16 -7
  79. package/esm/utils/method_metadata.d.ts +10 -0
  80. package/esm/utils/method_metadata.d.ts.map +1 -0
  81. package/esm/utils/method_metadata.js +37 -0
  82. package/esm/utils/validation.d.ts.map +1 -1
  83. package/package.json +7 -1
  84. package/script/io/from_ngff_zarr.d.ts +4 -1
  85. package/script/io/from_ngff_zarr.d.ts.map +1 -1
  86. package/script/io/from_ngff_zarr.js +94 -27
  87. package/script/io/hcs.d.ts +18 -0
  88. package/script/io/hcs.d.ts.map +1 -0
  89. package/script/io/hcs.js +55 -0
  90. package/script/io/itk_image_to_ngff_image.d.ts +30 -0
  91. package/script/io/itk_image_to_ngff_image.d.ts.map +1 -0
  92. package/script/io/itk_image_to_ngff_image.js +153 -0
  93. package/script/io/ngff_image_to_itk_image.d.ts +30 -0
  94. package/script/io/ngff_image_to_itk_image.d.ts.map +1 -0
  95. package/script/io/ngff_image_to_itk_image.js +244 -0
  96. package/script/io/to_multiscales.d.ts +18 -0
  97. package/script/io/to_multiscales.d.ts.map +1 -0
  98. package/script/io/to_multiscales.js +67 -0
  99. package/script/io/to_ngff_image.d.ts +17 -0
  100. package/script/io/to_ngff_image.d.ts.map +1 -0
  101. package/script/io/to_ngff_image.js +162 -0
  102. package/script/io/to_ngff_zarr.d.ts +3 -2
  103. package/script/io/to_ngff_zarr.d.ts.map +1 -1
  104. package/script/io/to_ngff_zarr.js +289 -26
  105. package/script/methods/itkwasm.d.ts +6 -0
  106. package/script/methods/itkwasm.d.ts.map +1 -0
  107. package/script/methods/itkwasm.js +984 -0
  108. package/script/mod.d.ts +9 -2
  109. package/script/mod.d.ts.map +1 -1
  110. package/script/mod.js +12 -3
  111. package/script/schemas/coordinate_systems.d.ts +251 -0
  112. package/script/schemas/coordinate_systems.d.ts.map +1 -0
  113. package/script/schemas/coordinate_systems.js +142 -0
  114. package/script/schemas/index.d.ts +9 -0
  115. package/script/schemas/index.d.ts.map +1 -0
  116. package/script/schemas/index.js +101 -0
  117. package/script/schemas/methods.d.ts.map +1 -1
  118. package/script/schemas/methods.js +2 -0
  119. package/script/schemas/multiscales.d.ts.map +1 -1
  120. package/script/schemas/multiscales.js +2 -0
  121. package/script/schemas/ngff_image.d.ts +9 -2
  122. package/script/schemas/ngff_image.d.ts.map +1 -1
  123. package/script/schemas/ngff_image.js +11 -2
  124. package/script/schemas/ome_zarr.d.ts +617 -0
  125. package/script/schemas/ome_zarr.d.ts.map +1 -0
  126. package/script/schemas/ome_zarr.js +211 -0
  127. package/script/schemas/rfc4.d.ts +334 -0
  128. package/script/schemas/rfc4.d.ts.map +1 -0
  129. package/script/schemas/rfc4.js +132 -0
  130. package/script/schemas/units.d.ts +70 -5
  131. package/script/schemas/units.d.ts.map +1 -1
  132. package/script/schemas/units.js +4 -12
  133. package/script/schemas/zarr_metadata.d.ts +10 -4
  134. package/script/schemas/zarr_metadata.d.ts.map +1 -1
  135. package/script/schemas/zarr_metadata.js +23 -2
  136. package/script/types/array_interface.d.ts +7 -0
  137. package/script/types/array_interface.d.ts.map +1 -0
  138. package/script/types/array_interface.js +2 -0
  139. package/script/types/hcs.d.ts +70 -0
  140. package/script/types/hcs.d.ts.map +1 -0
  141. package/script/types/hcs.js +233 -0
  142. package/script/types/methods.d.ts.map +1 -1
  143. package/script/types/methods.js +2 -0
  144. package/script/types/multiscales.d.ts.map +1 -1
  145. package/script/types/ngff_image.d.ts +6 -3
  146. package/script/types/ngff_image.d.ts.map +1 -1
  147. package/script/types/ngff_image.js +13 -1
  148. package/script/types/rfc4.d.ts +94 -0
  149. package/script/types/rfc4.d.ts.map +1 -0
  150. package/script/types/rfc4.js +143 -0
  151. package/script/types/units.d.ts +1 -1
  152. package/script/types/units.d.ts.map +1 -1
  153. package/script/types/zarr_metadata.d.ts +14 -5
  154. package/script/types/zarr_metadata.d.ts.map +1 -1
  155. package/script/utils/create_queue.d.ts +6 -0
  156. package/script/utils/create_queue.d.ts.map +1 -0
  157. package/script/utils/create_queue.js +17 -0
  158. package/script/utils/factory.d.ts +1 -1
  159. package/script/utils/factory.d.ts.map +1 -1
  160. package/script/utils/factory.js +39 -7
  161. package/script/utils/method_metadata.d.ts +10 -0
  162. package/script/utils/method_metadata.d.ts.map +1 -0
  163. package/script/utils/method_metadata.js +40 -0
  164. package/script/utils/validation.d.ts.map +1 -1
  165. package/esm/schemas/lazy_array.d.ts +0 -8
  166. package/esm/schemas/lazy_array.d.ts.map +0 -1
  167. package/esm/schemas/lazy_array.js +0 -7
  168. package/esm/types/lazy_array.d.ts +0 -18
  169. package/esm/types/lazy_array.d.ts.map +0 -1
  170. package/esm/types/lazy_array.js +0 -27
  171. package/script/schemas/lazy_array.d.ts +0 -8
  172. package/script/schemas/lazy_array.d.ts.map +0 -1
  173. package/script/schemas/lazy_array.js +0 -10
  174. package/script/types/lazy_array.d.ts +0 -18
  175. package/script/types/lazy_array.d.ts.map +0 -1
  176. package/script/types/lazy_array.js +0 -31
@@ -0,0 +1,94 @@
1
+ /**
2
+ * RFC 4 implementation for anatomical orientation in OME-NGFF.
3
+ *
4
+ * This module implements RFC 4 which adds anatomical orientation support
5
+ * to OME-NGFF axes, based on the LinkML schema.
6
+ */
7
+ /**
8
+ * Anatomical orientation refers to the specific arrangement and directional
9
+ * alignment of anatomical structures within an imaging dataset. It is crucial
10
+ * for ensuring accurate alignment and comparison of images to anatomical atlases,
11
+ * facilitating consistent analysis and interpretation of biological data.
12
+ */
13
+ export declare enum AnatomicalOrientationValues {
14
+ LeftToRight = "left-to-right",
15
+ RightToLeft = "right-to-left",
16
+ AnteriorToPosterior = "anterior-to-posterior",
17
+ PosteriorToAnterior = "posterior-to-anterior",
18
+ InferiorToSuperior = "inferior-to-superior",
19
+ SuperiorToInferior = "superior-to-inferior",
20
+ DorsalToVentral = "dorsal-to-ventral",
21
+ VentralToDorsal = "ventral-to-dorsal",
22
+ DorsalToPalmar = "dorsal-to-palmar",
23
+ PalmarToDorsal = "palmar-to-dorsal",
24
+ DorsalToPlantar = "dorsal-to-plantar",
25
+ PlantarToDorsal = "plantar-to-dorsal",
26
+ RostralToCaudal = "rostral-to-caudal",
27
+ CaudalToRostral = "caudal-to-rostral",
28
+ CranialToCaudal = "cranial-to-caudal",
29
+ CaudalToCranial = "caudal-to-cranial",
30
+ ProximalToDistal = "proximal-to-distal",
31
+ DistalToProximal = "distal-to-proximal"
32
+ }
33
+ /**
34
+ * Anatomical orientation specification for spatial axes.
35
+ */
36
+ export interface AnatomicalOrientation {
37
+ readonly type: "anatomical";
38
+ readonly value: AnatomicalOrientationValues;
39
+ }
40
+ /**
41
+ * Create an anatomical orientation object.
42
+ */
43
+ export declare function createAnatomicalOrientation(value: AnatomicalOrientationValues): AnatomicalOrientation;
44
+ /**
45
+ * LPS (Left-Posterior-Superior) coordinate system orientations.
46
+ * In LPS, the axes increase from:
47
+ * - X: right-to-left (L = Left)
48
+ * - Y: anterior-to-posterior (P = Posterior)
49
+ * - Z: inferior-to-superior (S = Superior)
50
+ * This is the standard coordinate system used by ITK and many medical imaging applications.
51
+ */
52
+ export declare const LPS: Record<string, AnatomicalOrientation>;
53
+ /**
54
+ * RAS (Right-Anterior-Superior) coordinate system orientations.
55
+ * In RAS, the axes increase from:
56
+ * - X: left-to-right (R = Right)
57
+ * - Y: posterior-to-anterior (A = Anterior)
58
+ * - Z: inferior-to-superior (S = Superior)
59
+ * This coordinate system is commonly used in neuroimaging applications like FreeSurfer and FSL.
60
+ */
61
+ export declare const RAS: Record<string, AnatomicalOrientation>;
62
+ /**
63
+ * Convert ITK LPS coordinate system to anatomical orientation.
64
+ *
65
+ * ITK uses the LPS (Left-Posterior-Superior) coordinate system by default.
66
+ * In LPS, the axes increase from:
67
+ * - X: right-to-left (L = Left)
68
+ * - Y: anterior-to-posterior (P = Posterior)
69
+ * - Z: inferior-to-superior (S = Superior)
70
+ *
71
+ * @param axisName - The axis name ('x', 'y', or 'z')
72
+ * @returns The corresponding anatomical orientation, or undefined for non-spatial axes
73
+ */
74
+ export declare function itkLpsToAnatomicalOrientation(axisName: string): AnatomicalOrientation | undefined;
75
+ /**
76
+ * Check if RFC 4 is enabled in the list of enabled RFCs.
77
+ */
78
+ export declare function isRfc4Enabled(enabledRfcs?: number[]): boolean;
79
+ /**
80
+ * Add anatomical orientation to an axis object.
81
+ *
82
+ * @param axisDict - The axis object to modify
83
+ * @param orientation - The anatomical orientation to add
84
+ * @returns The modified axis object
85
+ */
86
+ export declare function addAnatomicalOrientationToAxis(axisDict: Record<string, unknown>, orientation: AnatomicalOrientation): Record<string, unknown>;
87
+ /**
88
+ * Remove anatomical orientation from an axis object.
89
+ *
90
+ * @param axisDict - The axis object to modify
91
+ * @returns The modified axis object
92
+ */
93
+ export declare function removeAnatomicalOrientationFromAxis(axisDict: Record<string, unknown>): Record<string, unknown>;
94
+ //# sourceMappingURL=rfc4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rfc4.d.ts","sourceRoot":"","sources":["../../src/types/rfc4.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;;;;GAKG;AACH,oBAAY,2BAA2B;IAErC,WAAW,kBAAkB;IAE7B,WAAW,kBAAkB;IAE7B,mBAAmB,0BAA0B;IAE7C,mBAAmB,0BAA0B;IAE7C,kBAAkB,yBAAyB;IAE3C,kBAAkB,yBAAyB;IAE3C,eAAe,sBAAsB;IAErC,eAAe,sBAAsB;IAErC,cAAc,qBAAqB;IAEnC,cAAc,qBAAqB;IAEnC,eAAe,sBAAsB;IAErC,eAAe,sBAAsB;IAErC,eAAe,sBAAsB;IAErC,eAAe,sBAAsB;IAErC,eAAe,sBAAsB;IAErC,eAAe,sBAAsB;IAErC,gBAAgB,uBAAuB;IAEvC,gBAAgB,uBAAuB;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,2BAA2B,GACjC,qBAAqB,CAKvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAQrD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAQrD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,GACf,qBAAqB,GAAG,SAAS,CAEnC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAE7D;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,WAAW,EAAE,qBAAqB,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGzB"}
@@ -0,0 +1,135 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) Fideus Labs LLC
2
+ // SPDX-License-Identifier: MIT
3
+ /**
4
+ * RFC 4 implementation for anatomical orientation in OME-NGFF.
5
+ *
6
+ * This module implements RFC 4 which adds anatomical orientation support
7
+ * to OME-NGFF axes, based on the LinkML schema.
8
+ */
9
+ /**
10
+ * Anatomical orientation refers to the specific arrangement and directional
11
+ * alignment of anatomical structures within an imaging dataset. It is crucial
12
+ * for ensuring accurate alignment and comparison of images to anatomical atlases,
13
+ * facilitating consistent analysis and interpretation of biological data.
14
+ */
15
+ export var AnatomicalOrientationValues;
16
+ (function (AnatomicalOrientationValues) {
17
+ // Describes the directional orientation from the left side to the right lateral side of an anatomical structure or body
18
+ AnatomicalOrientationValues["LeftToRight"] = "left-to-right";
19
+ // Describes the directional orientation from the right side to the left lateral side of an anatomical structure or body
20
+ AnatomicalOrientationValues["RightToLeft"] = "right-to-left";
21
+ // Describes the directional orientation from the front (anterior) to the back (posterior) of an anatomical structure or body
22
+ AnatomicalOrientationValues["AnteriorToPosterior"] = "anterior-to-posterior";
23
+ // Describes the directional orientation from the back (posterior) to the front (anterior) of an anatomical structure or body
24
+ AnatomicalOrientationValues["PosteriorToAnterior"] = "posterior-to-anterior";
25
+ // Describes the directional orientation from below (inferior) to above (superior) in an anatomical structure or body
26
+ AnatomicalOrientationValues["InferiorToSuperior"] = "inferior-to-superior";
27
+ // Describes the directional orientation from above (superior) to below (inferior) in an anatomical structure or body
28
+ AnatomicalOrientationValues["SuperiorToInferior"] = "superior-to-inferior";
29
+ // Describes the directional orientation from the top/upper (dorsal) to the belly/lower (ventral) in an anatomical structure or body
30
+ AnatomicalOrientationValues["DorsalToVentral"] = "dorsal-to-ventral";
31
+ // Describes the directional orientation from the belly/lower (ventral) to the top/upper (dorsal) in an anatomical structure or body
32
+ AnatomicalOrientationValues["VentralToDorsal"] = "ventral-to-dorsal";
33
+ // Describes the directional orientation from the top/upper (dorsal) to the palm of the hand (palmar) in a body
34
+ AnatomicalOrientationValues["DorsalToPalmar"] = "dorsal-to-palmar";
35
+ // Describes the directional orientation from the palm of the hand (palmar) to the top/upper (dorsal) in a body
36
+ AnatomicalOrientationValues["PalmarToDorsal"] = "palmar-to-dorsal";
37
+ // Describes the directional orientation from the top/upper (dorsal) to the sole of the foot (plantar) in a body
38
+ AnatomicalOrientationValues["DorsalToPlantar"] = "dorsal-to-plantar";
39
+ // Describes the directional orientation from the sole of the foot (plantar) to the top/upper (dorsal) in a body
40
+ AnatomicalOrientationValues["PlantarToDorsal"] = "plantar-to-dorsal";
41
+ // Describes the directional orientation from the nasal (rostral) to the tail (caudal) end of an anatomical structure, typically used in reference to the central nervous system
42
+ AnatomicalOrientationValues["RostralToCaudal"] = "rostral-to-caudal";
43
+ // Describes the directional orientation from the tail (caudal) to the nasal (rostral) end of an anatomical structure, typically used in reference to the central nervous system
44
+ AnatomicalOrientationValues["CaudalToRostral"] = "caudal-to-rostral";
45
+ // Describes the directional orientation from the head (cranial) to the tail (caudal) end of an anatomical structure or body
46
+ AnatomicalOrientationValues["CranialToCaudal"] = "cranial-to-caudal";
47
+ // Describes the directional orientation from the tail (caudal) to the head (cranial) end of an anatomical structure or body
48
+ AnatomicalOrientationValues["CaudalToCranial"] = "caudal-to-cranial";
49
+ // Describes the directional orientation from the center of the body to the periphery of an anatomical structure or limb
50
+ AnatomicalOrientationValues["ProximalToDistal"] = "proximal-to-distal";
51
+ // Describes the directional orientation from the periphery of an anatomical structure or limb to the center of the body
52
+ AnatomicalOrientationValues["DistalToProximal"] = "distal-to-proximal";
53
+ })(AnatomicalOrientationValues || (AnatomicalOrientationValues = {}));
54
+ /**
55
+ * Create an anatomical orientation object.
56
+ */
57
+ export function createAnatomicalOrientation(value) {
58
+ return {
59
+ type: "anatomical",
60
+ value,
61
+ };
62
+ }
63
+ /**
64
+ * LPS (Left-Posterior-Superior) coordinate system orientations.
65
+ * In LPS, the axes increase from:
66
+ * - X: right-to-left (L = Left)
67
+ * - Y: anterior-to-posterior (P = Posterior)
68
+ * - Z: inferior-to-superior (S = Superior)
69
+ * This is the standard coordinate system used by ITK and many medical imaging applications.
70
+ */
71
+ export const LPS = {
72
+ x: createAnatomicalOrientation(AnatomicalOrientationValues.RightToLeft),
73
+ y: createAnatomicalOrientation(AnatomicalOrientationValues.AnteriorToPosterior),
74
+ z: createAnatomicalOrientation(AnatomicalOrientationValues.InferiorToSuperior),
75
+ };
76
+ /**
77
+ * RAS (Right-Anterior-Superior) coordinate system orientations.
78
+ * In RAS, the axes increase from:
79
+ * - X: left-to-right (R = Right)
80
+ * - Y: posterior-to-anterior (A = Anterior)
81
+ * - Z: inferior-to-superior (S = Superior)
82
+ * This coordinate system is commonly used in neuroimaging applications like FreeSurfer and FSL.
83
+ */
84
+ export const RAS = {
85
+ x: createAnatomicalOrientation(AnatomicalOrientationValues.LeftToRight),
86
+ y: createAnatomicalOrientation(AnatomicalOrientationValues.PosteriorToAnterior),
87
+ z: createAnatomicalOrientation(AnatomicalOrientationValues.InferiorToSuperior),
88
+ };
89
+ /**
90
+ * Convert ITK LPS coordinate system to anatomical orientation.
91
+ *
92
+ * ITK uses the LPS (Left-Posterior-Superior) coordinate system by default.
93
+ * In LPS, the axes increase from:
94
+ * - X: right-to-left (L = Left)
95
+ * - Y: anterior-to-posterior (P = Posterior)
96
+ * - Z: inferior-to-superior (S = Superior)
97
+ *
98
+ * @param axisName - The axis name ('x', 'y', or 'z')
99
+ * @returns The corresponding anatomical orientation, or undefined for non-spatial axes
100
+ */
101
+ export function itkLpsToAnatomicalOrientation(axisName) {
102
+ return LPS[axisName];
103
+ }
104
+ /**
105
+ * Check if RFC 4 is enabled in the list of enabled RFCs.
106
+ */
107
+ export function isRfc4Enabled(enabledRfcs) {
108
+ return enabledRfcs !== undefined && enabledRfcs.includes(4);
109
+ }
110
+ /**
111
+ * Add anatomical orientation to an axis object.
112
+ *
113
+ * @param axisDict - The axis object to modify
114
+ * @param orientation - The anatomical orientation to add
115
+ * @returns The modified axis object
116
+ */
117
+ export function addAnatomicalOrientationToAxis(axisDict, orientation) {
118
+ return {
119
+ ...axisDict,
120
+ orientation: {
121
+ type: orientation.type,
122
+ value: orientation.value,
123
+ },
124
+ };
125
+ }
126
+ /**
127
+ * Remove anatomical orientation from an axis object.
128
+ *
129
+ * @param axisDict - The axis object to modify
130
+ * @returns The modified axis object
131
+ */
132
+ export function removeAnatomicalOrientationFromAxis(axisDict) {
133
+ const { orientation: _orientation, ...rest } = axisDict;
134
+ return rest;
135
+ }
@@ -1,6 +1,6 @@
1
1
  export type SupportedDims = "c" | "x" | "y" | "z" | "t";
2
2
  export type SpatialDims = "x" | "y" | "z";
3
- export type AxesType = "time" | "space" | "channel";
3
+ export type AxesType = "time" | "space" | "channel" | "array" | "coordinate" | "displacement";
4
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
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
6
  export type Units = SpaceUnits | TimeUnits;
@@ -1 +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,YAA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,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"}
@@ -21,18 +21,25 @@ export interface Dataset {
21
21
  coordinateTransformations: Transform[];
22
22
  }
23
23
  export interface OmeroWindow {
24
- min: number;
25
- max: number;
26
- start: number;
27
- end: number;
24
+ min?: number;
25
+ max?: number;
26
+ start?: number;
27
+ end?: number;
28
28
  }
29
29
  export interface OmeroChannel {
30
30
  color: string;
31
31
  window: OmeroWindow;
32
- label: string | undefined;
32
+ label?: string;
33
+ active?: boolean;
33
34
  }
34
35
  export interface Omero {
35
36
  channels: OmeroChannel[];
37
+ version?: string;
38
+ }
39
+ export interface MethodMetadata {
40
+ description: string;
41
+ method: string;
42
+ version: string;
36
43
  }
37
44
  export interface Metadata {
38
45
  axes: Axis[];
@@ -41,6 +48,8 @@ export interface Metadata {
41
48
  omero: Omero | undefined;
42
49
  name: string;
43
50
  version: string;
51
+ type?: string;
52
+ metadata?: MethodMetadata;
44
53
  }
45
54
  export declare function validateColor(color: string): void;
46
55
  export declare function createScale(scale: number[]): Scale;
@@ -1 +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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EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;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;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIjD;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,6 @@
1
+ export type ChunkQueue = {
2
+ add(fn: () => Promise<void>): void;
3
+ onIdle(): Promise<void>;
4
+ };
5
+ export declare function createQueue(): ChunkQueue;
6
+ //# sourceMappingURL=create_queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_queue.d.ts","sourceRoot":"","sources":["../../src/utils/create_queue.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB,CAAC;AAEF,wBAAgB,WAAW,IAAI,UAAU,CAOxC"}
@@ -0,0 +1,11 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) Fideus Labs LLC
2
+ // SPDX-License-Identifier: MIT
3
+ import PQueue from "p-queue";
4
+ export function createQueue() {
5
+ const concurrency = Math.min(navigator?.hardwareConcurrency || 4, 128);
6
+ const queue = new PQueue({ concurrency });
7
+ return {
8
+ add: (fn) => queue.add(fn),
9
+ onIdle: queue.onIdle.bind(queue),
10
+ };
11
+ }
@@ -3,7 +3,7 @@ import { Multiscales } from "../types/multiscales.js";
3
3
  import type { Axis, Dataset, Metadata, Scale, Translation } from "../types/zarr_metadata.js";
4
4
  import type { AxesType, SupportedDims, Units } from "../types/units.js";
5
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;
6
+ export declare function createNgffImage(_data: ArrayBuffer | number[], shape: number[], dtype: string, dims: string[], scale: Record<string, number>, translation: Record<string, number>, name?: string): Promise<NgffImage>;
7
7
  export declare function createAxis(name: SupportedDims, type: AxesType, unit?: Units): Axis;
8
8
  export declare function createScale(scale: number[]): Scale;
9
9
  export declare function createTranslation(translation: number[]): Translation;
@@ -1 +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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,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"}
@@ -1,15 +1,24 @@
1
- import { LazyArray } from "../types/lazy_array.js";
1
+ // SPDX-FileCopyrightText: Copyright (c) Fideus Labs LLC
2
+ // SPDX-License-Identifier: MIT
3
+ import * as zarr from "zarrita";
2
4
  import { NgffImage } from "../types/ngff_image.js";
3
5
  import { Multiscales } from "../types/multiscales.js";
4
- export function createNgffImage(_data, shape, dtype, dims, scale, translation, name = "image") {
5
- const lazyArray = new LazyArray({
6
+ // Create a zarr.Array for testing using an in-memory store
7
+ async function createTestZarrArray(shape, dtype, chunks, name) {
8
+ const store = new Map();
9
+ const root = zarr.root(store);
10
+ // Create the array using zarrita with correct options
11
+ const array = await zarr.create(root.resolve(name), {
6
12
  shape,
7
- dtype,
8
- chunks: [shape],
9
- name,
13
+ chunk_shape: chunks,
14
+ data_type: dtype,
10
15
  });
16
+ return array;
17
+ }
18
+ export async function createNgffImage(_data, shape, dtype, dims, scale, translation, name = "image") {
19
+ const zarrArray = await createTestZarrArray(shape, dtype, shape, name);
11
20
  return new NgffImage({
12
- data: lazyArray,
21
+ data: zarrArray,
13
22
  dims,
14
23
  scale,
15
24
  translation,
@@ -0,0 +1,10 @@
1
+ import type { Methods } from "../types/methods.js";
2
+ import type { MethodMetadata } from "../types/zarr_metadata.js";
3
+ /**
4
+ * Get metadata information for a given downsampling method.
5
+ *
6
+ * @param method - The downsampling method enum
7
+ * @returns MethodMetadata with description, method (package.function), and version
8
+ */
9
+ export declare function getMethodMetadata(method: Methods): MethodMetadata | undefined;
10
+ //# sourceMappingURL=method_metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method_metadata.d.ts","sourceRoot":"","sources":["../../src/utils/method_metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA6BhE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAe7E"}
@@ -0,0 +1,37 @@
1
+ const METHOD_INFO = {
2
+ itkwasm_gaussian: {
3
+ description: "Smoothed with a discrete gaussian filter to generate a scale space, ideal for intensity images. ITK-Wasm implementation is extremely portable and SIMD accelerated.",
4
+ package: "itkwasm-downsample",
5
+ method: "itkwasm_downsample.downsample",
6
+ },
7
+ itkwasm_bin_shrink: {
8
+ description: "Uses the local mean for the output value. WebAssembly build. Fast but generates more artifacts than gaussian-based methods. Appropriate for intensity images.",
9
+ package: "itkwasm-downsample",
10
+ method: "itkwasm_downsample.downsample_bin_shrink",
11
+ },
12
+ itkwasm_label_image: {
13
+ description: "A sample is the mode of the linearly weighted local labels in the image. Fast and minimal artifacts. For label images.",
14
+ package: "itkwasm-downsample",
15
+ method: "itkwasm_downsample.downsample_label_image",
16
+ },
17
+ };
18
+ /**
19
+ * Get metadata information for a given downsampling method.
20
+ *
21
+ * @param method - The downsampling method enum
22
+ * @returns MethodMetadata with description, method (package.function), and version
23
+ */
24
+ export function getMethodMetadata(method) {
25
+ const methodInfo = METHOD_INFO[method];
26
+ if (!methodInfo) {
27
+ return undefined;
28
+ }
29
+ // TODO: Determine package version dynamically if possible,
30
+ // For now use a placeholder
31
+ const version = "unknown";
32
+ return {
33
+ description: methodInfo.description,
34
+ method: methodInfo.method,
35
+ version,
36
+ };
37
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAG1D,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAQ5D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIjD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAyDjD"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAG1D,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAQ5D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIjD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAyDjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fideus-labs/ngff-zarr",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript implementation of ngff-zarr for reading and writing OME-Zarr files",
5
5
  "keywords": [
6
6
  "ome-zarr",
@@ -39,9 +39,15 @@
39
39
  "LICENSE"
40
40
  ],
41
41
  "dependencies": {
42
+ "@itk-wasm/downsample": "^1.8.1",
43
+ "itk-wasm": "^1.0.0-b.195",
44
+ "p-queue": "^8.1.0",
42
45
  "@zarrita/storage": "^0.1.1",
43
46
  "zod": "^4.0.2",
44
47
  "zarrita": "^0.5.2"
45
48
  },
49
+ "devDependencies": {
50
+ "@itk-wasm/image-io": "^1.6.0"
51
+ },
46
52
  "_generatedBy": "dnt@dev"
47
53
  }
@@ -1,7 +1,10 @@
1
+ import * as zarr from "zarrita";
1
2
  import { Multiscales } from "../types/multiscales.js";
2
3
  export interface FromNgffZarrOptions {
3
4
  validate?: boolean;
5
+ version?: "0.4" | "0.5";
4
6
  }
5
- export declare function fromNgffZarr(storePath: string, options?: FromNgffZarrOptions): Promise<Multiscales>;
7
+ export type MemoryStore = Map<string, Uint8Array>;
8
+ export declare function fromNgffZarr(store: string | MemoryStore | zarr.FetchStore, options?: FromNgffZarrOptions): Promise<Multiscales>;
6
9
  export declare function readArrayData(storePath: string, arrayPath: string, selection?: (number | null)[]): Promise<unknown>;
7
10
  //# sourceMappingURL=from_ngff_zarr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"from_ngff_zarr.d.ts","sourceRoot":"","sources":["../../src/io/from_ngff_zarr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAOtD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,WAAW,CAAC,CAyItB;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAC5B,OAAO,CAAC,OAAO,CAAC,CAoBlB"}
1
+ {"version":3,"file":"from_ngff_zarr.d.ts","sourceRoot":"","sources":["../../src/io/from_ngff_zarr.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAMtD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAElD,wBAAsB,YAAY,CAEhC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC,UAAU,EAC7C,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,WAAW,CAAC,CA6MtB;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAC5B,OAAO,CAAC,OAAO,CAAC,CAmClB"}