zarrextra 0.2.2 → 0.2.3
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 +14 -3
- package/dist/codec-worker.js +558 -274
- package/dist/codec-worker.js.map +1 -1
- package/dist/workers/index.d.ts +5 -14
- package/dist/workers/index.d.ts.map +1 -1
- package/dist/workers/index.package.d.ts +6 -0
- package/dist/workers/index.package.d.ts.map +1 -0
- package/dist/workers/workerControls.d.ts +16 -0
- package/dist/workers/workerControls.d.ts.map +1 -0
- package/dist/workers/workerUrl.package.d.ts +2 -0
- package/dist/workers/workerUrl.package.d.ts.map +1 -0
- package/dist/workers/workerUrl.source.d.ts +2 -0
- package/dist/workers/workerUrl.source.d.ts.map +1 -0
- package/dist/workers.js +32 -21
- package/dist/workers.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,8 +92,14 @@ const encoded = await encodeHtj2kPlane(plane, { width, height }, {
|
|
|
92
92
|
|
|
93
93
|
## Worker-backed chunk decode (browser)
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
Decoding and marshalling chunk data can block the main thread for a long time.
|
|
96
|
+
If you use `@spatialdata/vis`, its renderer path enables the bundled codec worker
|
|
97
|
+
automatically in browsers. You do not need to call this API for normal vis usage.
|
|
98
|
+
|
|
99
|
+
If we find that users get unexpected results or need more control we may revise this pattern.
|
|
100
|
+
|
|
101
|
+
For lower-level browser apps using `zarrextra` directly, use the optional
|
|
102
|
+
`zarrextra/workers` entry with
|
|
97
103
|
[`@fideus-labs/fizarrita`](https://www.npmjs.com/package/@fideus-labs/fizarrita)
|
|
98
104
|
to offload chunk decode to a Web Worker pool:
|
|
99
105
|
|
|
@@ -115,9 +121,14 @@ required for that path.
|
|
|
115
121
|
| Context | Setup |
|
|
116
122
|
|---------|-------|
|
|
117
123
|
| Node / CI | `registerJpeg2kCodec()` / `registerExperimentalHtj2kCodec()` on the main thread |
|
|
118
|
-
| Browser
|
|
124
|
+
| Browser with `@spatialdata/vis` | no setup for normal `SpatialCanvas` usage; optional `ensureCodecWorkers()` for eager activation |
|
|
125
|
+
| Browser without `@spatialdata/vis` | `enableWorkerChunkDecode()` from `zarrextra/workers` before loading JP2K or HTJ2K data |
|
|
119
126
|
|
|
120
127
|
Optional dependencies: `@fideus-labs/fizarrita`, `@fideus-labs/worker-pool`,
|
|
121
128
|
`@cornerstonejs/codec-openjpeg`, and `@cornerstonejs/codec-openjph` (bundled into
|
|
122
129
|
the default worker script). Future worker entries may let applications opt into
|
|
123
130
|
lighter worker bundles when JP2K or HTJ2K codecs are not needed.
|
|
131
|
+
|
|
132
|
+
Contributor note: new worker-backed entry points should follow the documented
|
|
133
|
+
[worker bundling pattern](https://github.com/Taylor-CCB-Group/SpatialData.js/blob/main/docs/docs/worker-bundling.mdx)
|
|
134
|
+
so consumers can use package APIs without passing private worker URLs.
|