@fideus-labs/ngff-zarr 0.0.1 → 0.1.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 (174) hide show
  1. package/README.md +9 -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 +25 -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 +216 -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 +273 -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 +816 -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 +644 -0
  30. package/esm/schemas/coordinate_systems.d.ts.map +1 -0
  31. package/esm/schemas/coordinate_systems.js +140 -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 +581 -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 +439 -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.map +1 -1
  49. package/esm/schemas/units.js +5 -0
  50. package/esm/schemas/zarr_metadata.d.ts +302 -9
  51. package/esm/schemas/zarr_metadata.d.ts.map +1 -1
  52. package/esm/schemas/zarr_metadata.js +22 -1
  53. package/esm/types/array_interface.d.ts +7 -0
  54. package/esm/types/array_interface.d.ts.map +1 -0
  55. package/esm/types/array_interface.js +1 -0
  56. package/esm/types/hcs.d.ts +70 -0
  57. package/esm/types/hcs.d.ts.map +1 -0
  58. package/esm/types/hcs.js +204 -0
  59. package/esm/types/methods.d.ts.map +1 -1
  60. package/esm/types/methods.js +2 -0
  61. package/esm/types/multiscales.d.ts.map +1 -1
  62. package/esm/types/ngff_image.d.ts +6 -3
  63. package/esm/types/ngff_image.d.ts.map +1 -1
  64. package/esm/types/ngff_image.js +13 -1
  65. package/esm/types/rfc4.d.ts +94 -0
  66. package/esm/types/rfc4.d.ts.map +1 -0
  67. package/esm/types/rfc4.js +135 -0
  68. package/esm/types/units.d.ts +1 -1
  69. package/esm/types/units.d.ts.map +1 -1
  70. package/esm/types/zarr_metadata.d.ts +14 -5
  71. package/esm/types/zarr_metadata.d.ts.map +1 -1
  72. package/esm/utils/create_queue.d.ts +6 -0
  73. package/esm/utils/create_queue.d.ts.map +1 -0
  74. package/esm/utils/create_queue.js +11 -0
  75. package/esm/utils/factory.d.ts +1 -1
  76. package/esm/utils/factory.d.ts.map +1 -1
  77. package/esm/utils/factory.js +16 -7
  78. package/esm/utils/method_metadata.d.ts +10 -0
  79. package/esm/utils/method_metadata.d.ts.map +1 -0
  80. package/esm/utils/method_metadata.js +37 -0
  81. package/esm/utils/validation.d.ts.map +1 -1
  82. package/package.json +7 -1
  83. package/script/io/from_ngff_zarr.d.ts +4 -1
  84. package/script/io/from_ngff_zarr.d.ts.map +1 -1
  85. package/script/io/from_ngff_zarr.js +94 -27
  86. package/script/io/hcs.d.ts +18 -0
  87. package/script/io/hcs.d.ts.map +1 -0
  88. package/script/io/hcs.js +55 -0
  89. package/script/io/itk_image_to_ngff_image.d.ts +25 -0
  90. package/script/io/itk_image_to_ngff_image.d.ts.map +1 -0
  91. package/script/io/itk_image_to_ngff_image.js +153 -0
  92. package/script/io/ngff_image_to_itk_image.d.ts +30 -0
  93. package/script/io/ngff_image_to_itk_image.d.ts.map +1 -0
  94. package/script/io/ngff_image_to_itk_image.js +242 -0
  95. package/script/io/to_multiscales.d.ts +18 -0
  96. package/script/io/to_multiscales.d.ts.map +1 -0
  97. package/script/io/to_multiscales.js +67 -0
  98. package/script/io/to_ngff_image.d.ts +17 -0
  99. package/script/io/to_ngff_image.d.ts.map +1 -0
  100. package/script/io/to_ngff_image.js +162 -0
  101. package/script/io/to_ngff_zarr.d.ts +3 -2
  102. package/script/io/to_ngff_zarr.d.ts.map +1 -1
  103. package/script/io/to_ngff_zarr.js +273 -26
  104. package/script/methods/itkwasm.d.ts +6 -0
  105. package/script/methods/itkwasm.d.ts.map +1 -0
  106. package/script/methods/itkwasm.js +842 -0
  107. package/script/mod.d.ts +9 -2
  108. package/script/mod.d.ts.map +1 -1
  109. package/script/mod.js +12 -3
  110. package/script/schemas/coordinate_systems.d.ts +644 -0
  111. package/script/schemas/coordinate_systems.d.ts.map +1 -0
  112. package/script/schemas/coordinate_systems.js +143 -0
  113. package/script/schemas/index.d.ts +9 -0
  114. package/script/schemas/index.d.ts.map +1 -0
  115. package/script/schemas/index.js +101 -0
  116. package/script/schemas/methods.d.ts.map +1 -1
  117. package/script/schemas/methods.js +2 -0
  118. package/script/schemas/multiscales.d.ts.map +1 -1
  119. package/script/schemas/multiscales.js +2 -0
  120. package/script/schemas/ngff_image.d.ts +9 -2
  121. package/script/schemas/ngff_image.d.ts.map +1 -1
  122. package/script/schemas/ngff_image.js +11 -2
  123. package/script/schemas/ome_zarr.d.ts +581 -0
  124. package/script/schemas/ome_zarr.d.ts.map +1 -0
  125. package/script/schemas/ome_zarr.js +211 -0
  126. package/script/schemas/rfc4.d.ts +439 -0
  127. package/script/schemas/rfc4.d.ts.map +1 -0
  128. package/script/schemas/rfc4.js +132 -0
  129. package/script/schemas/units.d.ts.map +1 -1
  130. package/script/schemas/units.js +5 -0
  131. package/script/schemas/zarr_metadata.d.ts +302 -9
  132. package/script/schemas/zarr_metadata.d.ts.map +1 -1
  133. package/script/schemas/zarr_metadata.js +23 -2
  134. package/script/types/array_interface.d.ts +7 -0
  135. package/script/types/array_interface.d.ts.map +1 -0
  136. package/script/types/array_interface.js +2 -0
  137. package/script/types/hcs.d.ts +70 -0
  138. package/script/types/hcs.d.ts.map +1 -0
  139. package/script/types/hcs.js +233 -0
  140. package/script/types/methods.d.ts.map +1 -1
  141. package/script/types/methods.js +2 -0
  142. package/script/types/multiscales.d.ts.map +1 -1
  143. package/script/types/ngff_image.d.ts +6 -3
  144. package/script/types/ngff_image.d.ts.map +1 -1
  145. package/script/types/ngff_image.js +13 -1
  146. package/script/types/rfc4.d.ts +94 -0
  147. package/script/types/rfc4.d.ts.map +1 -0
  148. package/script/types/rfc4.js +143 -0
  149. package/script/types/units.d.ts +1 -1
  150. package/script/types/units.d.ts.map +1 -1
  151. package/script/types/zarr_metadata.d.ts +14 -5
  152. package/script/types/zarr_metadata.d.ts.map +1 -1
  153. package/script/utils/create_queue.d.ts +6 -0
  154. package/script/utils/create_queue.d.ts.map +1 -0
  155. package/script/utils/create_queue.js +17 -0
  156. package/script/utils/factory.d.ts +1 -1
  157. package/script/utils/factory.d.ts.map +1 -1
  158. package/script/utils/factory.js +39 -7
  159. package/script/utils/method_metadata.d.ts +10 -0
  160. package/script/utils/method_metadata.d.ts.map +1 -0
  161. package/script/utils/method_metadata.js +40 -0
  162. package/script/utils/validation.d.ts.map +1 -1
  163. package/esm/schemas/lazy_array.d.ts +0 -8
  164. package/esm/schemas/lazy_array.d.ts.map +0 -1
  165. package/esm/schemas/lazy_array.js +0 -7
  166. package/esm/types/lazy_array.d.ts +0 -18
  167. package/esm/types/lazy_array.d.ts.map +0 -1
  168. package/esm/types/lazy_array.js +0 -27
  169. package/script/schemas/lazy_array.d.ts +0 -8
  170. package/script/schemas/lazy_array.d.ts.map +0 -1
  171. package/script/schemas/lazy_array.js +0 -10
  172. package/script/types/lazy_array.d.ts +0 -18
  173. package/script/types/lazy_array.d.ts.map +0 -1
  174. package/script/types/lazy_array.js +0 -31
