omezarr-tilesource 0.2.0 → 0.3.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
@@ -12,7 +12,7 @@ An OpenSeadragon tile source for the OME-Zarr bioimage file format
12
12
 
13
13
  ## Prerequisites
14
14
 
15
- OpenSeadragon 5 or newer
15
+ OpenSeadragon 6 or newer
16
16
 
17
17
  ## Installation
18
18
 
@@ -39,9 +39,11 @@ const tileSource2 = {
39
39
  type: "ome-zarr",
40
40
  url: url,
41
41
  // zip: undefined, // undefined = OME-Zarr ZIP auto-detection based on .ozx suffix
42
- // t: undefined,
43
- // c: undefined,
44
- // z: undefined
42
+ // c: undefined, // undefined = composite of all active channels (requires dataType "context2d")
43
+ // z: undefined, // undefined = omero metadata default
44
+ // t: undefined, // undefined = omero metadata default
45
+ // dataType: undefined, // "context2d" (default, rendered tiles) or "ome-zarr" (raw single-channel chunks)
46
+ // autoBoost: undefined // boost brightness of dark tiles (default false)
45
47
  };
46
48
 
47
49
  // direct instantiation with URL (works with any OME-Zarr storage backend)
@@ -51,9 +53,11 @@ const tileSource3 = new OMEZarrTileSource(url);
51
53
  const tileSource4 = new OMEZarrTileSource({
52
54
  url: url,
53
55
  // zip: undefined, // undefined = OME-Zarr ZIP auto-detection based on .ozx suffix
54
- // t: undefined,
55
- // c: undefined,
56
- // z: undefined
56
+ // c: undefined, // undefined = composite of all active channels (requires dataType "context2d")
57
+ // z: undefined, // undefined = omero metadata default
58
+ // t: undefined, // undefined = omero metadata default
59
+ // dataType: undefined, // "context2d" (default, rendered tiles) or "ome-zarr" (raw single-channel chunks)
60
+ // autoBoost: undefined // boost brightness of dark tiles (default false)
57
61
  });
58
62
 
59
63
  const viewer = OpenSeadragon(
@@ -67,6 +71,25 @@ const viewer = OpenSeadragon(
67
71
  );
68
72
  ```
69
73
 
74
+ ## Data pipeline
75
+
76
+ By default (`dataType: "context2d"`), tiles are rendered by the tile source and
77
+ passed to OpenSeadragon as 2D canvas contexts, using the rendering settings
78
+ (color, color LUT/map, contrast limits, inversion) from the omero metadata. For
79
+ multi-channel images without `c`, all active channels are rendered into a
80
+ composite image.
81
+
82
+ With `dataType: "ome-zarr"`, tiles are instead downloaded as raw single-channel
83
+ zarrita chunks and passed to OpenSeadragon with the data type `ome-zarr` (see
84
+ the `OMEZarrTileData` type). Multi-channel images therefore require the `c`
85
+ option. A converter from `ome-zarr` to `context2d` is registered on
86
+ `OpenSeadragon.converter` when the module is imported (and by
87
+ `OMEZarrTileSource.enable`). It reads the rendering settings at conversion time
88
+ from the omero channel referenced by the tile data (`OMEZarrTileData.channel`).
89
+ The channel object is shared by all tiles of a tile source, so advanced users
90
+ may modify it (e.g. from a `tile-invalidated` handler) and re-render the cached
91
+ tiles using `viewer.requestInvalidate()`.
92
+
70
93
  ## Example
71
94
 
72
95
  [Example](https://tissuumaps.github.io/OMEZarrTileSource)
@@ -1,4 +1,4 @@
1
- //#region node_modules/.pnpm/ome-zarr.js@0.0.19/node_modules/ome-zarr.js/dist/__vite-browser-external-YbutIfMq.js
1
+ //#region node_modules/.pnpm/ome-zarr.js@0.0.20/node_modules/ome-zarr.js/dist/__vite-browser-external-YbutIfMq.js
2
2
  var e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3
3
  __proto__: null,
4
4
  default: {}
@@ -1,21 +1,24 @@
1
+ import { Channel } from 'ome-zarr.js';
1
2
  import { default as default_2 } from 'openseadragon';
3
+ import * as zarr from 'zarrita';
4
+
5
+ export declare interface OMEZarrTileData {
6
+ chunk: zarr.Chunk<zarr.NumberDataType | zarr.BigintDataType>;
7
+ channel: Channel;
8
+ autoBoost?: boolean;
9
+ }
2
10
 
3
11
  export declare class OMEZarrTileSource extends default_2.TileSource {
4
- static readonly DUMMY_XHR: XMLHttpRequest;
5
12
  readonly url: string;
6
- width: number;
7
- height: number;
8
- aspectRatio: number;
9
- dimensions: default_2.Point;
10
- maxLevel: number;
11
- ready: boolean;
12
13
  readonly zip?: boolean;
13
- readonly t?: number;
14
14
  readonly c?: number;
15
15
  readonly z?: number;
16
- private _omero?;
17
- private _multiscale?;
18
- private _axisIndices?;
16
+ readonly t?: number;
17
+ readonly dataType: "ome-zarr" | "context2d";
18
+ readonly autoBoost?: boolean;
19
+ width: number;
20
+ height: number;
21
+ private _image?;
19
22
  private _arrays?;
20
23
  constructor(url: string);
21
24
  constructor(options: OMEZarrTileSourceOptions);
@@ -31,24 +34,20 @@ export declare class OMEZarrTileSource extends default_2.TileSource {
31
34
  downloadTileStart(context: default_2.ImageJob): void;
32
35
  downloadTileAbort(context: default_2.ImageJob): void;
33
36
  static enable(os?: typeof default_2): void;
34
- private static _getMultiscale;
35
- private static _getAxisIndices;
37
+ private static _learnConverters;
38
+ private _getActiveChannelIndices;
39
+ private static _render;
36
40
  }
37
41
 
38
- export declare type OMEZarrTileSourceClass = typeof OMEZarrTileSource;
39
-
40
42
  export declare interface OMEZarrTileSourceOptions {
41
43
  type?: "ome-zarr";
42
44
  url: string;
43
45
  zip?: boolean;
44
- t?: number;
45
46
  c?: number;
46
47
  z?: number;
48
+ t?: number;
49
+ dataType?: "ome-zarr" | "context2d";
50
+ autoBoost?: boolean;
47
51
  }
48
52
 
49
53
  export { }
50
-
51
-
52
- declare module "openseadragon" {
53
- let OMEZarrTileSource: OMEZarrTileSourceClass;
54
- }