@jax-data-science/sci-image-visualizer 0.1.0 → 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.
- package/esm2022/lib/contracts/image.contract.mjs +1 -1
- package/esm2022/lib/implementations/osd/histogram-sampler.mjs +46 -1
- package/esm2022/lib/implementations/osd/openseadragon-visualizer.service.mjs +194 -10
- package/fesm2022/jax-data-science-sci-image-visualizer.mjs +238 -9
- package/fesm2022/jax-data-science-sci-image-visualizer.mjs.map +1 -1
- package/lib/contracts/image.contract.d.ts +6 -0
- package/lib/implementations/osd/histogram-sampler.d.ts +17 -0
- package/lib/implementations/osd/openseadragon-visualizer.service.d.ts +25 -0
- package/package.json +1 -1
|
@@ -54,6 +54,12 @@ export interface IImageInfo {
|
|
|
54
54
|
* opposed to the scalar `roiJsonStr`, which is one ROI set for the whole
|
|
55
55
|
* image (a single file or a server z-stack). (jit-ui#93) */
|
|
56
56
|
roiJsonStrs?: (string | null)[];
|
|
57
|
+
/** Per-slice, per-channel plane URLs for a SERVERLESS multichannel image
|
|
58
|
+
* (`tiled: false` + `imageMeta[0].channelCount > 1`). `channelUrls[z][c]`
|
|
59
|
+
* is a complete single-band image of channel c at slice z. The OSD simple
|
|
60
|
+
* path composites them client-side — per-channel colour/window/gamma from
|
|
61
|
+
* the channel pane — instead of opening the flat `urls[z]`. (jit-ui#76) */
|
|
62
|
+
channelUrls?: string[][];
|
|
57
63
|
imageMeta: IImageMetadata[];
|
|
58
64
|
/** How the OpenSeadragon backend should source this image.
|
|
59
65
|
* - `true`/absent (default): server-tiled — OSD polls `/tiles/info` for a
|
|
@@ -74,6 +74,23 @@ export declare class HistogramSampler {
|
|
|
74
74
|
* only). Fire-and-forget; failures leave the window unset (identity 0..255).
|
|
75
75
|
*/
|
|
76
76
|
computeImageWindow(d: SampledDescriptor, infoB64: string, z: number): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Client-side histogram for the SIMPLE (`tiled:false`) path: bin an
|
|
79
|
+
* already-decoded RGBA frame's OWN pixels — no tile server, no fetch. Same
|
|
80
|
+
* output shape as {@link computeImageWindow}: grayscale → [intensity];
|
|
81
|
+
* RGB → [R, G, B]. This is what lets the Channels & Histogram pane work for
|
|
82
|
+
* serverless images (the processing-pipeline preview, DICOM/TIFF stacks),
|
|
83
|
+
* which never hit the tile / `/histogram` endpoints.
|
|
84
|
+
*/
|
|
85
|
+
computeSimpleHistogram(z: number, data: Uint8ClampedArray | Uint8Array, gray: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* Per-channel histograms for a SIMPLE (`tiled:false`) MULTICHANNEL image: bin
|
|
88
|
+
* each already-decoded channel plane's own pixels (no tile server). One
|
|
89
|
+
* histogram per channel, so the pane's per-channel selector works serverlessly.
|
|
90
|
+
*/
|
|
91
|
+
computeSimpleMultichannelHistograms(z: number, planes: Array<{
|
|
92
|
+
data: Uint8ClampedArray | Uint8Array;
|
|
93
|
+
}>): void;
|
|
77
94
|
/**
|
|
78
95
|
* Native-bit-depth histogram for >8-bit images, from the server `/histogram`
|
|
79
96
|
* endpoint (the 8-bit canvas tiles can't carry 16-bit values). Cached per
|
|
@@ -123,6 +123,14 @@ export declare class OpenSeadragonVisualizerService extends BaseStoreVisualizer
|
|
|
123
123
|
/** preview blob URL → full-res upscaled blob URL (see toFullResUrl), so
|
|
124
124
|
* re-visiting a simple-mode slice doesn't re-upscale. Revoked on file change. */
|
|
125
125
|
private readonly simpleFullResUrls;
|
|
126
|
+
/** SERVERLESS multichannel (tiled:false + channelCount>1): the stack's
|
|
127
|
+
* per-slice per-channel plane URLs, the current slice's decoded planes, and
|
|
128
|
+
* the last composite blob URL. Composited client-side via display.channelRgbLut
|
|
129
|
+
* (no tile server); kept OFF the tiled isMultiChannel path. */
|
|
130
|
+
private simpleMultichannel;
|
|
131
|
+
private simpleChannelUrls;
|
|
132
|
+
private simpleChannelPlanes;
|
|
133
|
+
private simpleCompositeUrl;
|
|
126
134
|
/** Skip the full-res upscale above this longest-side dimension — a folder
|
|
127
135
|
* stack is per-file previews (well under this); this only guards against an
|
|
128
136
|
* accidental enormous canvas allocation. */
|
|
@@ -246,6 +254,23 @@ export declare class OpenSeadragonVisualizerService extends BaseStoreVisualizer
|
|
|
246
254
|
* they're implausibly large (guards against an enormous canvas). (jit-ui#93)
|
|
247
255
|
*/
|
|
248
256
|
private toFullResUrl;
|
|
257
|
+
/** Sample a SIMPLE-mode slice's own decoded pixels into the histogram — the
|
|
258
|
+
* serverless analog of the tiled samplers (no tile server). Fire-and-forget;
|
|
259
|
+
* a decode failure just leaves the pane empty rather than throwing. */
|
|
260
|
+
private sampleSimpleHistogram;
|
|
261
|
+
/** Fetch + decode a slice's per-channel planes (single-band grayscale) into
|
|
262
|
+
* pixel buffers, for the SERVERLESS multichannel compositor. Auth-safe: goes
|
|
263
|
+
* through SimpleSliceAccessService (blob:/data: as-is; http via HttpClient). */
|
|
264
|
+
private loadSimpleChannelPlanes;
|
|
265
|
+
/** Composite the cached per-channel planes into ONE RGBA image using the
|
|
266
|
+
* current channel states (colour/window/gamma/visibility) — the client-side,
|
|
267
|
+
* serverless analog of the tiled per-channel 'lighter' compositor
|
|
268
|
+
* (same display.channelRgbLut math as recolorChannelTile, applied per-plane).
|
|
269
|
+
* Returns a blob: URL of the composite PNG, revoking the previous one. */
|
|
270
|
+
private compositeSimpleMultichannel;
|
|
271
|
+
/** Re-composite the current slice from its cached planes (new channel states)
|
|
272
|
+
* and re-open — the serverless analog of the tiled invalidate-on-channel-change. */
|
|
273
|
+
private recompositeAndOpen;
|
|
249
274
|
/** Load a URL into an HTMLImageElement (resolves once decoded). Uses
|
|
250
275
|
* document.createElement rather than `new Image()` because this file's
|
|
251
276
|
* `Image` import is image-js's decoder, not the DOM element. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jax-data-science/sci-image-visualizer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Browser-based scientific image visualization for Angular — gigapixel whole-slide (OpenSeadragon), 2D/3D (Plotly) and WebGPU (napari-js) rendering, with region/annotation editing and in-browser SAM segmentation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|