omezarr-tilesource 0.4.0 → 0.5.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 CHANGED
@@ -22,6 +22,14 @@ Using pnpm:
22
22
  pnpm add omezarr-tilesource
23
23
  ```
24
24
 
25
+ The package is distributed as an ES module for use with a bundler (e.g. Vite).
26
+ [zarrita](https://github.com/manzt/zarrita.js),
27
+ [@zarrita/storage](https://github.com/manzt/zarrita.js) and
28
+ [ome-zarr.js](https://github.com/BioNGFF/ome-zarr.js) are peer dependencies
29
+ (installed automatically by pnpm and npm 7 or newer) and are not bundled, so
30
+ the app and the tile source share a single copy, e.g. for passing `NgffImage`
31
+ instances loaded by the app.
32
+
25
33
  ## Usage
26
34
 
27
35
  ```javascript
@@ -60,7 +68,7 @@ const tileSource4 = new OMEZarrTileSource({
60
68
  // autoBoost: undefined // boost brightness of dark tiles (default false)
61
69
  });
62
70
 
63
- const viewer = OpenSeadragon(
71
+ const viewer = OpenSeadragon({
64
72
  ...
65
73
  tileSources: [
66
74
  tileSource1,
@@ -68,7 +76,7 @@ const viewer = OpenSeadragon(
68
76
  tileSource3,
69
77
  tileSource4
70
78
  ]
71
- );
79
+ });
72
80
  ```
73
81
 
74
82
  ### Accessing OME-Zarr metadata
@@ -105,12 +113,18 @@ opened zarrita arrays, which ome-zarr.js caches on the `NgffImage` instance.
105
113
  The tile source never modifies the `NgffImage`, so sharing is safe:
106
114
 
107
115
  ```javascript
116
+ import { NgffImage } from "ome-zarr.js";
117
+
118
+ // reuse the image loaded by a first tile source
108
119
  const tileSource1 = await OMEZarrTileSource.open({ url: url, c: 0 });
109
120
  const tileSource2 = new OMEZarrTileSource(
110
121
  { url: url, c: 1 },
111
122
  tileSource1.image,
112
123
  );
113
- // or, without a first tile source: NgffImage.load(url) from ome-zarr.js
124
+
125
+ // or load the image with the app's own ome-zarr.js import
126
+ const image = await NgffImage.load(url);
127
+ const tileSource3 = new OMEZarrTileSource({ url: url, c: 2 }, image);
114
128
  ```
115
129
 
116
130
  ## Data pipeline