@@ -0,0 +1,204 @@
1
+ export class LRUCache {
2
+ cache;
3
+ maxSize;
4
+ constructor(options) {
5
+ this.cache = new Map();
6
+ this.maxSize = options.maxSize;
7
+ }
8
+ get(key) {
9
+ const value = this.cache.get(key);
10
+ if (value !== undefined) {
11
+ // Move to end (most recently used)
12
+ this.cache.delete(key);
13
+ this.cache.set(key, value);
14
+ }
15
+ return value;
16
+ }
17
+ set(key, value) {
18
+ if (this.cache.has(key)) {
19
+ // Update existing item
20
+ this.cache.delete(key);
21
+ }
22
+ else if (this.cache.size >= this.maxSize) {
23
+ // Remove least recently used item
24
+ const firstKey = this.cache.keys().next().value;
25
+ if (firstKey !== undefined) {
26
+ this.cache.delete(firstKey);
27
+ }
28
+ }
29
+ this.cache.set(key, value);
30
+ }
31
+ has(key) {
32
+ return this.cache.has(key);
33
+ }
34
+ clear() {
35
+ this.cache.clear();
36
+ }
37
+ }
38
+ export class HCSWell {
39
+ store;
40
+ path;
41
+ plateMetadata;
42
+ metadata;
43
+ _images;
44
+ constructor(options) {
45
+ this.store = options.store;
46
+ this.path = options.wellPath;
47
+ this.plateMetadata = { ...options.plateMetadata };
48
+ this.metadata = {
49
+ images: [...options.wellGroupMetadata.images],
50
+ version: options.wellGroupMetadata.version,
51
+ };
52
+ const imageCacheSize = options.imageCacheSize ?? 100;
53
+ this._images = new LRUCache({
54
+ maxSize: imageCacheSize,
55
+ });
56
+ }
57
+ get rowIndex() {
58
+ return this.plateMetadata.rowIndex;
59
+ }
60
+ get columnIndex() {
61
+ return this.plateMetadata.columnIndex;
62
+ }
63
+ get images() {
64
+ return [...this.metadata.images];
65
+ }
66
+ async getImage(fieldIndex = 0) {
67
+ if (fieldIndex < 0 || fieldIndex >= this.metadata.images.length) {
68
+ return null;
69
+ }
70
+ const imageMeta = this.metadata.images[fieldIndex];
71
+ const imagePath = `${this.path}/${imageMeta.path}`;
72
+ // Check cache first
73
+ const cached = this._images.get(imagePath);
74
+ if (cached) {
75
+ return cached;
76
+ }
77
+ // Load the image using fromNgffZarr
78
+ const { fromNgffZarr } = await import("../io/from_ngff_zarr.js");
79
+ let fullImagePath;
80
+ if (typeof this.store === "string") {
81
+ // If store is a path string, append the image path
82
+ fullImagePath = `${this.store}/${this.path}/${imageMeta.path}`;
83
+ }
84
+ else {
85
+ // For other store types, we need to handle differently
86
+ // This would need to be adapted based on the specific store type
87
+ throw new Error("Non-string store types not yet implemented for HCS");
88
+ }
89
+ try {
90
+ const multiscales = await fromNgffZarr(fullImagePath);
91
+ this._images.set(imagePath, multiscales);
92
+ return multiscales;
93
+ }
94
+ catch (error) {
95
+ console.error(`Failed to load image at ${fullImagePath}:`, error);
96
+ return null;
97
+ }
98
+ }
99
+ getImageByAcquisition(acquisitionId, fieldIndex = 0) {
100
+ // Find images for the specified acquisition
101
+ const acquisitionImages = this.metadata.images.filter((img) => img.acquisition === acquisitionId);
102
+ if (fieldIndex < 0 || fieldIndex >= acquisitionImages.length) {
103
+ return Promise.resolve(null);
104
+ }
105
+ // Find the actual image index in the full list
106
+ const targetImage = acquisitionImages[fieldIndex];
107
+ const actualIndex = this.metadata.images.indexOf(targetImage);
108
+ return this.getImage(actualIndex);
109
+ }
110
+ static fromStore(store, wellPath, wellMetadata, imageCacheSize) {
111
+ // Simplified implementation - we'll improve this when implementing the IO functions
112
+ const wellGroupMetadata = {
113
+ images: [
114
+ { path: "0", acquisition: 0 },
115
+ { path: "1", acquisition: 0 },
116
+ ],
117
+ version: "0.4",
118
+ };
119
+ return new HCSWell({
120
+ store,
121
+ wellPath,
122
+ plateMetadata: wellMetadata,
123
+ wellGroupMetadata,
124
+ imageCacheSize,
125
+ });
126
+ }
127
+ }
128
+ export class HCSPlate {
129
+ store;
130
+ metadata;
131
+ _wells;
132
+ imageCacheSize;
133
+ constructor(options) {
134
+ this.store = options.store;
135
+ this.metadata = {
136
+ columns: [...options.metadata.columns],
137
+ rows: [...options.metadata.rows],
138
+ wells: [...options.metadata.wells],
139
+ version: options.metadata.version,
140
+ acquisitions: options.metadata.acquisitions
141
+ ? [...options.metadata.acquisitions]
142
+ : undefined,
143
+ field_count: options.metadata.field_count,
144
+ name: options.metadata.name,
145
+ };
146
+ this.imageCacheSize = options.imageCacheSize;
147
+ const wellCacheSize = options.wellCacheSize ?? 500;
148
+ this._wells = new LRUCache({ maxSize: wellCacheSize });
149
+ }
150
+ get name() {
151
+ return this.metadata.name;
152
+ }
153
+ get rows() {
154
+ return [...this.metadata.rows];
155
+ }
156
+ get columns() {
157
+ return [...this.metadata.columns];
158
+ }
159
+ get wells() {
160
+ return [...this.metadata.wells];
161
+ }
162
+ get acquisitions() {
163
+ return this.metadata.acquisitions
164
+ ? [...this.metadata.acquisitions]
165
+ : undefined;
166
+ }
167
+ get fieldCount() {
168
+ return this.metadata.field_count;
169
+ }
170
+ getWell(rowName, columnName) {
171
+ const wellPath = `${rowName}/${columnName}`;
172
+ // Check if well exists in metadata
173
+ const wellMeta = this.metadata.wells.find((well) => well.path === wellPath);
174
+ if (!wellMeta) {
175
+ return null;
176
+ }
177
+ // Check cache first
178
+ const cached = this._wells.get(wellPath);
179
+ if (cached) {
180
+ return cached;
181
+ }
182
+ // Load the well
183
+ try {
184
+ const well = HCSWell.fromStore(this.store, wellPath, wellMeta, this.imageCacheSize);
185
+ this._wells.set(wellPath, well);
186
+ return well;
187
+ }
188
+ catch (error) {
189
+ console.error(`Failed to load well at ${wellPath}:`, error);
190
+ return null;
191
+ }
192
+ }
193
+ getWellByIndices(rowIndex, columnIndex) {
194
+ if (rowIndex < 0 ||
195
+ rowIndex >= this.metadata.rows.length ||
196
+ columnIndex < 0 ||
197
+ columnIndex >= this.metadata.columns.length) {
198
+ return null;
199
+ }
200
+ const rowName = this.metadata.rows[rowIndex].name;
201
+ const columnName = this.metadata.columns[columnIndex].name;
202
+ return this.getWell(rowName, columnName);
203
+ }
204
+ }
@@ -1 +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"}
1
+ {"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/types/methods.ts"],"names":[],"mappings":"AAEA,oBAAY,OAAO;IACjB,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,mBAAmB,wBAAwB;CAC5C;AAED,eAAO,MAAM,aAAa,EAAE,OAAO,EAA2B,CAAC"}
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) Fideus Labs LLC
2
+ // SPDX-License-Identifier: MIT
1
3
  export var Methods;
