@jax-data-science/sci-image-visualizer 0.9.0 → 0.10.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/index.mjs +7 -1
- package/esm2022/lib/contracts/image.contract.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/section-view.contract.mjs +2 -0
- package/esm2022/lib/contracts/visualizer.contract.mjs +1 -1
- package/esm2022/lib/contracts/viz-config.mjs +1 -1
- package/esm2022/lib/geometry/loft.mjs +128 -0
- package/esm2022/lib/geometry/polylabel.mjs +156 -0
- package/esm2022/lib/geometry/reconstruct.mjs +315 -0
- package/esm2022/lib/geometry/reslice-image.mjs +57 -0
- package/esm2022/lib/geometry/section.mjs +215 -0
- package/esm2022/lib/implementations/napari-js/napari-loading-badge.mjs +11 -7
- package/esm2022/lib/implementations/napari-js/napari-loading-state.mjs +20 -3
- package/esm2022/lib/implementations/napari-js/napari-region-mesh-pointer.mjs +100 -0
- package/esm2022/lib/implementations/napari-js/napari-region-overlay.mjs +28 -5
- package/esm2022/lib/implementations/napari-js/napari-scene.mjs +1 -1
- package/esm2022/lib/implementations/napari-js/napari-spatial-hover.mjs +9 -2
- package/esm2022/lib/implementations/napari-js/napari-tool-bridge.mjs +5 -2
- package/esm2022/lib/implementations/napari-js/napari-visualizer.service.mjs +81 -1
- package/esm2022/lib/implementations/napari-js/napari-volume-region-meshes.mjs +129 -0
- package/esm2022/lib/implementations/napari-js/napari-volume-scene.mjs +115 -4
- package/esm2022/lib/implementations/napari-js/napari-volume-slice-planes.mjs +103 -0
- package/esm2022/lib/implementations/napari-js/region-overlay/region-svg-renderer.mjs +15 -3
- package/esm2022/lib/implementations/osd/osd-region-overlay-draw.mjs +18 -7
- package/esm2022/lib/implementations/osd/osd-region-overlay.mjs +38 -8
- package/esm2022/lib/implementations/tile-server/tile-protocol.mjs +1 -1
- package/esm2022/lib/models/class-preset.mjs +1 -1
- package/esm2022/lib/models/polygon-factory.mjs +17 -1
- package/esm2022/lib/models/region-geojson.mjs +44 -6
- package/esm2022/lib/models/region.mjs +1 -1
- package/esm2022/lib/region-editor/class-tree/class-tree.component.mjs +156 -0
- package/esm2022/lib/region-editor/class-tree/class-tree.mjs +108 -0
- package/esm2022/lib/region-editor/classes-panel/classes-panel.component.mjs +77 -13
- package/esm2022/lib/region-editor/region-editor.component.mjs +527 -42
- package/esm2022/lib/region-editor/region-metrics.mjs +20 -2
- package/esm2022/lib/region-editor/region-persistence.service.mjs +36 -10
- package/esm2022/lib/region-editor/region-table/region-table.component.mjs +24 -8
- package/esm2022/lib/region-overlay/region-geometry.mjs +3 -3
- package/esm2022/lib/region-overlay/region-source-layer.mjs +378 -0
- package/esm2022/lib/region-overlay/region-style.mjs +97 -0
- package/esm2022/lib/region-source/http-region-source.mjs +104 -0
- package/esm2022/lib/region-source/region-source-ops.mjs +53 -0
- package/esm2022/lib/region-source/region-source-worker.mjs +10 -0
- package/esm2022/lib/region-source/region-source.mjs +67 -0
- package/esm2022/lib/region-source/region-tiles.mjs +708 -0
- package/esm2022/lib/region-source/worker-region-source.mjs +229 -0
- package/esm2022/lib/routing-visualizer.service.mjs +418 -22
- package/esm2022/lib/section-pane/section-pane.component.mjs +299 -0
- package/esm2022/lib/store/class-color.util.mjs +10 -5
- package/esm2022/lib/store/class-signatures.mjs +63 -0
- package/esm2022/lib/store/region-scope-cache.mjs +5 -1
- package/esm2022/lib/store/region-source-scope.mjs +171 -0
- package/esm2022/lib/store/region-store.service.mjs +724 -12
- package/esm2022/lib/store/visualizer-store.service.mjs +33 -6
- package/esm2022/lib/toolbar/region-tools/region-tools.component.mjs +8 -2
- package/esm2022/lib/toolbar/stack-controls/stack-controls.component.mjs +55 -15
- package/esm2022/lib/toolbar/toolbar.component.mjs +19 -5
- package/esm2022/lib/visualizer/region-load.mjs +67 -4
- package/esm2022/lib/visualizer/volume-sections.mjs +175 -0
- package/esm2022/lib/visualizer.component.mjs +128 -6
- package/fesm2022/{jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-Csxlnq7I.mjs → jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-BKQhpbHv.mjs} +7239 -1153
- package/fesm2022/jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-BKQhpbHv.mjs.map +1 -0
- package/fesm2022/{jax-data-science-sci-image-visualizer-onnx-sam-session-Bkujqg7m.mjs → jax-data-science-sci-image-visualizer-onnx-sam-session-z1IN-F7w.mjs} +4 -4
- package/fesm2022/{jax-data-science-sci-image-visualizer-onnx-sam-session-Bkujqg7m.mjs.map → jax-data-science-sci-image-visualizer-onnx-sam-session-z1IN-F7w.mjs.map} +1 -1
- package/fesm2022/jax-data-science-sci-image-visualizer-region-source-worker-CAqBjM5L.mjs +12 -0
- package/fesm2022/jax-data-science-sci-image-visualizer-region-source-worker-CAqBjM5L.mjs.map +1 -0
- package/fesm2022/jax-data-science-sci-image-visualizer.mjs +3 -3
- package/fesm2022/region-source.worker.js +1067 -0
- package/index.d.ts +6 -0
- package/lib/contracts/image.contract.d.ts +4 -0
- package/lib/contracts/region-editor-api.contract.d.ts +84 -0
- package/lib/contracts/region-store.contract.d.ts +22 -0
- package/lib/contracts/section-view.contract.d.ts +44 -0
- package/lib/contracts/visualizer.contract.d.ts +10 -0
- package/lib/contracts/viz-config.d.ts +8 -0
- package/lib/geometry/loft.d.ts +22 -0
- package/lib/geometry/polylabel.d.ts +23 -0
- package/lib/geometry/reconstruct.d.ts +54 -0
- package/lib/geometry/reslice-image.d.ts +33 -0
- package/lib/geometry/section.d.ts +52 -0
- package/lib/implementations/napari-js/napari-loading-badge.d.ts +4 -2
- package/lib/implementations/napari-js/napari-loading-state.d.ts +8 -1
- package/lib/implementations/napari-js/napari-region-mesh-pointer.d.ts +32 -0
- package/lib/implementations/napari-js/napari-region-overlay.d.ts +6 -1
- package/lib/implementations/napari-js/napari-scene.d.ts +33 -0
- package/lib/implementations/napari-js/napari-spatial-hover.d.ts +3 -1
- package/lib/implementations/napari-js/napari-visualizer.service.d.ts +48 -0
- package/lib/implementations/napari-js/napari-volume-region-meshes.d.ts +66 -0
- package/lib/implementations/napari-js/napari-volume-scene.d.ts +45 -1
- package/lib/implementations/napari-js/napari-volume-slice-planes.d.ts +43 -0
- package/lib/implementations/osd/osd-region-overlay-draw.d.ts +4 -3
- package/lib/implementations/osd/osd-region-overlay.d.ts +10 -3
- package/lib/implementations/tile-server/tile-protocol.d.ts +3 -0
- package/lib/models/class-preset.d.ts +7 -0
- package/lib/models/polygon-factory.d.ts +5 -0
- package/lib/models/region-geojson.d.ts +40 -0
- package/lib/models/region.d.ts +19 -0
- package/lib/region-editor/class-tree/class-tree.component.d.ts +78 -0
- package/lib/region-editor/class-tree/class-tree.d.ts +31 -0
- package/lib/region-editor/classes-panel/classes-panel.component.d.ts +36 -6
- package/lib/region-editor/region-editor.component.d.ts +133 -17
- package/lib/region-editor/region-metrics.d.ts +8 -0
- package/lib/region-editor/region-persistence.service.d.ts +12 -4
- package/lib/region-editor/region-table/region-table.component.d.ts +10 -4
- package/lib/region-overlay/region-geometry.d.ts +4 -3
- package/lib/region-overlay/region-source-layer.d.ts +96 -0
- package/lib/region-overlay/region-style.d.ts +52 -0
- package/lib/region-source/http-region-source.d.ts +45 -0
- package/lib/region-source/region-source-ops.d.ts +89 -0
- package/lib/region-source/region-source-worker.d.ts +7 -0
- package/lib/region-source/region-source.d.ts +82 -0
- package/lib/region-source/region-tiles.d.ts +289 -0
- package/lib/region-source/worker-region-source.d.ts +65 -0
- package/lib/routing-visualizer.service.d.ts +138 -1
- package/lib/section-pane/section-pane.component.d.ts +47 -0
- package/lib/store/class-color.util.d.ts +6 -3
- package/lib/store/class-signatures.d.ts +11 -0
- package/lib/store/region-scope-cache.d.ts +2 -0
- package/lib/store/region-source-scope.d.ts +68 -0
- package/lib/store/region-store.service.d.ts +206 -2
- package/lib/store/visualizer-store.service.d.ts +10 -0
- package/lib/toolbar/region-tools/region-tools.component.d.ts +3 -1
- package/lib/toolbar/stack-controls/stack-controls.component.d.ts +20 -9
- package/lib/toolbar/toolbar.component.d.ts +9 -2
- package/lib/visualizer/region-load.d.ts +23 -4
- package/lib/visualizer/volume-sections.d.ts +64 -0
- package/lib/visualizer.component.d.ts +31 -0
- package/package.json +2 -2
- package/src/lib/assets/slice.svg +23 -0
- package/fesm2022/jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-Csxlnq7I.mjs.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import type { IChannelState } from '../contracts/channel-histogram-api.contract';
|
|
3
|
+
import type { Colormap } from 'napari-js';
|
|
4
|
+
import type { SectionAxis, SectionViews } from '../contracts/section-view.contract';
|
|
5
|
+
import type { SliceOutlines } from '../geometry/reconstruct';
|
|
6
|
+
import type { VolumeVoxelsOnScreen } from '../implementations/napari-js/napari-scene';
|
|
7
|
+
import type { SlicePlanes } from '../implementations/napari-js/napari-volume-slice-planes';
|
|
8
|
+
/** What the sections are cut from and shown with. */
|
|
9
|
+
export interface VolumeSectionsDeps {
|
|
10
|
+
/** The volume on screen as assembled, or null (not a volume view, or not assembled yet). */
|
|
11
|
+
volume(): VolumeVoxelsOnScreen | null;
|
|
12
|
+
/** The image the volume is of: another one drops the outlines read and puts the planes back. */
|
|
13
|
+
image(): string | undefined;
|
|
14
|
+
/** Show the planes in the volume (null: hide one). */
|
|
15
|
+
showPlanes(planes: SlicePlanes): void;
|
|
16
|
+
/** Every class's outlines on every slice (see RegionStore.outlinesByClass). */
|
|
17
|
+
outlinesByClass(level: number): Promise<Map<string, SliceOutlines[]>>;
|
|
18
|
+
isClassHidden(label: string): boolean;
|
|
19
|
+
colorOf(label: string): string;
|
|
20
|
+
channelStates(): IChannelState[];
|
|
21
|
+
/** The colormap the 3D view draws a channel with: its tint in a multichannel volume, else the volume's. */
|
|
22
|
+
colormap(channel: IChannelState | undefined, multichannel: boolean): Colormap;
|
|
23
|
+
invert(): boolean;
|
|
24
|
+
/** The slice shown and edited. */
|
|
25
|
+
slice(): number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The sections beside a split volume view: the planes x = const and y = const (image px), each cut
|
|
29
|
+
* from the assembled volume as an image, displayed like the 2D view displays a slice (the channel
|
|
30
|
+
* windows, tints and invert), with every class's outlines cut by the same plane and the other two
|
|
31
|
+
* planes as a crosshair. Recut when a plane moves, the slice changes, the regions or their
|
|
32
|
+
* visibility change, the display changes or the volume is assembled again — once per frame at most.
|
|
33
|
+
*/
|
|
34
|
+
export declare class VolumeSections {
|
|
35
|
+
private readonly deps;
|
|
36
|
+
private readonly views$;
|
|
37
|
+
private open;
|
|
38
|
+
private planes;
|
|
39
|
+
/** The image the planes and outlines are of. */
|
|
40
|
+
private image;
|
|
41
|
+
/** Every class's outlines at a level, read and indexed once until the regions change. */
|
|
42
|
+
private outlines;
|
|
43
|
+
private scheduled;
|
|
44
|
+
/** Bumped per cut, so a cut that waited on the outlines is dropped when a newer one starts. */
|
|
45
|
+
private request;
|
|
46
|
+
constructor(deps: VolumeSectionsDeps);
|
|
47
|
+
/** Both sections as they are cut; nulls while closed. */
|
|
48
|
+
getViews$(): Observable<SectionViews>;
|
|
49
|
+
/** Show the sections (their planes through the middle of the image at first). */
|
|
50
|
+
start(): void;
|
|
51
|
+
stop(): void;
|
|
52
|
+
/** Move a section's plane to `at` (image px; clamped into the image). */
|
|
53
|
+
setPlane(axis: SectionAxis, at: number): void;
|
|
54
|
+
/** The planes as they are (image px), the z plane being the slice. */
|
|
55
|
+
getPlanes(): SlicePlanes;
|
|
56
|
+
/** The regions changed (an edit): their outlines are read again, once the edits pause. */
|
|
57
|
+
regionsChanged(): void;
|
|
58
|
+
/** Something the sections show changed (the slice, the display, the visible classes, the volume). */
|
|
59
|
+
schedule(): void;
|
|
60
|
+
private cut;
|
|
61
|
+
private view;
|
|
62
|
+
/** The volume's channels as displayed now. */
|
|
63
|
+
private voxels;
|
|
64
|
+
}
|
|
@@ -26,6 +26,7 @@ import { RegionActions } from './visualizer/region-actions';
|
|
|
26
26
|
import { ToolModes } from './visualizer/tool-modes';
|
|
27
27
|
import { FloatingPos } from './visualizer/floating-drag.directive';
|
|
28
28
|
import { IntensityInsetComponent } from './intensity-inset/intensity-inset.component';
|
|
29
|
+
import type { SectionAxis, SectionViews } from './contracts/section-view.contract';
|
|
29
30
|
import { SpatialDatasetBinder } from './visualizer/spatial-dataset-binder';
|
|
30
31
|
import * as i0 from "@angular/core";
|
|
31
32
|
/**
|
|
@@ -245,6 +246,36 @@ export declare class VisualizerComponent implements OnInit, OnChanges, AfterView
|
|
|
245
246
|
* selection there: region tools are screen-space, and against an orbiting
|
|
246
247
|
* camera a drawn rectangle has no fixed meaning in the data. */
|
|
247
248
|
protected get isSpatial3dMode(): boolean;
|
|
249
|
+
/** True in a napari volume or isosurface view, where the Region Editor shows regions in 3D. */
|
|
250
|
+
protected get isVolumeView(): boolean;
|
|
251
|
+
/** Whether the user split the volume view with the slice editor (off by default; kept while
|
|
252
|
+
* the view shows other plot types, so a volume view opens split again). */
|
|
253
|
+
protected sliceEditor: boolean;
|
|
254
|
+
/** The slice editor's pane: the displayed slice, with every region tool, top right. */
|
|
255
|
+
protected readonly sliceDivName: string;
|
|
256
|
+
/** The left column's and the top row's shares of the slice editor (%). */
|
|
257
|
+
protected splitX: number;
|
|
258
|
+
protected splitY: number;
|
|
259
|
+
/** The sections through x and y shown below (nulls until the volume is cut). */
|
|
260
|
+
protected sections: SectionViews;
|
|
261
|
+
protected get sliceEditorShown(): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Split the volume view with the slice editor, or close it. The editor opens on the displayed
|
|
264
|
+
* slice and takes the drawing tools; closing it leaves the selection tool armed (it picks the
|
|
265
|
+
* surfaces in 3D) and disarms any other.
|
|
266
|
+
*/
|
|
267
|
+
protected toggleSliceEditor(): Promise<void>;
|
|
268
|
+
/** A point picked in a section: the slice and the other section's plane move there. */
|
|
269
|
+
protected onSectionPick(axis: SectionAxis, at: {
|
|
270
|
+
u: number;
|
|
271
|
+
v: number;
|
|
272
|
+
}): void;
|
|
273
|
+
/** Drag a divider of the slice editor: the vertical one sets the columns, the horizontal one the rows. */
|
|
274
|
+
protected startPaneResize(event: PointerEvent, axis: 'x' | 'y'): void;
|
|
275
|
+
/** A divider's keyboard: ← → move the vertical one, ↑ ↓ the horizontal one, by 5%. */
|
|
276
|
+
protected nudgePaneSize(event: KeyboardEvent, axis: 'x' | 'y'): void;
|
|
277
|
+
private setSplit;
|
|
278
|
+
private relayoutFrame;
|
|
248
279
|
/** True for the Image plot type, which renders as a natively pan/zoom-able
|
|
249
280
|
* raster — so the backend-agnostic zoom/pan toolbar tools are hidden. The
|
|
250
281
|
* component drives this off the plot type, not the active backend. */
|
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.10.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.9.0"
|
|
6
6
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"cellpose-js": "^0.6.0",
|
|
41
41
|
"fast-png": "^6.4.0",
|
|
42
|
-
"napari-js": "^0.
|
|
42
|
+
"napari-js": "^0.18.0",
|
|
43
43
|
"openseadragon": "^6.0.2",
|
|
44
44
|
"plotly.js-dist-min": "^3.0.1",
|
|
45
45
|
"tslib": "^2.3.0"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
|
|
2
|
+
<!-- A volume (a cube) with a slab sliced off it by a scalpel: the slice editor. -->
|
|
3
|
+
<defs>
|
|
4
|
+
<mask id="slice-cut" maskUnits="userSpaceOnUse" x="-64" y="-64" width="192" height="192">
|
|
5
|
+
<rect x="-64" y="-64" width="192" height="192" fill="#fff"/>
|
|
6
|
+
<!-- The cube's lines stop short of the scalpel, so it reads at toolbar size. -->
|
|
7
|
+
<path d="M27.4 19.4 Q20.5 29.3 24.9 42.6 L34.1 21.4 Z" fill="#000" stroke="#000" stroke-width="5" stroke-linejoin="round"/>
|
|
8
|
+
<path d="M31.8 19.1 L34.2 11.0 M31.4 20.6 L31.8 19.1" stroke="#000" stroke-width="12" stroke-linecap="round"/>
|
|
9
|
+
</mask>
|
|
10
|
+
</defs>
|
|
11
|
+
<g transform="translate(4.89 -8.48) scale(1.1566)">
|
|
12
|
+
<g fill="none" stroke="#000" stroke-width="4.6" stroke-linejoin="round" stroke-linecap="round" mask="url(#slice-cut)">
|
|
13
|
+
<path d="M22.0 59.0 L30.3 54.2 L30.3 35.7 L14.3 26.4 L6.0 31.2 L6.0 49.8 Z M22.0 40.5 L22.0 59.0 M22.0 40.5 L30.3 35.7 M22.0 40.5 L6.0 31.2"/>
|
|
14
|
+
<path d="M35.5 51.2 L40.9 48.1 L40.9 29.6 L24.9 20.3 L19.4 23.5 L19.4 42.0 Z M35.5 32.7 L35.5 51.2 M35.5 32.7 L40.9 29.6 M35.5 32.7 L19.4 23.5"/>
|
|
15
|
+
<!-- The slab's cut face: the section the slice shows. -->
|
|
16
|
+
<path d="M35.5 51.2 L35.5 32.7 L19.4 23.5 L19.4 42.0 Z" fill="#000"/>
|
|
17
|
+
</g>
|
|
18
|
+
<path d="M27.4 19.4 Q20.5 29.3 24.9 42.6 L34.1 21.4 Z" fill="#000"/>
|
|
19
|
+
<path d="M31.8 19.1 L34.2 11.0" stroke="#000" stroke-width="7.5" stroke-linecap="round"/>
|
|
20
|
+
<path d="M31.4 20.6 L31.8 19.1" stroke="#000" stroke-width="3.5" stroke-linecap="round"/>
|
|
21
|
+
</g>
|
|
22
|
+
</svg>
|
|
23
|
+
|