@jax-data-science/sci-image-visualizer 0.16.0 → 0.18.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/display-types.mjs +4 -2
- package/esm2022/lib/contracts/image.contract.mjs +1 -1
- package/esm2022/lib/contracts/ports/spatial-data.port.mjs +1 -1
- package/esm2022/lib/contracts/region-editor-api.contract.mjs +1 -1
- package/esm2022/lib/contracts/region-store.contract.mjs +1 -1
- package/esm2022/lib/contracts/spatial-dataset.contract.mjs +1 -1
- package/esm2022/lib/contracts/visualizer.contract.mjs +1 -1
- package/esm2022/lib/geometry/cell-meshes.mjs +37 -0
- package/esm2022/lib/geometry/place.mjs +47 -0
- package/esm2022/lib/implementations/napari-js/napari-camera-depth.mjs +93 -0
- package/esm2022/lib/implementations/napari-js/napari-loading-state.mjs +1 -1
- package/esm2022/lib/implementations/napari-js/napari-region-overlay.mjs +2 -2
- package/esm2022/lib/implementations/napari-js/napari-scene.mjs +1 -1
- package/esm2022/lib/implementations/napari-js/napari-spatial-2d-scene.mjs +86 -18
- package/esm2022/lib/implementations/napari-js/napari-spatial-3d-cells.mjs +746 -0
- package/esm2022/lib/implementations/napari-js/napari-spatial-3d-scene.mjs +343 -18
- package/esm2022/lib/implementations/napari-js/napari-spatial-3d-transcripts.mjs +427 -0
- package/esm2022/lib/implementations/napari-js/napari-spatial-encoding.mjs +11 -4
- package/esm2022/lib/implementations/napari-js/napari-spatial-hover.mjs +95 -5
- package/esm2022/lib/implementations/napari-js/napari-spatial-scene.mjs +15 -1
- package/esm2022/lib/implementations/napari-js/napari-spatial-tiles.mjs +35 -8
- package/esm2022/lib/implementations/napari-js/napari-visualizer.service.mjs +40 -1
- package/esm2022/lib/implementations/napari-js/napari-volume-region-meshes.mjs +136 -28
- package/esm2022/lib/implementations/napari-js/napari-volume-scene.mjs +19 -3
- package/esm2022/lib/implementations/napari-js/spatial-tiles/cell-layers.mjs +188 -52
- package/esm2022/lib/implementations/napari-js/spatial-tiles/transcript-layers.mjs +35 -11
- package/esm2022/lib/implementations/osd/osd-region-overlay.mjs +2 -2
- package/esm2022/lib/implementations/spatial-data-http/spatial-data-http.service.mjs +10 -1
- package/esm2022/lib/region-editor/class-tree/class-tree.component.mjs +30 -3
- package/esm2022/lib/region-editor/classes-panel/classes-panel.component.mjs +15 -3
- package/esm2022/lib/region-editor/region-editor.component.mjs +24 -4
- package/esm2022/lib/region-source/region-source-ops.mjs +7 -1
- package/esm2022/lib/region-source/region-tiles.mjs +1 -1
- package/esm2022/lib/region-source/worker-region-source.mjs +24 -1
- package/esm2022/lib/routing-visualizer.service.mjs +404 -7
- package/esm2022/lib/spatial/observations-in-selection.mjs +83 -0
- package/esm2022/lib/spatial/plane-cells.mjs +119 -0
- package/esm2022/lib/spatial/spatial-controls.facade.mjs +304 -8
- package/esm2022/lib/spatial/spatial-encoding.mjs +52 -3
- package/esm2022/lib/spatial/spatial-hover.mjs +34 -1
- package/esm2022/lib/spatial/spatial-planes.mjs +49 -0
- package/esm2022/lib/spatial/spatial-selection.mjs +2 -2
- package/esm2022/lib/spatial/spatial-tile-merge.mjs +38 -1
- package/esm2022/lib/spatial/transcripts-in-selection.mjs +208 -0
- package/esm2022/lib/spatial-controls/spatial-cells-panel/spatial-cells-panel.component.mjs +42 -65
- package/esm2022/lib/spatial-controls/spatial-charts/spatial-charts.component.mjs +6 -2
- package/esm2022/lib/spatial-controls/spatial-color-by/spatial-color-by.component.mjs +187 -0
- package/esm2022/lib/spatial-controls/spatial-controls.component.mjs +51 -12
- package/esm2022/lib/spatial-controls/spatial-gene-style/spatial-gene-style.component.mjs +7 -3
- package/esm2022/lib/spatial-controls/spatial-gene-tree/spatial-gene-tree.component.mjs +21 -6
- package/esm2022/lib/spatial-controls/spatial-groups-panel/spatial-groups-panel.component.mjs +94 -13
- package/esm2022/lib/spatial-controls/spatial-key/spatial-key.component.mjs +3 -3
- package/esm2022/lib/spatial-controls/spatial-marker-genes-form/spatial-marker-genes-form.component.mjs +3 -3
- package/esm2022/lib/spatial-controls/spatial-observations-panel/spatial-observations-panel.component.mjs +79 -57
- package/esm2022/lib/spatial-controls/spatial-selection-observations/spatial-selection-observations.component.mjs +101 -0
- package/esm2022/lib/spatial-controls/spatial-selection-transcripts/spatial-selection-transcripts.component.mjs +94 -0
- package/esm2022/lib/spatial-controls/spatial-transcripts-panel/spatial-transcripts-panel.component.mjs +9 -3
- package/esm2022/lib/store/region-source-scope.mjs +10 -1
- package/esm2022/lib/store/region-store.service.mjs +33 -2
- package/esm2022/lib/toolbar/toolbar.component.mjs +10 -3
- package/esm2022/lib/visualizer/spatial-region-set.mjs +95 -0
- package/esm2022/lib/visualizer.component.mjs +40 -4
- package/fesm2022/{jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-CYsPzX3J.mjs → jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-CBiLcnE6.mjs} +4838 -656
- package/fesm2022/jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-CBiLcnE6.mjs.map +1 -0
- package/fesm2022/{jax-data-science-sci-image-visualizer-onnx-sam-session-DaZVXq1s.mjs → jax-data-science-sci-image-visualizer-onnx-sam-session-BXHjv4PE.mjs} +2 -2
- package/fesm2022/{jax-data-science-sci-image-visualizer-onnx-sam-session-DaZVXq1s.mjs.map → jax-data-science-sci-image-visualizer-onnx-sam-session-BXHjv4PE.mjs.map} +1 -1
- package/fesm2022/jax-data-science-sci-image-visualizer.mjs +1 -1
- package/fesm2022/region-source.worker.js +84 -2
- package/lib/contracts/display-types.d.ts +99 -6
- package/lib/contracts/image.contract.d.ts +6 -0
- package/lib/contracts/ports/spatial-data.port.d.ts +7 -0
- package/lib/contracts/region-editor-api.contract.d.ts +9 -0
- package/lib/contracts/region-store.contract.d.ts +6 -0
- package/lib/contracts/spatial-dataset.contract.d.ts +7 -1
- package/lib/contracts/visualizer.contract.d.ts +43 -1
- package/lib/geometry/cell-meshes.d.ts +27 -0
- package/lib/geometry/place.d.ts +45 -0
- package/lib/implementations/napari-js/napari-camera-depth.d.ts +23 -0
- package/lib/implementations/napari-js/napari-loading-state.d.ts +1 -1
- package/lib/implementations/napari-js/napari-scene.d.ts +12 -0
- package/lib/implementations/napari-js/napari-spatial-2d-scene.d.ts +19 -3
- package/lib/implementations/napari-js/napari-spatial-3d-cells.d.ts +141 -0
- package/lib/implementations/napari-js/napari-spatial-3d-scene.d.ts +89 -0
- package/lib/implementations/napari-js/napari-spatial-3d-transcripts.d.ts +103 -0
- package/lib/implementations/napari-js/napari-spatial-encoding.d.ts +9 -2
- package/lib/implementations/napari-js/napari-spatial-hover.d.ts +22 -0
- package/lib/implementations/napari-js/napari-spatial-scene.d.ts +12 -0
- package/lib/implementations/napari-js/napari-spatial-tiles.d.ts +20 -6
- package/lib/implementations/napari-js/napari-visualizer.service.d.ts +27 -1
- package/lib/implementations/napari-js/napari-volume-region-meshes.d.ts +48 -16
- package/lib/implementations/napari-js/napari-volume-scene.d.ts +2 -0
- package/lib/implementations/napari-js/spatial-tiles/cell-layers.d.ts +54 -1
- package/lib/implementations/napari-js/spatial-tiles/transcript-layers.d.ts +11 -2
- package/lib/implementations/spatial-data-http/spatial-data-http.service.d.ts +7 -0
- package/lib/region-editor/class-tree/class-tree.component.d.ts +16 -1
- package/lib/region-editor/classes-panel/classes-panel.component.d.ts +10 -1
- package/lib/region-editor/region-editor.component.d.ts +4 -0
- package/lib/region-source/region-source-ops.d.ts +12 -0
- package/lib/region-source/region-tiles.d.ts +8 -0
- package/lib/region-source/worker-region-source.d.ts +18 -0
- package/lib/routing-visualizer.service.d.ts +140 -1
- package/lib/spatial/observations-in-selection.d.ts +43 -0
- package/lib/spatial/plane-cells.d.ts +37 -0
- package/lib/spatial/spatial-controls.facade.d.ts +59 -0
- package/lib/spatial/spatial-encoding.d.ts +24 -1
- package/lib/spatial/spatial-hover.d.ts +23 -0
- package/lib/spatial/spatial-planes.d.ts +22 -0
- package/lib/spatial/spatial-selection.d.ts +2 -1
- package/lib/spatial/spatial-tile-merge.d.ts +9 -0
- package/lib/spatial/transcripts-in-selection.d.ts +95 -0
- package/lib/spatial-controls/spatial-cells-panel/spatial-cells-panel.component.d.ts +19 -28
- package/lib/spatial-controls/spatial-color-by/spatial-color-by.component.d.ts +64 -0
- package/lib/spatial-controls/spatial-controls.component.d.ts +19 -2
- package/lib/spatial-controls/spatial-gene-style/spatial-gene-style.component.d.ts +3 -1
- package/lib/spatial-controls/spatial-gene-tree/spatial-gene-tree.component.d.ts +7 -0
- package/lib/spatial-controls/spatial-groups-panel/spatial-groups-panel.component.d.ts +28 -7
- package/lib/spatial-controls/spatial-observations-panel/spatial-observations-panel.component.d.ts +26 -23
- package/lib/spatial-controls/spatial-selection-observations/spatial-selection-observations.component.d.ts +48 -0
- package/lib/spatial-controls/spatial-selection-transcripts/spatial-selection-transcripts.component.d.ts +43 -0
- package/lib/spatial-controls/spatial-transcripts-panel/spatial-transcripts-panel.component.d.ts +3 -1
- package/lib/store/region-source-scope.d.ts +4 -0
- package/lib/store/region-store.service.d.ts +21 -0
- package/lib/toolbar/toolbar.component.d.ts +6 -1
- package/lib/visualizer/spatial-region-set.d.ts +55 -0
- package/lib/visualizer.component.d.ts +14 -0
- package/package.json +2 -2
- package/fesm2022/jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-CYsPzX3J.mjs.map +0 -1
|
@@ -12,7 +12,7 @@ import { SpatialDataPort } from './contracts/ports/spatial-data.port';
|
|
|
12
12
|
import { CanvasToolOptions, ColormapNode, IBrushOptions, IWandOptions } from './contracts/display-types';
|
|
13
13
|
import { RegionStore } from './store/region-store.service';
|
|
14
14
|
import { RegionSource, RegionSourceView } from './region-source/region-source';
|
|
15
|
-
import type { RegionIndexPage, RegionIndexQuery } from './region-source/region-tiles';
|
|
15
|
+
import type { RegionIndexPage, RegionIndexQuery, RegionSourceInfo } from './region-source/region-tiles';
|
|
16
16
|
import type { RegionStyle } from './region-overlay/region-style';
|
|
17
17
|
import type { RegionSourceOpener, RegionSourceSlices } from './store/region-source-scope';
|
|
18
18
|
import { SpatialSelectionStore } from './store/spatial-selection.service';
|
|
@@ -94,6 +94,38 @@ export declare class RoutingVisualizerService implements IVisualizer, IRegionEdi
|
|
|
94
94
|
/** The class groups shown in 3D, and the image they belong to. */
|
|
95
95
|
private readonly classes3d$;
|
|
96
96
|
private classes3dImage;
|
|
97
|
+
/**
|
|
98
|
+
* The spatial dataset's region set attached to its image (see attachDatasetRegionSet): the image
|
|
99
|
+
* (its region scope key), the set's key, and where its slices are when it says (its `sliceZ`),
|
|
100
|
+
* which places its surfaces in spatial 3D on an image of one plane. `shown3d` once its classes
|
|
101
|
+
* were shown in 3D by themselves, which happens once per image.
|
|
102
|
+
*/
|
|
103
|
+
private datasetRegionSet;
|
|
104
|
+
/**
|
|
105
|
+
* Each image's attached region set, kept across image switches: coming back to the image finds
|
|
106
|
+
* its source still in the store (with what was taken from it, or deleted) and restores the set
|
|
107
|
+
* rather than attaching it again, which would start the source afresh.
|
|
108
|
+
*/
|
|
109
|
+
private readonly attachedRegionSets;
|
|
110
|
+
/** The spatial dataset on offer (the port's), for the boundary set its region set is. */
|
|
111
|
+
private spatialDataset;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the Annotations switch last hid every class in a spatial view (see syncAnnotations), so
|
|
114
|
+
* a change of it, not every view emission, hides or shows them.
|
|
115
|
+
*/
|
|
116
|
+
private annotationsHidden;
|
|
117
|
+
/** The 3D view's global cells switch as last applied (see updateCells3d). */
|
|
118
|
+
private cells3dMode;
|
|
119
|
+
/** Classes set the other way than the global switch in the Region Editor. */
|
|
120
|
+
private readonly cells3dOverrides;
|
|
121
|
+
/** The classes drawn as individual cells in spatial 3D, as last applied. */
|
|
122
|
+
private readonly individual3d$;
|
|
123
|
+
/** The classes that can be drawn as individual cells now (see getCellableClasses3d$). */
|
|
124
|
+
private readonly cellable3d$;
|
|
125
|
+
/** Follows the dataset and the spatial view for {@link updatePlaneCells}. */
|
|
126
|
+
private readonly planeCellsSub;
|
|
127
|
+
/** The dataset region set's planes while they slice the plotted image (see getDatasetPlanes$). */
|
|
128
|
+
private readonly datasetPlanes$;
|
|
97
129
|
/** The groups last asked for in 3D, with their colours: what an edit's rebuild shows again. */
|
|
98
130
|
private shown3d;
|
|
99
131
|
/**
|
|
@@ -202,6 +234,18 @@ export declare class RoutingVisualizerService implements IVisualizer, IRegionEdi
|
|
|
202
234
|
setImageSmoothingEnabled(enabled: boolean): void;
|
|
203
235
|
setShowStack(showstack: boolean): void;
|
|
204
236
|
setZIndex(zIndex: number): void;
|
|
237
|
+
/**
|
|
238
|
+
* The image's own slice for slider position `z`: 0 while the dataset region set's planes slice an
|
|
239
|
+
* image of one plane (the slider then picks the plane, see getDatasetPlanes$), else `z`.
|
|
240
|
+
*/
|
|
241
|
+
private imageSlice;
|
|
242
|
+
/**
|
|
243
|
+
* The planes of the spatial dataset's region set (its `sliceZ`, in observation units) while they
|
|
244
|
+
* slice the plotted image, an image of one plane; null otherwise. The host's slice slider then
|
|
245
|
+
* runs over them: each position shows that plane's regions and, in the 2D spatial view, the
|
|
246
|
+
* observations and transcripts nearest it, over the same image.
|
|
247
|
+
*/
|
|
248
|
+
getDatasetPlanes$(): Observable<readonly number[] | null>;
|
|
205
249
|
getTrueImageSize(): {
|
|
206
250
|
width: number;
|
|
207
251
|
height: number;
|
|
@@ -299,6 +343,88 @@ export declare class RoutingVisualizerService implements IVisualizer, IRegionEdi
|
|
|
299
343
|
* another image (see {@link regionImportTicket}; one is taken here when `ticket` is not given).
|
|
300
344
|
*/
|
|
301
345
|
importRegionSourceOpener(open: RegionSourceOpener, ticket?: number): Promise<boolean>;
|
|
346
|
+
/**
|
|
347
|
+
* Attach a spatial dataset's region set (a 3D segmentation's cells, outlined on every plane they
|
|
348
|
+
* span) to its image, the image plotted now, as the image's own regions are: over every slice
|
|
349
|
+
* from the set's planes (`'planes'`), not marked imported (it is the dataset's, nothing to save),
|
|
350
|
+
* leaving the image's drawn regions as they are. Once per image and set: called again (the
|
|
351
|
+
* dataset re-emitted, the image re-plotted) it changes nothing. Where the set's slices are (its
|
|
352
|
+
* `sliceZ`) places its surfaces among the observations in spatial 3D, where the region editor then
|
|
353
|
+
* offers its classes in 3D; there, every class is shown once by itself (see showDatasetRegionSet3d).
|
|
354
|
+
* Back on an image the set was attached to, with its source still the store's, it is restored as
|
|
355
|
+
* it was (what was taken from the source, or deleted, stays so), not attached again.
|
|
356
|
+
* Resolves false, changing nothing (the source disposed), when another image was plotted or
|
|
357
|
+
* another set attached while it opened, it could not be opened, or the image has region sources
|
|
358
|
+
* of its own (which it would replace, see keepsOwnSources).
|
|
359
|
+
*/
|
|
360
|
+
attachDatasetRegionSet(open: RegionSourceOpener, key: string): Promise<boolean>;
|
|
361
|
+
/**
|
|
362
|
+
* Whether the plotted image has region sources of its own (a served set, large saved ROIs, an
|
|
363
|
+
* annotation folder's slices), which attaching the dataset's set over every plane would replace,
|
|
364
|
+
* dropping them and what was taken from them: they are kept, and the set is not attached.
|
|
365
|
+
*/
|
|
366
|
+
private keepsOwnSources;
|
|
367
|
+
/**
|
|
368
|
+
* Make `set` the plotted image's region set: its planes slice the image (its regions per plane,
|
|
369
|
+
* as a stack's per slice: those drawn before go to the plane shown), place its surfaces in
|
|
370
|
+
* spatial 3D and drive the slider.
|
|
371
|
+
*/
|
|
372
|
+
private useDatasetRegionSet;
|
|
373
|
+
/**
|
|
374
|
+
* The dataset no longer names the attached set while its image is still plotted (see
|
|
375
|
+
* IVisualizer.releaseDatasetRegionSet): its planes, its surfaces and cells in 3D go, as on another
|
|
376
|
+
* image. Its attachment is kept (attachedRegionSets): the same set asked for again is restored.
|
|
377
|
+
*/
|
|
378
|
+
releaseDatasetRegionSet(keep: string | null): void;
|
|
379
|
+
/** The dataset region set's classes while in spatial 3D: those that can be drawn as cells. */
|
|
380
|
+
getCellableClasses3d$(): Observable<ReadonlySet<string>>;
|
|
381
|
+
/** The classes the spatial 3D view draws as individual cells (see updateCells3d). */
|
|
382
|
+
getIndividualClasses3d$(): Observable<ReadonlySet<string>>;
|
|
383
|
+
/** Draw these classes as individual cells in spatial 3D, or merged again (the global switch aside). */
|
|
384
|
+
setClassesIndividual3d(classes: readonly string[], individual: boolean): void;
|
|
385
|
+
/**
|
|
386
|
+
* Which of the dataset region set's classes the spatial 3D view draws as individual cells: every
|
|
387
|
+
* one with the panel's global switch on "cells", none on "types", each class the Region Editor
|
|
388
|
+
* set the other way excepted. Turning the global switch resets those. The individual classes'
|
|
389
|
+
* merged surfaces are left out (see showRegionClasses3d); their cells are drawn instead.
|
|
390
|
+
*/
|
|
391
|
+
private updateCells3d;
|
|
392
|
+
/**
|
|
393
|
+
* In the spatial views (2D and 3D), the spatial panel's Regions switch (`showAnnotations`, off by
|
|
394
|
+
* default) is every class's in the Region Editor's list, as their eyes are: off, every class is
|
|
395
|
+
* hidden (the drawn regions' and the dataset region set's cell types alike: their regions in 2D,
|
|
396
|
+
* their surfaces in 3D, and the eyes show it); on again, every class is shown. Applied when the
|
|
397
|
+
* switch changes, or on entering a spatial view with it off (so by default), so a class hidden or
|
|
398
|
+
* shown by its own eye meanwhile stays as it was set.
|
|
399
|
+
*/
|
|
400
|
+
private syncAnnotations;
|
|
401
|
+
/**
|
|
402
|
+
* Every class the Region Editor lists for the image: the dataset region set's, those shown in 3D,
|
|
403
|
+
* the drawn regions', and any hidden now.
|
|
404
|
+
*/
|
|
405
|
+
private knownClasses;
|
|
406
|
+
/**
|
|
407
|
+
* The Cells panel's boundary set that is the dataset's region set (the one naming it as its
|
|
408
|
+
* `regionSource`), while its planes are shown on the plotted image with its source still the
|
|
409
|
+
* store's; null otherwise.
|
|
410
|
+
*/
|
|
411
|
+
private planeCellSet;
|
|
412
|
+
/**
|
|
413
|
+
* While the dataset region set's planes are shown, the Cells panel draws each plane's cells from
|
|
414
|
+
* it (its boundary set, see `CellLayers.setPlane`):
|
|
415
|
+
* - that set is the panel's boundaries by default: a view that has not chosen a set (none yet, or
|
|
416
|
+
* after a reset) is given it;
|
|
417
|
+
* - in the 2D spatial view, while the panel draws them, the overlays do not draw the same
|
|
418
|
+
* outlines a second time (`RegionStore.setRegionSourceDrawn`). They stay listed and editable
|
|
419
|
+
* in the Region Editor, and are drawn by the overlays everywhere else.
|
|
420
|
+
*/
|
|
421
|
+
private updatePlaneCells;
|
|
422
|
+
/**
|
|
423
|
+
* In spatial 3D, with the dataset's region set placed there: show each of its classes in 3D, in
|
|
424
|
+
* its colour, once per image, unless classes are shown already (the region editor's choice
|
|
425
|
+
* stands, and hiding them all stays hidden).
|
|
426
|
+
*/
|
|
427
|
+
private showDatasetRegionSet3d;
|
|
302
428
|
/** Empty every slice of a stack (its regions and undo history) for regions imported over it. */
|
|
303
429
|
private enterImportedStack;
|
|
304
430
|
getRegionSourceView$(): Observable<RegionSourceView | null>;
|
|
@@ -462,6 +588,8 @@ export declare class RoutingVisualizerService implements IVisualizer, IRegionEdi
|
|
|
462
588
|
/** Displayed slice. Only a volume-backed spatial dataset reads it, to keep a
|
|
463
589
|
* region drawn over one section from selecting the whole depth behind it. */
|
|
464
590
|
private currentZIndex;
|
|
591
|
+
/** The slice shown, the plot type or the dataset's planes changed (the spatial controls recount). */
|
|
592
|
+
private readonly spatialViewChanged$;
|
|
465
593
|
/** Angular calls this when the injector providing the router is destroyed — the host
|
|
466
594
|
* component for a `provideVisualization()` chain. The dataset subscription would
|
|
467
595
|
* otherwise keep the whole isolated chain reachable from the root data port. */
|
|
@@ -497,3 +625,14 @@ export declare class RoutingVisualizerService implements IVisualizer, IRegionEdi
|
|
|
497
625
|
static ɵfac: i0.ɵɵFactoryDeclaration<RoutingVisualizerService, [null, null, null, null, null, null, null, null, { optional: true; }]>;
|
|
498
626
|
static ɵprov: i0.ɵɵInjectableDeclaration<RoutingVisualizerService>;
|
|
499
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* A region set's classes as 3D groups, as the region editor's class tree shows them: one per root of
|
|
630
|
+
* its hierarchy with every class under it (one per class of a flat one), in the hierarchy's order;
|
|
631
|
+
* without a hierarchy, one per class its features have. Each in the colour the set gives it (its
|
|
632
|
+
* hierarchy's, else its features').
|
|
633
|
+
*/
|
|
634
|
+
export declare function regionSetGroups(info: RegionSourceInfo): Array<{
|
|
635
|
+
key: string;
|
|
636
|
+
classes: string[];
|
|
637
|
+
color: string;
|
|
638
|
+
}>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SpatialViewState } from '../contracts/display-types';
|
|
2
|
+
import type { SpatialDataPort } from '../contracts/ports/spatial-data.port';
|
|
3
|
+
import { type SpatialDataset } from '../contracts/spatial-dataset.contract';
|
|
4
|
+
/**
|
|
5
|
+
* The observations of a selection (a mask), described: how many, by the grouping they are coloured
|
|
6
|
+
* by (else the cell types), the mean of a few measurements — or, for one cell, its id, its groups
|
|
7
|
+
* and its values. Pure but for the port's columns (cached by it).
|
|
8
|
+
*/
|
|
9
|
+
/** At most this many measurements (continuous columns) are given. */
|
|
10
|
+
export declare const OBSERVATION_DETAIL_COLUMNS = 6;
|
|
11
|
+
/** One group's observations in the selection. */
|
|
12
|
+
export interface GroupCount {
|
|
13
|
+
name: string;
|
|
14
|
+
count: number;
|
|
15
|
+
/** The group's colour, as the legend shows it. */
|
|
16
|
+
color: string;
|
|
17
|
+
}
|
|
18
|
+
/** What {@link describeObservations} finds. */
|
|
19
|
+
export interface ObservationsDescription {
|
|
20
|
+
total: number;
|
|
21
|
+
/** The grouping the observations are counted by, or null when the dataset has none. */
|
|
22
|
+
groupColumn: string | null;
|
|
23
|
+
/** Groups by count, most first (empty groups left out). */
|
|
24
|
+
groups: GroupCount[];
|
|
25
|
+
/**
|
|
26
|
+
* A few measurements: the mean over the selection (`mean` true), or one cell's own values. With
|
|
27
|
+
* one cell, its other groupings come first, as text.
|
|
28
|
+
*/
|
|
29
|
+
measures: {
|
|
30
|
+
name: string;
|
|
31
|
+
value: string | number;
|
|
32
|
+
unit?: string;
|
|
33
|
+
mean: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
/** The one cell's id, when the selection is one cell. */
|
|
36
|
+
cellId?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Describe the observations `mask` selects (see {@link ObservationsDescription}): counted by the
|
|
40
|
+
* categorical column the view colours by, else the cell-type column; at most `maxMeasures`
|
|
41
|
+
* continuous columns averaged (or read, for one cell).
|
|
42
|
+
*/
|
|
43
|
+
export declare function describeObservations(port: Pick<SpatialDataPort, 'getColumn'>, dataset: SpatialDataset, view: Pick<SpatialViewState, 'colorBy' | 'cellTypeColumn' | 'groupColors'>, mask: Uint8Array, maxMeasures?: number): Promise<ObservationsDescription>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SpatialImageRef, SpatialObservations, SpatialPolygonTile } from '../contracts/spatial-dataset.contract';
|
|
2
|
+
import type { TileFeature } from '../region-source/region-tiles';
|
|
3
|
+
/** Each observation's index by its id, or null when the observations carry no ids. */
|
|
4
|
+
export declare function observationIndex(obs: SpatialObservations): Map<string, number> | null;
|
|
5
|
+
/** A feature's cell id: its id without the slice a folder region set qualifies it with. */
|
|
6
|
+
export declare function cellIdOf(featureId: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* The rings of `tiles`' features (each once, though a feature is in every tile it meets), owned by
|
|
9
|
+
* their cells, in observation units (the region set's are the image's pixels: back through `ref`).
|
|
10
|
+
* A feature of no observation, and an open one (a polyline), is left out; each ring of a feature
|
|
11
|
+
* (its parts and holes) is a ring of its cell.
|
|
12
|
+
*/
|
|
13
|
+
export declare function planeCellRings(tiles: readonly {
|
|
14
|
+
features: readonly TileFeature[];
|
|
15
|
+
}[], index: ReadonlyMap<string, number>, ref: SpatialImageRef | null | undefined): SpatialPolygonTile;
|
|
16
|
+
/** One plane's tiles of a region set: the plane's slice index (its place among the set's planes). */
|
|
17
|
+
export interface PlaneTiles {
|
|
18
|
+
slice: number;
|
|
19
|
+
tiles: readonly {
|
|
20
|
+
features: readonly TileFeature[];
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Each cell's outlines on every plane it spans, from the planes' tiles (a feature once, though in
|
|
25
|
+
* every tile it meets), for the 3D reconstruction of each cell by itself (`CellOutlines`, slice k
|
|
26
|
+
* at z = k). Only cells of `classes` (all when null), whose outlines' centre over all planes is in
|
|
27
|
+
* `within` (`[x0, y0, x1, y1]`, image px; anywhere when absent): the tiles fetched for an area hold
|
|
28
|
+
* the cells crossing its edge too, which belong to the area their centre is in.
|
|
29
|
+
*/
|
|
30
|
+
export declare function cellOutlinesFromTiles(planes: readonly PlaneTiles[], index: ReadonlyMap<string, number>, classes: ReadonlySet<string> | null, within?: readonly [number, number, number, number]): {
|
|
31
|
+
cell: number;
|
|
32
|
+
label: string | null;
|
|
33
|
+
slices: {
|
|
34
|
+
z: number;
|
|
35
|
+
rings: Float32Array[];
|
|
36
|
+
}[];
|
|
37
|
+
}[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Cells3dStatus } from '../contracts/display-types';
|
|
1
2
|
import { Observable } from 'rxjs';
|
|
2
3
|
import { PlotType } from '../contracts/plot-type';
|
|
3
4
|
import { SpatialDataPort } from '../contracts/ports/spatial-data.port';
|
|
@@ -27,6 +28,9 @@ export interface SpatialRendererFeeds {
|
|
|
27
28
|
readonly geneFilterFailed$?: {
|
|
28
29
|
asObservable(): Observable<boolean>;
|
|
29
30
|
};
|
|
31
|
+
readonly cells3dStatus$?: {
|
|
32
|
+
asObservable(): Observable<Cells3dStatus | null>;
|
|
33
|
+
};
|
|
30
34
|
/** Observations projected to canvas pixels by the 3D camera, or null when the cloud is not mounted. */
|
|
31
35
|
getSpatialScreenProjection(obs: SpatialObservations): Float32Array | null;
|
|
32
36
|
/** The ids of the regions drawn over the 3D cloud in screen space (its lassos). */
|
|
@@ -45,6 +49,19 @@ export interface SpatialControlsContext {
|
|
|
45
49
|
plotType(): PlotType;
|
|
46
50
|
/** The displayed slice (a volume-backed dataset selects within one section). */
|
|
47
51
|
zIndex(): number;
|
|
52
|
+
/**
|
|
53
|
+
* The dataset region set's planes while they slice an image of one plane (see the router's
|
|
54
|
+
* `getDatasetPlanes$`): the slice is then one of them, and a region selects within it. Optional.
|
|
55
|
+
*/
|
|
56
|
+
planes?(): readonly number[] | null;
|
|
57
|
+
/**
|
|
58
|
+
* The dataset region set's planes (its `sliceZ`), whether or not they slice the image (a stack of
|
|
59
|
+
* as many planes is sliced by its own slices): the 2D view shows plane `zIndex()`'s transcripts.
|
|
60
|
+
* Optional.
|
|
61
|
+
*/
|
|
62
|
+
slicePlanes?(): readonly number[] | null;
|
|
63
|
+
/** Emits when the plot type, the slice shown or the dataset's planes change. Optional. */
|
|
64
|
+
readonly viewChanged$?: Observable<unknown>;
|
|
48
65
|
}
|
|
49
66
|
/**
|
|
50
67
|
* The spatial-omics controls (`ISpatialControls`) over a host's `SPATIAL_DATA_PORT`.
|
|
@@ -77,5 +94,47 @@ export declare class SpatialControlsFacade {
|
|
|
77
94
|
* in its grid; by the drawn regions otherwise.
|
|
78
95
|
*/
|
|
79
96
|
private roiSelectionMode;
|
|
97
|
+
/**
|
|
98
|
+
* The selections the "in selection" lists follow, as they change: the latest of three, as the user
|
|
99
|
+
* made them — the selected cells (a cell clicked, a legend group, a brush), the classes picked in
|
|
100
|
+
* the region editor (in spatial 3D the cell types of the type surfaces), or the regions selected on
|
|
101
|
+
* the image (2D only). Clearing the latest goes back to the one before, when it still stands. Emits
|
|
102
|
+
* (debounced) the sources standing, latest last, whenever the selection, the regions, the plane
|
|
103
|
+
* shown, the plot type, the dataset or `viewKey` of the view state change.
|
|
104
|
+
*/
|
|
105
|
+
private selectionChanges$;
|
|
106
|
+
/**
|
|
107
|
+
* `work` as a stream: what it reports through `progress`, then its answer (or `failed`'s message);
|
|
108
|
+
* unsubscribing abandons it (`cancelled()` then says so).
|
|
109
|
+
*/
|
|
110
|
+
private runCancellable;
|
|
111
|
+
/**
|
|
112
|
+
* What the latest selection in `active` is (see {@link selectionChanges$}), and where it applies:
|
|
113
|
+
* through the whole volume in spatial 3D; on the plane shown in 2D when the dataset's planes slice
|
|
114
|
+
* it and what is listed carries z (`hasZ`). `what` names what is listed, for the hints.
|
|
115
|
+
*/
|
|
116
|
+
private resolveSelection;
|
|
117
|
+
/** The transcripts of the selection, by gene (see {@link selectionChanges$}). */
|
|
118
|
+
private transcriptsInSelection$;
|
|
119
|
+
/**
|
|
120
|
+
* Count the transcripts of the latest selection in `active`: through the whole volume in spatial
|
|
121
|
+
* 3D, on the plane shown in 2D when the dataset's planes slice it.
|
|
122
|
+
*/
|
|
123
|
+
private transcriptsOf;
|
|
124
|
+
/** The observations of the selection, by group (see {@link selectionChanges$}). */
|
|
125
|
+
private observationsInSelection$;
|
|
126
|
+
/**
|
|
127
|
+
* The observations of the latest selection in `active`, by the grouping the observations are
|
|
128
|
+
* coloured by (else the cell types): every one in spatial 3D; in 2D, those on the plane shown when
|
|
129
|
+
* the dataset's planes slice it. One cell is described too: its id and its values.
|
|
130
|
+
*/
|
|
131
|
+
private observationsOf;
|
|
132
|
+
/**
|
|
133
|
+
* The categorical column the picked classes are cell types of: the dataset's cell-type column
|
|
134
|
+
* when it holds any of them, else the first categorical column that does; null when none does.
|
|
135
|
+
*/
|
|
136
|
+
private cellTypeColumnOf;
|
|
137
|
+
/** How far from a cell's centre its transcripts are looked for, in observation units. */
|
|
138
|
+
private cellReach;
|
|
80
139
|
private build;
|
|
81
140
|
}
|
|
@@ -33,7 +33,10 @@ export declare const DEFAULT_MUTED_OPACITY = 0.15;
|
|
|
33
33
|
* Fallback categorical palette. Colour-blind-safe and stable, so a category
|
|
34
34
|
* without an authored colour still lands somewhere sensible and lands there
|
|
35
35
|
* every run (`fallbackColorFor` hashes the name — same name, same colour).
|
|
36
|
-
* Okabe–Ito
|
|
36
|
+
* Okabe–Ito and three greys, then twelve more (Tol's muted, a few of Paired), so a grouping of up
|
|
37
|
+
* to 22 groups (the MERFISH ileum's 20 cell types) has no two alike; the first ten come first, so a
|
|
38
|
+
* grouping of ten or fewer keeps its colours. jit-bioformats' `SegmentationRegionSet.PALETTE` (a 3D
|
|
39
|
+
* segmentation's region set, coloured at conversion) must stay this, colour for colour.
|
|
37
40
|
*/
|
|
38
41
|
export declare const DEFAULT_CATEGORICAL_PALETTE: string[];
|
|
39
42
|
interface MuteOptions {
|
|
@@ -73,6 +76,16 @@ export declare function parseHex(hex: string): Rgb;
|
|
|
73
76
|
* 40-cluster column still gets stable, distinct-ish colours.
|
|
74
77
|
*/
|
|
75
78
|
export declare function resolveCategoryColors(meta: CategoricalColumnMeta, palette?: string[]): string[];
|
|
79
|
+
/** The user's group colours: by column name, then category (see `SpatialViewState.groupColors`). */
|
|
80
|
+
export type GroupColorOverrides = Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
81
|
+
/**
|
|
82
|
+
* Categorical column `column`'s colours ({@link resolveCategoryColors}) with the user's choices
|
|
83
|
+
* for its groups over them. Every place a grouping is coloured goes through this, so a group
|
|
84
|
+
* recoloured in the list is that colour on the cells, the markers, the legend and the charts.
|
|
85
|
+
*/
|
|
86
|
+
export declare function categoryColorsFor(column: string, meta: CategoricalColumnMeta, overrides?: GroupColorOverrides | null): string[];
|
|
87
|
+
/** What a cache keyed on a grouping's colours must include of the user's choices for it. */
|
|
88
|
+
export declare function groupColorsKey(column: string | null, overrides?: GroupColorOverrides | null): string;
|
|
76
89
|
/** Categorical column → flat per-point RGBA (length `4 * codes.length`). */
|
|
77
90
|
export declare function encodeCategorical(codes: Uint16Array, opts: CategoricalEncodingOptions): Float32Array;
|
|
78
91
|
/** Continuous column / gene vector → flat per-point RGBA. */
|
|
@@ -119,4 +132,14 @@ export declare function isGrayscaleLut(lut: readonly Rgb[]): boolean;
|
|
|
119
132
|
* them can disagree about what a colour means, whichever way the choice falls.
|
|
120
133
|
*/
|
|
121
134
|
export declare function spatialContinuousLut(colormapValue: unknown, reverse?: boolean, override?: ColormapValue | null): Rgb[];
|
|
135
|
+
/**
|
|
136
|
+
* Fade the transcripts outside a selection, as the cells and markers are: while `selected` (an
|
|
137
|
+
* observation mask) selects any cell, every packed-RGBA entry of `rgba` whose cell (`ownerOf(i)`)
|
|
138
|
+
* is not selected, or that is in no cell, has its alpha scaled to {@link DEFAULT_MUTED_OPACITY}.
|
|
139
|
+
* The selection's own transcripts keep their colour. Nothing changes without a selection.
|
|
140
|
+
*/
|
|
141
|
+
export declare function fadeOutsideSelection(rgba: Float32Array, count: number, ownerOf: (i: number) => number, selected: {
|
|
142
|
+
mask: Uint8Array;
|
|
143
|
+
count: number;
|
|
144
|
+
} | null): void;
|
|
122
145
|
export {};
|
|
@@ -35,3 +35,26 @@ export type HoverSource = {
|
|
|
35
35
|
* cell whose annotation is genuinely missing.
|
|
36
36
|
*/
|
|
37
37
|
export declare function hoverText(source: HoverSource | null, index: number): string[] | null;
|
|
38
|
+
/**
|
|
39
|
+
* What the 3D view says of a cell under the pointer (a 3D segmentation's, drawn by itself or as
|
|
40
|
+
* its type's surface): its type (the cell-type column), its id, and a few of its measurements.
|
|
41
|
+
*/
|
|
42
|
+
export interface CellInfo {
|
|
43
|
+
/** The cell-type column, its categories and each observation's code (null without one). */
|
|
44
|
+
typeName: string | null;
|
|
45
|
+
categories: readonly string[];
|
|
46
|
+
codes: Uint16Array | null;
|
|
47
|
+
/** Cells per category, by code. */
|
|
48
|
+
counts: Uint32Array | null;
|
|
49
|
+
ids?: readonly string[];
|
|
50
|
+
/** Measurements shown (the dataset's continuous columns, a few). */
|
|
51
|
+
measures: readonly {
|
|
52
|
+
name: string;
|
|
53
|
+
values: Float32Array;
|
|
54
|
+
unit?: string;
|
|
55
|
+
}[];
|
|
56
|
+
}
|
|
57
|
+
/** The tooltip of cell `index`: its type, its id, the colouring's value (when not the type), measurements. */
|
|
58
|
+
export declare function cellText(info: CellInfo | null, index: number, color: HoverSource | null): string[] | null;
|
|
59
|
+
/** The tooltip of a cell type's surface: its name (and title), and how many cells it has. */
|
|
60
|
+
export declare function cellTypeText(info: CellInfo | null, key: string, label?: string): string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SpatialObservations } from '../contracts/spatial-dataset.contract';
|
|
2
|
+
/**
|
|
3
|
+
* The planes a spatial dataset's region set was outlined on (its `sliceZ`, in observation units,
|
|
4
|
+
* one per slice in slice order), as the 2D view slices them over an image of one plane: plane `k`
|
|
5
|
+
* holds whatever lies nearer to it than to its neighbours, so each z belongs to exactly one plane
|
|
6
|
+
* and the planes together hold the whole depth.
|
|
7
|
+
*
|
|
8
|
+
* Pure, like `spatial-sections.ts` (which offers a sectioned dataset's own z values; these are the
|
|
9
|
+
* planes its segmentation was imaged at).
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The z band of plane `k`: from halfway to the plane before to halfway to the one after (open
|
|
13
|
+
* ended past the first and the last). The planes may run either way; `[lo, hi)` comes out ordered.
|
|
14
|
+
*/
|
|
15
|
+
export declare function planeBand(planes: readonly number[], k: number): [number, number];
|
|
16
|
+
/** Whether `z` lies in `band` (`[lo, hi)`; a non-finite z lies in none). */
|
|
17
|
+
export declare function inBand(z: number, band: readonly [number, number]): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Indices of the observations on plane `k` (see {@link planeBand}). Every observation is when the
|
|
20
|
+
* dataset carries no z: a flat dataset has nothing to slice.
|
|
21
|
+
*/
|
|
22
|
+
export declare function observationsOnPlane(obs: SpatialObservations, planes: readonly number[], k: number): Uint32Array;
|
|
@@ -42,8 +42,9 @@ export declare function mutedFromSelection(selection: SpatialSelectionMask): Uin
|
|
|
42
42
|
* the shared `geometry/ring` one the region overlays and tools use.
|
|
43
43
|
*/
|
|
44
44
|
export declare function pointInRing(xs: readonly number[], ys: readonly number[], px: number, py: number): boolean;
|
|
45
|
+
export declare function inBounds(b: Bounds, px: number, py: number): boolean;
|
|
45
46
|
/** A region flattened to something testable: bounds + a hit test. */
|
|
46
|
-
interface Shape {
|
|
47
|
+
export interface Shape {
|
|
47
48
|
bounds: Bounds;
|
|
48
49
|
hit(px: number, py: number): boolean;
|
|
49
50
|
}
|
|
@@ -40,6 +40,15 @@ export declare function filterTranscripts(t: SpatialTranscriptTile, px: Float32A
|
|
|
40
40
|
merged: SpatialTranscriptTile;
|
|
41
41
|
px: Float32Array;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* The transcripts of a tile whose z lies in `band` (`[lo, hi)`, see `planeBand`), with their
|
|
45
|
+
* marker sizes: the 2D view of one plane of a 3D assay. An aggregated entry stands for transcripts
|
|
46
|
+
* at several depths, so a tile of them is kept whole.
|
|
47
|
+
*/
|
|
48
|
+
export declare function transcriptsInBand(t: SpatialTranscriptTile, px: Float32Array, band: readonly [number, number]): {
|
|
49
|
+
merged: SpatialTranscriptTile;
|
|
50
|
+
px: Float32Array;
|
|
51
|
+
};
|
|
43
52
|
/** The median of `v`, from a sample of about 1024 values. */
|
|
44
53
|
export declare function median(v: Float32Array): number;
|
|
45
54
|
/** Concatenate tiles' rings into one set, dropping rings already seen (a cell straddling
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { SpatialDataPort } from '../contracts/ports/spatial-data.port';
|
|
2
|
+
import { type SpatialBounds, type SpatialImageRef, type SpatialObservations, type SpatialTileLevel } from '../contracts/spatial-dataset.contract';
|
|
3
|
+
import type { TileKey } from './lod';
|
|
4
|
+
import { type Shape } from './spatial-selection';
|
|
5
|
+
/**
|
|
6
|
+
* The transcripts of a selection, by gene: the molecules of the selected cells (each transcript
|
|
7
|
+
* tile names the cell every molecule lies in), or those inside drawn regions — over the whole depth
|
|
8
|
+
* (spatial 3D) or on one plane (the 2D view of a sliced dataset).
|
|
9
|
+
*
|
|
10
|
+
* Read from the finest level of the transcript pyramid, every gene (`ALL_GENES`), and only the
|
|
11
|
+
* tiles the selection touches: a cell's transcripts lie near it, a region's inside its bounds.
|
|
12
|
+
* Pure but for the port; the facade decides what is selected.
|
|
13
|
+
*/
|
|
14
|
+
/** At most this many tiles are read for one list; a selection spanning more is counted in part. */
|
|
15
|
+
export declare const TRANSCRIPT_LIST_MAX_TILES = 2048;
|
|
16
|
+
/** About this many transcripts at most are read for one list (estimated from the dataset's mean). */
|
|
17
|
+
export declare const TRANSCRIPT_LIST_MAX_TRANSCRIPTS = 20000000;
|
|
18
|
+
/**
|
|
19
|
+
* How far from a cell's centre its transcripts are looked for, in microns: past the largest cells'
|
|
20
|
+
* reach (a cell's molecules lie inside its outline; Baysor cells of the ileum are up to ~25 µm).
|
|
21
|
+
*/
|
|
22
|
+
export declare const CELL_REACH_MICRONS = 30;
|
|
23
|
+
/**
|
|
24
|
+
* How many level-0 tiles one list may read: {@link TRANSCRIPT_LIST_MAX_TILES}, fewer when the
|
|
25
|
+
* dataset's tiles are dense (its transcripts over the tiles of its bounds), so that about
|
|
26
|
+
* {@link TRANSCRIPT_LIST_MAX_TRANSCRIPTS} are read at most — a whole cell type of a sparse section
|
|
27
|
+
* is read whole, of a dense one in part.
|
|
28
|
+
*/
|
|
29
|
+
export declare function tileBudget(meta: {
|
|
30
|
+
bounds: SpatialBounds;
|
|
31
|
+
count?: number;
|
|
32
|
+
levels: readonly SpatialTileLevel[];
|
|
33
|
+
}): number;
|
|
34
|
+
/** One gene's transcripts in the selection. */
|
|
35
|
+
export interface GeneCount {
|
|
36
|
+
name: string;
|
|
37
|
+
count: number;
|
|
38
|
+
}
|
|
39
|
+
/** What {@link countTranscripts} found. */
|
|
40
|
+
export interface TranscriptCount {
|
|
41
|
+
total: number;
|
|
42
|
+
/** Distinct cells the counted transcripts lie in (those in no cell are not counted here). */
|
|
43
|
+
cells: number;
|
|
44
|
+
/** Genes by count, most first. */
|
|
45
|
+
genes: GeneCount[];
|
|
46
|
+
/** Some tiles could not be read (or were left out): the counts are a lower bound. */
|
|
47
|
+
partial: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Which transcripts count: those of these cells, or those inside these shapes (image px). */
|
|
50
|
+
export type TranscriptFilter = {
|
|
51
|
+
kind: 'cells';
|
|
52
|
+
mask: Uint8Array;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'shapes';
|
|
55
|
+
shapes: readonly Shape[];
|
|
56
|
+
imageRef?: SpatialImageRef;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Level-0 tiles within `reach` of the selected cells' centres (observation units), clipped to
|
|
60
|
+
* `bounds`. When there are more than `max`, those holding the most selected cells are kept and
|
|
61
|
+
* `partial` says so.
|
|
62
|
+
*/
|
|
63
|
+
export declare function tilesAroundCells(obs: SpatialObservations, mask: Uint8Array, reach: number, levels: readonly SpatialTileLevel[], bounds: SpatialBounds | null | undefined, max?: number): {
|
|
64
|
+
tiles: TileKey[];
|
|
65
|
+
partial: boolean;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Level-0 tiles under `shapes` (image px, mapped to observation units through `imageRef`), clipped
|
|
69
|
+
* to `bounds`; at most `max`, the most covered first.
|
|
70
|
+
*/
|
|
71
|
+
export declare function tilesUnderShapes(shapes: readonly Shape[], imageRef: SpatialImageRef | undefined, levels: readonly SpatialTileLevel[], bounds: SpatialBounds | null | undefined, max?: number): {
|
|
72
|
+
tiles: TileKey[];
|
|
73
|
+
partial: boolean;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Count the transcripts of `tiles` (level 0, every gene) that pass `filter` and, when given, lie in
|
|
77
|
+
* the z `band`, by gene (`names` are the dataset's genes by code, `transcriptTiles.genes`).
|
|
78
|
+
* Resolves null once `cancelled()` says so; a tile that fails to load leaves the count partial.
|
|
79
|
+
*/
|
|
80
|
+
export declare function countTranscripts(opts: {
|
|
81
|
+
port: SpatialDataPort;
|
|
82
|
+
tiles: readonly TileKey[];
|
|
83
|
+
quality: 'high' | 'all';
|
|
84
|
+
filter: TranscriptFilter;
|
|
85
|
+
band?: readonly [number, number] | null;
|
|
86
|
+
names?: readonly string[] | null;
|
|
87
|
+
cancelled?: () => boolean;
|
|
88
|
+
/** Tiles left out before counting (see {@link tilesAroundCells}). */
|
|
89
|
+
partial?: boolean;
|
|
90
|
+
}): Promise<TranscriptCount | null>;
|
|
91
|
+
/** The cells of `categories` (names) in a categorical column's `codes`, as a selection mask. */
|
|
92
|
+
export declare function cellsOfCategories(codes: ArrayLike<number>, categories: readonly string[], names: readonly string[]): {
|
|
93
|
+
mask: Uint8Array;
|
|
94
|
+
count: number;
|
|
95
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OnChanges, SimpleChanges } from '@angular/core';
|
|
2
2
|
import type { ISpatialControls } from '../../contracts/visualizer.contract';
|
|
3
3
|
import type { SpatialDataset } from '../../contracts/spatial-dataset.contract';
|
|
4
|
-
import { SpatialViewState } from '../../contracts/display-types';
|
|
4
|
+
import { SpatialViewState, Cells3dStatus } from '../../contracts/display-types';
|
|
5
5
|
import { PanelOption } from '../../spatial/spatial-panel-model';
|
|
6
|
-
import type { GenePickerModel } from '../spatial-gene-picker';
|
|
7
6
|
import * as i0 from "@angular/core";
|
|
8
7
|
/**
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* The Observations section's "Cell segmentations" part (projected into it), shown while the
|
|
9
|
+
* observations are shown as cells: which boundary sets are drawn and how the cells are drawn (fill,
|
|
10
|
+
* outline, opacity), or in 3D, by cell type or each by itself. Their colour is the section's
|
|
11
|
+
* shared "Colour by", the markers' too.
|
|
12
12
|
*
|
|
13
13
|
* Writes only through `controls.setViewState`.
|
|
14
14
|
*/
|
|
@@ -19,19 +19,18 @@ export declare class SpatialCellsPanelComponent implements OnChanges {
|
|
|
19
19
|
dataset: SpatialDataset | null;
|
|
20
20
|
/** The current spatial view state: what is drawn, and how. */
|
|
21
21
|
view: SpatialViewState;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
readonly
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
protected readonly geneVirtualScrollFrom = 200;
|
|
22
|
+
/**
|
|
23
|
+
* In the 3D view: the cells are a 3D segmentation's, drawn by cell type or each by itself, and
|
|
24
|
+
* the 2D boundaries and draw mode do not apply.
|
|
25
|
+
*/
|
|
26
|
+
is3d: boolean;
|
|
27
|
+
/** The 3D view's individual cells as they stand (null: none drawn). */
|
|
28
|
+
cells3dStatus: Cells3dStatus | null;
|
|
29
|
+
/** How the 3D view draws the cells: one surface per cell type, or each cell by itself. */
|
|
30
|
+
protected readonly cells3dOptions: PanelOption<SpatialViewState['cells3d']>[];
|
|
31
|
+
protected onCells3d(mode: SpatialViewState['cells3d']): void;
|
|
32
|
+
/** What the 3D cells' status line says, or null. */
|
|
33
|
+
protected get cells3dHint(): string | null;
|
|
35
34
|
protected readonly cellDrawOptions: PanelOption<SpatialViewState['cellDraw']>[];
|
|
36
35
|
/**
|
|
37
36
|
* Option lists for the cell controls. Built once per dataset rather than in getters: a
|
|
@@ -48,11 +47,6 @@ export declare class SpatialCellsPanelComponent implements OnChanges {
|
|
|
48
47
|
name: string;
|
|
49
48
|
label: string;
|
|
50
49
|
}[];
|
|
51
|
-
/** Cell colour modes on offer (Xenium Explorer's "Cell Color"). */
|
|
52
|
-
protected cellColorOptions: PanelOption<SpatialViewState['cellColorMode']>[];
|
|
53
|
-
/** The density colour bar, rebuilt only when its colormap changes (a 256-entry LUT). */
|
|
54
|
-
protected densityColorBarCss: string;
|
|
55
|
-
private densityBarFor;
|
|
56
50
|
ngOnChanges(changes: SimpleChanges): void;
|
|
57
51
|
/** Whether outlines are on — the explicit choice, or automatically for data that has them. */
|
|
58
52
|
protected get cellsOn(): boolean;
|
|
@@ -73,9 +67,6 @@ export declare class SpatialCellsPanelComponent implements OnChanges {
|
|
|
73
67
|
protected onCellDraw(draw: SpatialViewState['cellDraw']): void;
|
|
74
68
|
protected onCellOpacity(value: number | undefined): void;
|
|
75
69
|
protected onCellOpacityPercent(v: number | null): void;
|
|
76
|
-
protected onCellColorMode(mode: SpatialViewState['cellColorMode']): void;
|
|
77
|
-
protected onCellColorGene(gene: string | null): void;
|
|
78
|
-
protected onCellSingleColor(hex: string): void;
|
|
79
70
|
static ɵfac: i0.ɵɵFactoryDeclaration<SpatialCellsPanelComponent, never>;
|
|
80
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SpatialCellsPanelComponent, "spatial-cells-panel", never, { "controls": { "alias": "controls"; "required": false; }; "dataset": { "alias": "dataset"; "required": false; }; "view": { "alias": "view"; "required": false; }; "
|
|
71
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SpatialCellsPanelComponent, "spatial-cells-panel", never, { "controls": { "alias": "controls"; "required": false; }; "dataset": { "alias": "dataset"; "required": false; }; "view": { "alias": "view"; "required": false; }; "is3d": { "alias": "is3d"; "required": false; }; "cells3dStatus": { "alias": "cells3dStatus"; "required": false; }; }, {}, never, never, true, never>;
|
|
81
72
|
}
|