2
4
  (function (Methods) {
3
5
  Methods["ITKWASM_GAUSSIAN"] = "itkwasm_gaussian";
@@ -1 +1 @@
1
- {"version":3,"file":"multiscales.d.ts","sourceRoot":"","sources":["../../src/types/multiscales.ts"],"names":[],"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c,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"}
@@ -1,22 +1,25 @@
1
- import type { LazyArray } from "./lazy_array.js";
1
+ import * as zarr from "zarrita";
2
2
  import type { Units } from "./units.js";
3
+ import type { AnatomicalOrientation } from "./rfc4.js";
3
4
  export type ComputedCallback = () => void;
4
5
  export interface NgffImageOptions {
5
- data: LazyArray;
6
+ data: zarr.Array<zarr.DataType, zarr.Readable>;
6
7
  dims: string[];
7
8
  scale: Record<string, number>;
8
9
  translation: Record<string, number>;
9
10
  name: string | undefined;
10
11
  axesUnits: Record<string, Units> | undefined;
12
+ axesOrientations?: Record<string, AnatomicalOrientation> | undefined;
11
13
  computedCallbacks: ComputedCallback[] | undefined;
12
14
  }
13
15
  export declare class NgffImage {
14
- readonly data: LazyArray;
16
+ readonly data: zarr.Array<zarr.DataType, zarr.Readable>;
15
17
  readonly dims: string[];
16
18
  readonly scale: Record<string, number>;
17
19
  readonly translation: Record<string, number>;
18
20
  readonly name: string;
19
21
  readonly axesUnits: Record<string, Units> | undefined;
22
+ readonly axesOrientations: Record<string, AnatomicalOrientation> | undefined;
20
23
  readonly computedCallbacks: ComputedCallback[];
21
24
  constructor(options: NgffImageOptions);
22
25
  toString(): string;
@@ -1 +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;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,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,gBAAgB,EAC5B,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GACrC,SAAS,CAAC;IACd,SAAgB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;gBAE1C,OAAO,EAAE,gBAAgB;IAarC,QAAQ,IAAI,MAAM;CA8BnB"}
@@ -5,6 +5,7 @@ export class NgffImage {
5
5
  translation;
6
6
  name;
7
7
  axesUnits;
8
+ axesOrientations;
8
9
  computedCallbacks;
9
10
  constructor(options) {
10
11
  this.data = options.data;
@@ -13,19 +14,30 @@ export class NgffImage {
13
14
  this.translation = { ...options.translation };
14
15
  this.name = options.name ?? "image";
15
16
  this.axesUnits = options.axesUnits ? { ...options.axesUnits } : undefined;
17
+ this.axesOrientations = options.axesOrientations
18
+ ? { ...options.axesOrientations }
19
+ : undefined;
16
20
  this.computedCallbacks = [...(options.computedCallbacks ?? [])];
17
21
  }
18
22
  toString() {
19
23
  const axesUnitsStr = this.axesUnits
20
24
  ? JSON.stringify(this.axesUnits)
21
25
  : "None";
26
+ const axesOrientationsStr = this.axesOrientations
27
+ ? JSON.stringify(this.axesOrientations)
28
+ : "None";
29
+ // Create array string representation using zarr.Array properties
30
+ const path = this.data.path || this.name;
31
+ const chunks = this.data.chunks.join(", ");
32
+ const arrayStr = `Array(name=${path}, shape=(${this.data.shape.join(", ")}), dtype=${this.data.dtype}, chunksize=(${chunks}), chunktype=TypedArray)`;
22
33
  return `NgffImage(
23
- data=${this.data.toString()},
34
+ data=${arrayStr},
24
35
  dims=[${this.dims.map((d) => `'${d}'`).join(", ")}],
25
36
  scale=${JSON.stringify(this.scale)},
26
37
  translation=${JSON.stringify(this.translation)},
27
38
  name='${this.name}',
28
39
  axes_units=${axesUnitsStr},
40
+ axes_orientations=${axesOrientationsStr},
29
41
  computed_callbacks=[${this.computedCallbacks.length} callbacks]
30
42
  )`;
31
43
  }
@@ -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,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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F,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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S,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,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,IA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