@jax-data-science/sci-image-visualizer 0.1.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/LICENSE +21 -0
- package/README.md +404 -0
- package/esm2022/index.mjs +52 -0
- package/esm2022/jax-data-science-sci-image-visualizer.mjs +5 -0
- package/esm2022/lib/channel-histogram/channel-histogram.component.mjs +398 -0
- package/esm2022/lib/contracts/capabilities.contract.mjs +32 -0
- package/esm2022/lib/contracts/cell-segmenter.contract.mjs +12 -0
- package/esm2022/lib/contracts/channel-histogram-api.contract.mjs +14 -0
- package/esm2022/lib/contracts/colormap-lut.mjs +95 -0
- package/esm2022/lib/contracts/coordinate-transform.contract.mjs +2 -0
- package/esm2022/lib/contracts/display-types.mjs +8 -0
- package/esm2022/lib/contracts/image.contract.mjs +11 -0
- package/esm2022/lib/contracts/intensity.mjs +28 -0
- package/esm2022/lib/contracts/plot-type.mjs +112 -0
- package/esm2022/lib/contracts/ports/image-state.port.mjs +3 -0
- package/esm2022/lib/contracts/ports/preferences.port.mjs +3 -0
- package/esm2022/lib/contracts/ports/region-io.port.mjs +3 -0
- package/esm2022/lib/contracts/ports/tile-access.port.mjs +3 -0
- package/esm2022/lib/contracts/region-editor-api.contract.mjs +4 -0
- package/esm2022/lib/contracts/region-overlay.contract.mjs +2 -0
- package/esm2022/lib/contracts/region-store.contract.mjs +2 -0
- package/esm2022/lib/contracts/sam.contract.mjs +12 -0
- package/esm2022/lib/contracts/toolbar-config.mjs +8 -0
- package/esm2022/lib/contracts/visualizer.contract.mjs +10 -0
- package/esm2022/lib/contracts/viz-config.mjs +3 -0
- package/esm2022/lib/hex-color-picker/hex-color-picker.component.mjs +260 -0
- package/esm2022/lib/implementations/base-store-visualizer.mjs +76 -0
- package/esm2022/lib/implementations/napari-js/napari-axes-labels.mjs +106 -0
- package/esm2022/lib/implementations/napari-js/napari-region-overlay.mjs +847 -0
- package/esm2022/lib/implementations/napari-js/napari-scale-bar.mjs +92 -0
- package/esm2022/lib/implementations/napari-js/napari-visualizer.service.mjs +2283 -0
- package/esm2022/lib/implementations/napari-js/napari-volume-z-handle.mjs +126 -0
- package/esm2022/lib/implementations/osd/display-pipeline.mjs +143 -0
- package/esm2022/lib/implementations/osd/histogram-sampler.mjs +217 -0
- package/esm2022/lib/implementations/osd/openseadragon-visualizer.service.mjs +1780 -0
- package/esm2022/lib/implementations/osd/osd-coordinate-transform.mjs +25 -0
- package/esm2022/lib/implementations/osd/osd-coords.mjs +53 -0
- package/esm2022/lib/implementations/osd/osd-lib.mjs +20 -0
- package/esm2022/lib/implementations/osd/osd-region-overlay.mjs +1237 -0
- package/esm2022/lib/implementations/osd/osd-scale-bar.mjs +88 -0
- package/esm2022/lib/implementations/osd/slice-cache.mjs +488 -0
- package/esm2022/lib/implementations/osd/tile-client.mjs +29 -0
- package/esm2022/lib/implementations/plotly/plotly-coordinate-transform.mjs +37 -0
- package/esm2022/lib/implementations/plotly/plotly-region-overlay.mjs +31 -0
- package/esm2022/lib/implementations/plotly/plotly-trace-builders.mjs +183 -0
- package/esm2022/lib/implementations/plotly/plotly.service.mjs +2137 -0
- package/esm2022/lib/implementations/simple-slice-access.service.mjs +99 -0
- package/esm2022/lib/models/bezier.mjs +120 -0
- package/esm2022/lib/models/class-preset.mjs +46 -0
- package/esm2022/lib/models/geometry.mjs +198 -0
- package/esm2022/lib/models/region.mjs +166 -0
- package/esm2022/lib/models/shape.mjs +53 -0
- package/esm2022/lib/plot.utilities.mjs +693 -0
- package/esm2022/lib/processing/image-converter.service.mjs +90 -0
- package/esm2022/lib/processing/image-crop.mjs +62 -0
- package/esm2022/lib/processing/processing-image.mjs +50 -0
- package/esm2022/lib/provide-visualization.mjs +63 -0
- package/esm2022/lib/region-editor/mask-raster.mjs +95 -0
- package/esm2022/lib/region-editor/mask-worker.mjs +10 -0
- package/esm2022/lib/region-editor/region-editor.component.mjs +1190 -0
- package/esm2022/lib/region-ops.service.mjs +301 -0
- package/esm2022/lib/render-orchestrator.mjs +87 -0
- package/esm2022/lib/routing-visualizer.service.mjs +533 -0
- package/esm2022/lib/store/class-color.util.mjs +52 -0
- package/esm2022/lib/store/region-store.service.mjs +1029 -0
- package/esm2022/lib/store/visualizer-store.service.mjs +352 -0
- package/esm2022/lib/toolbar/brush/brush-tool.service.mjs +546 -0
- package/esm2022/lib/toolbar/crop/slide-crop.mjs +57 -0
- package/esm2022/lib/toolbar/segmentation/cell-segment-tool.service.mjs +115 -0
- package/esm2022/lib/toolbar/segmentation/cellpose-segmenter.service.mjs +84 -0
- package/esm2022/lib/toolbar/segmentation/onnx-sam-session.mjs +133 -0
- package/esm2022/lib/toolbar/segmentation/ort-runtime-config.mjs +31 -0
- package/esm2022/lib/toolbar/segmentation/sam-model-registry.mjs +108 -0
- package/esm2022/lib/toolbar/segmentation/sam-onnx-core.mjs +159 -0
- package/esm2022/lib/toolbar/segmentation/sam-point-tool.service.mjs +255 -0
- package/esm2022/lib/toolbar/segmentation/sam-prompt.mjs +94 -0
- package/esm2022/lib/toolbar/segmentation/sam-tool.service.mjs +188 -0
- package/esm2022/lib/toolbar/toolbar.component.mjs +311 -0
- package/esm2022/lib/toolbar/vertex-eraser/vertex-eraser-tool.service.mjs +234 -0
- package/esm2022/lib/toolbar/wand/wand-tool.service.mjs +499 -0
- package/esm2022/lib/toolbar/wand/wand.service.mjs +921 -0
- package/esm2022/lib/toolbar/zoom-to-box/zoom-to-box-tool.service.mjs +157 -0
- package/esm2022/lib/visualization.module.mjs +162 -0
- package/esm2022/lib/visualizer.component.mjs +1597 -0
- package/fesm2022/jax-data-science-sci-image-visualizer-mask-worker-uhepXUhM.mjs +12 -0
- package/fesm2022/jax-data-science-sci-image-visualizer-mask-worker-uhepXUhM.mjs.map +1 -0
- package/fesm2022/jax-data-science-sci-image-visualizer-onnx-sam-session-ci1q0xnJ.mjs +327 -0
- package/fesm2022/jax-data-science-sci-image-visualizer-onnx-sam-session-ci1q0xnJ.mjs.map +1 -0
- package/fesm2022/jax-data-science-sci-image-visualizer.mjs +21314 -0
- package/fesm2022/jax-data-science-sci-image-visualizer.mjs.map +1 -0
- package/fesm2022/mask.worker.js +989 -0
- package/fesm2022/onnx-sam.worker.js +202 -0
- package/index.d.ts +39 -0
- package/lib/channel-histogram/channel-histogram.component.d.ts +112 -0
- package/lib/contracts/capabilities.contract.d.ts +30 -0
- package/lib/contracts/cell-segmenter.contract.d.ts +40 -0
- package/lib/contracts/channel-histogram-api.contract.d.ts +98 -0
- package/lib/contracts/colormap-lut.d.ts +21 -0
- package/lib/contracts/coordinate-transform.contract.d.ts +43 -0
- package/lib/contracts/display-types.d.ts +41 -0
- package/lib/contracts/image.contract.d.ts +72 -0
- package/lib/contracts/intensity.d.ts +18 -0
- package/lib/contracts/plot-type.d.ts +108 -0
- package/lib/contracts/ports/image-state.port.d.ts +29 -0
- package/lib/contracts/ports/preferences.port.d.ts +19 -0
- package/lib/contracts/ports/region-io.port.d.ts +29 -0
- package/lib/contracts/ports/tile-access.port.d.ts +27 -0
- package/lib/contracts/region-editor-api.contract.d.ts +83 -0
- package/lib/contracts/region-overlay.contract.d.ts +47 -0
- package/lib/contracts/region-store.contract.d.ts +74 -0
- package/lib/contracts/sam.contract.d.ts +98 -0
- package/lib/contracts/toolbar-config.d.ts +24 -0
- package/lib/contracts/visualizer.contract.d.ts +346 -0
- package/lib/contracts/viz-config.d.ts +25 -0
- package/lib/hex-color-picker/hex-color-picker.component.d.ts +47 -0
- package/lib/implementations/base-store-visualizer.d.ts +71 -0
- package/lib/implementations/napari-js/napari-axes-labels.d.ts +47 -0
- package/lib/implementations/napari-js/napari-region-overlay.d.ts +115 -0
- package/lib/implementations/napari-js/napari-scale-bar.d.ts +31 -0
- package/lib/implementations/napari-js/napari-visualizer.service.d.ts +455 -0
- package/lib/implementations/napari-js/napari-volume-z-handle.d.ts +46 -0
- package/lib/implementations/osd/display-pipeline.d.ts +47 -0
- package/lib/implementations/osd/histogram-sampler.d.ts +85 -0
- package/lib/implementations/osd/openseadragon-visualizer.service.d.ts +476 -0
- package/lib/implementations/osd/osd-coordinate-transform.d.ts +17 -0
- package/lib/implementations/osd/osd-coords.d.ts +16 -0
- package/lib/implementations/osd/osd-lib.d.ts +19 -0
- package/lib/implementations/osd/osd-region-overlay.d.ts +191 -0
- package/lib/implementations/osd/osd-scale-bar.d.ts +17 -0
- package/lib/implementations/osd/slice-cache.d.ts +161 -0
- package/lib/implementations/osd/tile-client.d.ts +32 -0
- package/lib/implementations/plotly/plotly-coordinate-transform.d.ts +19 -0
- package/lib/implementations/plotly/plotly-region-overlay.d.ts +23 -0
- package/lib/implementations/plotly/plotly-trace-builders.d.ts +60 -0
- package/lib/implementations/plotly/plotly.service.d.ts +594 -0
- package/lib/implementations/simple-slice-access.service.d.ts +64 -0
- package/lib/models/bezier.d.ts +59 -0
- package/lib/models/class-preset.d.ts +39 -0
- package/lib/models/geometry.d.ts +66 -0
- package/lib/models/region.d.ts +132 -0
- package/lib/models/shape.d.ts +44 -0
- package/lib/plot.utilities.d.ts +107 -0
- package/lib/processing/image-converter.service.d.ts +28 -0
- package/lib/processing/image-crop.d.ts +18 -0
- package/lib/processing/processing-image.d.ts +17 -0
- package/lib/provide-visualization.d.ts +34 -0
- package/lib/region-editor/mask-raster.d.ts +61 -0
- package/lib/region-editor/mask-worker.d.ts +7 -0
- package/lib/region-editor/region-editor.component.d.ts +305 -0
- package/lib/region-ops.service.d.ts +92 -0
- package/lib/render-orchestrator.d.ts +59 -0
- package/lib/routing-visualizer.service.d.ts +227 -0
- package/lib/store/class-color.util.d.ts +26 -0
- package/lib/store/region-store.service.d.ts +315 -0
- package/lib/store/visualizer-store.service.d.ts +123 -0
- package/lib/toolbar/brush/brush-tool.service.d.ts +143 -0
- package/lib/toolbar/crop/slide-crop.d.ts +30 -0
- package/lib/toolbar/segmentation/cell-segment-tool.service.d.ts +32 -0
- package/lib/toolbar/segmentation/cellpose-segmenter.service.d.ts +39 -0
- package/lib/toolbar/segmentation/onnx-sam-session.d.ts +25 -0
- package/lib/toolbar/segmentation/ort-runtime-config.d.ts +4 -0
- package/lib/toolbar/segmentation/sam-model-registry.d.ts +36 -0
- package/lib/toolbar/segmentation/sam-onnx-core.d.ts +48 -0
- package/lib/toolbar/segmentation/sam-point-tool.service.d.ts +59 -0
- package/lib/toolbar/segmentation/sam-prompt.d.ts +34 -0
- package/lib/toolbar/segmentation/sam-tool.service.d.ts +50 -0
- package/lib/toolbar/toolbar.component.d.ts +167 -0
- package/lib/toolbar/vertex-eraser/vertex-eraser-tool.service.d.ts +64 -0
- package/lib/toolbar/wand/wand-tool.service.d.ts +149 -0
- package/lib/toolbar/wand/wand.service.d.ts +133 -0
- package/lib/toolbar/zoom-to-box/zoom-to-box-tool.service.d.ts +49 -0
- package/lib/visualization.module.d.ts +45 -0
- package/lib/visualizer.component.d.ts +378 -0
- package/package.json +73 -0
- package/src/lib/assets/3d-coordinates.svg +49 -0
- package/src/lib/assets/cells.svg +1 -0
- package/src/lib/assets/click.svg +1 -0
- package/src/lib/assets/colormap-luts.json +1 -0
- package/src/lib/assets/contour.svg +48 -0
- package/src/lib/assets/cube-3d.svg +1 -0
- package/src/lib/assets/edit-selection-white.svg +47 -0
- package/src/lib/assets/heatmap.svg +1 -0
- package/src/lib/assets/icons/colormap-Pastel1.png +0 -0
- package/src/lib/assets/icons/colormap-accent.png +0 -0
- package/src/lib/assets/icons/colormap-afmhot.png +0 -0
- package/src/lib/assets/icons/colormap-autumn.png +0 -0
- package/src/lib/assets/icons/colormap-berlin.png +0 -0
- package/src/lib/assets/icons/colormap-binary.png +0 -0
- package/src/lib/assets/icons/colormap-blackbody.png +0 -0
- package/src/lib/assets/icons/colormap-bluered.png +0 -0
- package/src/lib/assets/icons/colormap-blues.png +0 -0
- package/src/lib/assets/icons/colormap-bone.png +0 -0
- package/src/lib/assets/icons/colormap-brbg.png +0 -0
- package/src/lib/assets/icons/colormap-brg.png +0 -0
- package/src/lib/assets/icons/colormap-bugn.png +0 -0
- package/src/lib/assets/icons/colormap-bupu.png +0 -0
- package/src/lib/assets/icons/colormap-bwr.png +0 -0
- package/src/lib/assets/icons/colormap-cividis.png +0 -0
- package/src/lib/assets/icons/colormap-cmrmap.png +0 -0
- package/src/lib/assets/icons/colormap-cool.png +0 -0
- package/src/lib/assets/icons/colormap-coolwarm.png +0 -0
- package/src/lib/assets/icons/colormap-copper.png +0 -0
- package/src/lib/assets/icons/colormap-cubehelix.png +0 -0
- package/src/lib/assets/icons/colormap-dark2.png +0 -0
- package/src/lib/assets/icons/colormap-earth.png +0 -0
- package/src/lib/assets/icons/colormap-electric.png +0 -0
- package/src/lib/assets/icons/colormap-flag.png +0 -0
- package/src/lib/assets/icons/colormap-gist_earth.png +0 -0
- package/src/lib/assets/icons/colormap-gist_gray.png +0 -0
- package/src/lib/assets/icons/colormap-gist_heat.png +0 -0
- package/src/lib/assets/icons/colormap-gist_ncar.png +0 -0
- package/src/lib/assets/icons/colormap-gist_rainbow.png +0 -0
- package/src/lib/assets/icons/colormap-gist_stern.png +0 -0
- package/src/lib/assets/icons/colormap-gist_yarg.png +0 -0
- package/src/lib/assets/icons/colormap-gnbu.png +0 -0
- package/src/lib/assets/icons/colormap-gnuplot.png +0 -0
- package/src/lib/assets/icons/colormap-gnuplot2.png +0 -0
- package/src/lib/assets/icons/colormap-gray.png +0 -0
- package/src/lib/assets/icons/colormap-greens-inv.png +0 -0
- package/src/lib/assets/icons/colormap-greens.png +0 -0
- package/src/lib/assets/icons/colormap-greys-inv.png +0 -0
- package/src/lib/assets/icons/colormap-greys.png +0 -0
- package/src/lib/assets/icons/colormap-hot.png +0 -0
- package/src/lib/assets/icons/colormap-hsv.png +0 -0
- package/src/lib/assets/icons/colormap-inferno.png +0 -0
- package/src/lib/assets/icons/colormap-jet.png +0 -0
- package/src/lib/assets/icons/colormap-magma.png +0 -0
- package/src/lib/assets/icons/colormap-managua.png +0 -0
- package/src/lib/assets/icons/colormap-nipy_spectral.png +0 -0
- package/src/lib/assets/icons/colormap-ocean.png +0 -0
- package/src/lib/assets/icons/colormap-oranges.png +0 -0
- package/src/lib/assets/icons/colormap-orrd.png +0 -0
- package/src/lib/assets/icons/colormap-pastel2.png +0 -0
- package/src/lib/assets/icons/colormap-picnic.png +0 -0
- package/src/lib/assets/icons/colormap-pink.png +0 -0
- package/src/lib/assets/icons/colormap-piyg.png +0 -0
- package/src/lib/assets/icons/colormap-placeholder.png +0 -0
- package/src/lib/assets/icons/colormap-plasma.png +0 -0
- package/src/lib/assets/icons/colormap-portland.png +0 -0
- package/src/lib/assets/icons/colormap-prgn.png +0 -0
- package/src/lib/assets/icons/colormap-prism.png +0 -0
- package/src/lib/assets/icons/colormap-pubu.png +0 -0
- package/src/lib/assets/icons/colormap-pubugn.png +0 -0
- package/src/lib/assets/icons/colormap-puor.png +0 -0
- package/src/lib/assets/icons/colormap-purd.png +0 -0
- package/src/lib/assets/icons/colormap-purples.png +0 -0
- package/src/lib/assets/icons/colormap-rainbow.png +0 -0
- package/src/lib/assets/icons/colormap-rdbu.png +0 -0
- package/src/lib/assets/icons/colormap-rdgy.png +0 -0
- package/src/lib/assets/icons/colormap-rdpu.png +0 -0
- package/src/lib/assets/icons/colormap-rdylbu.png +0 -0
- package/src/lib/assets/icons/colormap-rdylgn.png +0 -0
- package/src/lib/assets/icons/colormap-reds.png +0 -0
- package/src/lib/assets/icons/colormap-seismic.png +0 -0
- package/src/lib/assets/icons/colormap-set1.png +0 -0
- package/src/lib/assets/icons/colormap-set2.png +0 -0
- package/src/lib/assets/icons/colormap-set3.png +0 -0
- package/src/lib/assets/icons/colormap-spectral.png +0 -0
- package/src/lib/assets/icons/colormap-spring.png +0 -0
- package/src/lib/assets/icons/colormap-summer.png +0 -0
- package/src/lib/assets/icons/colormap-tab10.png +0 -0
- package/src/lib/assets/icons/colormap-tab20.png +0 -0
- package/src/lib/assets/icons/colormap-tab20b.png +0 -0
- package/src/lib/assets/icons/colormap-tab20c.png +0 -0
- package/src/lib/assets/icons/colormap-terrain.png +0 -0
- package/src/lib/assets/icons/colormap-turbo.png +0 -0
- package/src/lib/assets/icons/colormap-twilight.png +0 -0
- package/src/lib/assets/icons/colormap-twilight_shifted.png +0 -0
- package/src/lib/assets/icons/colormap-vanimo.png +0 -0
- package/src/lib/assets/icons/colormap-viridis.png +0 -0
- package/src/lib/assets/icons/colormap-winter.png +0 -0
- package/src/lib/assets/icons/colormap-wistia.png +0 -0
- package/src/lib/assets/icons/colormap-ylgn.png +0 -0
- package/src/lib/assets/icons/colormap-ylgnbu-inv.png +0 -0
- package/src/lib/assets/icons/colormap-ylgnbu.png +0 -0
- package/src/lib/assets/icons/colormap-ylorbr.png +0 -0
- package/src/lib/assets/icons/colormap-ylorrd-inv.png +0 -0
- package/src/lib/assets/icons/colormap-ylorrd.png +0 -0
- package/src/lib/assets/interactive-segmentation-cursor.svg +1 -0
- package/src/lib/assets/invert.svg +1 -0
- package/src/lib/assets/isosurface.svg +7 -0
- package/src/lib/assets/mask.svg +1 -0
- package/src/lib/assets/paintbrush.svg +1 -0
- package/src/lib/assets/picture-segmentation.svg +43 -0
- package/src/lib/assets/polygon-vertices.svg +13 -0
- package/src/lib/assets/polyline.svg +3 -0
- package/src/lib/assets/redo.svg +39 -0
- package/src/lib/assets/region-editor.svg +37 -0
- package/src/lib/assets/region-move.svg +7 -0
- package/src/lib/assets/smooth.svg +56 -0
- package/src/lib/assets/spline-chart.svg +7 -0
- package/src/lib/assets/surface.svg +37 -0
- package/src/lib/assets/test/download-379.svg +1 -0
- package/src/lib/assets/test/download-98.svg +1 -0
- package/src/lib/assets/test/json-1.svg +1 -0
- package/src/lib/assets/test/load-53.svg +1 -0
- package/src/lib/assets/test/mask-44.svg +1 -0
- package/src/lib/assets/test/mask-download-44.svg +15 -0
- package/src/lib/assets/test/mask-save-44.svg +11 -0
- package/src/lib/assets/test/overlay-1.svg +1 -0
- package/src/lib/assets/test/overlay-4.svg +1 -0
- package/src/lib/assets/test/region-26.svg +1 -0
- package/src/lib/assets/test/save-56.svg +1 -0
- package/src/lib/assets/test/upload-43.svg +1 -0
- package/src/lib/assets/to-bezier.svg +15 -0
- package/src/lib/assets/to-polygon.svg +11 -0
- package/src/lib/assets/undo.svg +38 -0
- package/src/lib/assets/vertex-add.svg +12 -0
- package/src/lib/assets/vertex-delete.svg +12 -0
- package/src/lib/assets/wand.svg +54 -0
- package/src/lib/assets/zoom-box.svg +10 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { MenuItem } from 'primeng/api';
|
|
3
|
+
import { IImageInfo } from '../contracts/image.contract';
|
|
4
|
+
import { PlotType, PlotTypeDescriptor } from '../contracts/plot-type';
|
|
5
|
+
import { ToolbarToolVisibility } from '../contracts/toolbar-config';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Presentational toolbar for the plotting viewport.
|
|
9
|
+
*
|
|
10
|
+
* Renders the plot-type selector, colormap/LUT controls, stack navigation,
|
|
11
|
+
* image actions (download / autoscale / pipeline), viewport zoom/pan, the
|
|
12
|
+
* Surface-3D camera controls, and the region-drawing tools — plus the plotting
|
|
13
|
+
* help dialog. It owns no rendering or visualization state: the host
|
|
14
|
+
* (VisualizerComponent) stays the orchestrator, passing state in via `@Input` and
|
|
15
|
+
* handling every action via `@Output`. The same actions are also driven by the
|
|
16
|
+
* diagram's right-click context menu and keyboard shortcuts, so keeping the
|
|
17
|
+
* handlers in the host avoids duplicating that logic.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ToolbarComponent implements OnChanges {
|
|
20
|
+
/** Current image (gates which control groups are shown). */
|
|
21
|
+
imageInfo: IImageInfo | undefined;
|
|
22
|
+
/** Plot types the active backend advertises. */
|
|
23
|
+
plotTypeOptions: PlotTypeDescriptor[];
|
|
24
|
+
selectedPlotType: PlotType;
|
|
25
|
+
/** Isosurface band as a 0–255 slider position (mapped onto the volume's real
|
|
26
|
+
* intensity range by the renderer). Defaults to the full range. */
|
|
27
|
+
isoRange: number[];
|
|
28
|
+
maxIndex: number;
|
|
29
|
+
zIndex: number;
|
|
30
|
+
/** True for any 2D (non Surface-3D) plot type. */
|
|
31
|
+
isHeatmap: boolean;
|
|
32
|
+
activeDragMode: string | null;
|
|
33
|
+
activeSurface3dMode: string;
|
|
34
|
+
/** Whether the napari 3D axes/scale gizmo is currently shown (drives the toggle's look). */
|
|
35
|
+
axesVisible: boolean;
|
|
36
|
+
wireframeActive: boolean;
|
|
37
|
+
/** Active napari 3D decimate factor (1 = Full … 8 = ⅛; default ½). */
|
|
38
|
+
resolutionScale: number;
|
|
39
|
+
/** Decimate-factor options for the Resolution dropdown. */
|
|
40
|
+
readonly decimateOptions: {
|
|
41
|
+
label: string;
|
|
42
|
+
value: number;
|
|
43
|
+
}[];
|
|
44
|
+
wandSensitivity: number;
|
|
45
|
+
brushSize: number;
|
|
46
|
+
vertexEraserRadius: number;
|
|
47
|
+
/** Whether a region action is available to undo (jit-ui#85). Greys out the
|
|
48
|
+
* Undo button when false (nothing done yet, or all steps already undone). */
|
|
49
|
+
canUndo: boolean;
|
|
50
|
+
/** Whether an undone region action is available to redo (jit-ui#85). Greys
|
|
51
|
+
* out the Redo button when false. */
|
|
52
|
+
canRedo: boolean;
|
|
53
|
+
stackOptions: {
|
|
54
|
+
name: string;
|
|
55
|
+
val: string;
|
|
56
|
+
}[];
|
|
57
|
+
/** Which toolbar groups to show. Defaults to the full toolbar; the host forwards
|
|
58
|
+
* the consumer's choice (e.g. the pipeline shows only zoom + region tools). */
|
|
59
|
+
tools: Required<ToolbarToolVisibility>;
|
|
60
|
+
/** Current image-smoothing state (drives the Smoothen toggle button look).
|
|
61
|
+
* `false` = nearest-neighbour (crisp raw pixels), the default. */
|
|
62
|
+
imageSmoothingEnabled: boolean;
|
|
63
|
+
/** SAM model picker options + current selection (jit-ui#90 P1). */
|
|
64
|
+
samModels: {
|
|
65
|
+
id: string;
|
|
66
|
+
label: string;
|
|
67
|
+
}[];
|
|
68
|
+
samModelId: string;
|
|
69
|
+
selectPlotType: EventEmitter<PlotType>;
|
|
70
|
+
/** Intensity (LINE) mode: add another colored line ROI + inset trace. */
|
|
71
|
+
addProfileLine: EventEmitter<void>;
|
|
72
|
+
/** Toggle image smoothing (bilinear) vs nearest-neighbour (crisp pixels). */
|
|
73
|
+
toggleImageSmoothing: EventEmitter<void>;
|
|
74
|
+
isoRangeChange: EventEmitter<number[] | undefined>;
|
|
75
|
+
/** Open the Channels & Histogram dialog (brightness/contrast, colormap, …). */
|
|
76
|
+
openChannelHistogram: EventEmitter<void>;
|
|
77
|
+
openRegionEditor: EventEmitter<void>;
|
|
78
|
+
selectStackOption: EventEmitter<{
|
|
79
|
+
name: string;
|
|
80
|
+
val: string;
|
|
81
|
+
}>;
|
|
82
|
+
zScrub: EventEmitter<number | undefined>;
|
|
83
|
+
zSlide: EventEmitter<number | undefined>;
|
|
84
|
+
zIndexInput: EventEmitter<number>;
|
|
85
|
+
reloadAndPlot: EventEmitter<void>;
|
|
86
|
+
downloadImage: EventEmitter<void>;
|
|
87
|
+
autoscaleImage: EventEmitter<void>;
|
|
88
|
+
toggleDragMode: EventEmitter<string>;
|
|
89
|
+
zoomIn: EventEmitter<void>;
|
|
90
|
+
zoomOut: EventEmitter<void>;
|
|
91
|
+
toggleSurface3dMode: EventEmitter<string>;
|
|
92
|
+
resetSurfaceCamera: EventEmitter<void>;
|
|
93
|
+
/** Toggle the napari 3D coordinate-axes / scale gizmo on/off. */
|
|
94
|
+
toggleAxes: EventEmitter<void>;
|
|
95
|
+
/** Toggle the napari surface wireframe (edges) on/off. */
|
|
96
|
+
toggleWireframe: EventEmitter<void>;
|
|
97
|
+
/** Change the napari 3D decimate factor (reloads at the new resolution). */
|
|
98
|
+
selectResolution: EventEmitter<number>;
|
|
99
|
+
deleteRegion: EventEmitter<void>;
|
|
100
|
+
/** Undo the last region action (jit-ui#85). */
|
|
101
|
+
undoRegion: EventEmitter<void>;
|
|
102
|
+
/** Redo the last undone region action (jit-ui#85). */
|
|
103
|
+
redoRegion: EventEmitter<void>;
|
|
104
|
+
/** Run box-prompted SAM segmentation on the drawn rectangles (jit-ui#90). */
|
|
105
|
+
segmentRegions: EventEmitter<void>;
|
|
106
|
+
/** Run cellpose-SAM (auto) inside each drawn rectangle's crop (jit-ui#90). */
|
|
107
|
+
segmentCellpose: EventEmitter<void>;
|
|
108
|
+
/** SAM model picker (jit-ui#90 P1). */
|
|
109
|
+
samModelChange: EventEmitter<string>;
|
|
110
|
+
wandSensitivityChange: EventEmitter<number | undefined>;
|
|
111
|
+
brushSizeChange: EventEmitter<number | undefined>;
|
|
112
|
+
vertexEraserRadiusChange: EventEmitter<number | undefined>;
|
|
113
|
+
/** Sliders' bounds — toolbar UI constants (the values are host-owned). */
|
|
114
|
+
readonly wandSensitivityMin = 0.5;
|
|
115
|
+
readonly wandSensitivityMax = 10;
|
|
116
|
+
readonly wandSensitivityStep = 0.1;
|
|
117
|
+
readonly brushSizeMin = 5;
|
|
118
|
+
readonly brushSizeMax = 300;
|
|
119
|
+
readonly brushSizeStep = 5;
|
|
120
|
+
readonly vertexEraserRadiusMin = 5;
|
|
121
|
+
readonly vertexEraserRadiusMax = 300;
|
|
122
|
+
readonly vertexEraserRadiusStep = 5;
|
|
123
|
+
readonly isoValueMin = 0;
|
|
124
|
+
readonly isoValueMax = 255;
|
|
125
|
+
readonly isoValueStep = 1;
|
|
126
|
+
displayHelpDialog: boolean;
|
|
127
|
+
/** Model picker for the Segment button's dropdown menu. The active model
|
|
128
|
+
* (`samModelId`) is marked with a check; selecting an item emits
|
|
129
|
+
* `samModelChange` (jit-ui#90 P1).
|
|
130
|
+
*
|
|
131
|
+
* Held as a stable array (rebuilt only when `samModels`/`samModelId` change),
|
|
132
|
+
* NOT a getter: a getter returns a fresh array with new `command` closures on
|
|
133
|
+
* every change-detection tick, which makes the bound `p-menu` overlay rebuild
|
|
134
|
+
* its DOM mid-interaction and swallow the click on a menu item. */
|
|
135
|
+
samMenuItems: MenuItem[];
|
|
136
|
+
/** Rebuild the SAM model menu when the model list or active selection
|
|
137
|
+
* changes (keeps the array reference stable across other CD ticks). */
|
|
138
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
139
|
+
/** The Image plot type renders as a natively pan/zoom-able raster, so the
|
|
140
|
+
* generic zoom/pan tools are hidden. */
|
|
141
|
+
get isImageView(): boolean;
|
|
142
|
+
/** A plot-type icon is a PrimeNG font glyph (e.g. `pi pi-image`) rather than an
|
|
143
|
+
* SVG asset path — drives which element the selector item template renders. */
|
|
144
|
+
isPiIcon(icon: string | undefined): boolean;
|
|
145
|
+
/** Backends with a vertex-editing region overlay: OSD Image and napari-js WebGPU image
|
|
146
|
+
* (jit-ui#102). Gates the polygon / add-vertex / delete-vertex / Bézier-convert tools. */
|
|
147
|
+
get supportsRegionVertexTools(): boolean;
|
|
148
|
+
/** Plot types that scrub a z-stack live (the renderer swaps the slice in place): the OSD Image
|
|
149
|
+
* view, the napari-js WebGPU image, and the napari-js surface — which rebuilds the height field
|
|
150
|
+
* from the picked slice (jit-ui#102). Drives the per-slice slider. */
|
|
151
|
+
get showsLiveSliceScrubber(): boolean;
|
|
152
|
+
/** Any napari-js WebGPU plot type. The single-image/stack toggle + slice-number field are
|
|
153
|
+
* Plotly-only stack controls, so they're hidden for napari (jit-ui#102). */
|
|
154
|
+
get isNapariMode(): boolean;
|
|
155
|
+
/** ISOSURFACE (Plotly or napari-js WebGPU, either resolution) shows the isovalue range slider. */
|
|
156
|
+
get isIsosurfaceMode(): boolean;
|
|
157
|
+
/** The napari-js WebGPU surface — shows the wireframe toggle. */
|
|
158
|
+
get isNapariSurfaceMode(): boolean;
|
|
159
|
+
/** Any napari-js WebGPU 3D type (volume/isosurface/surface) — shows the Resolution control. */
|
|
160
|
+
get isNapari3dMode(): boolean;
|
|
161
|
+
/** Intensity profile lines are Region-based and available in the Heatmap and
|
|
162
|
+
* Image plot types, which show the Intensity tool group. */
|
|
163
|
+
get isIntensityCapable(): boolean;
|
|
164
|
+
showHelp(): void;
|
|
165
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarComponent, never>;
|
|
166
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarComponent, "plotting-toolbar", never, { "imageInfo": { "alias": "imageInfo"; "required": false; }; "plotTypeOptions": { "alias": "plotTypeOptions"; "required": false; }; "selectedPlotType": { "alias": "selectedPlotType"; "required": false; }; "isoRange": { "alias": "isoRange"; "required": false; }; "maxIndex": { "alias": "maxIndex"; "required": false; }; "zIndex": { "alias": "zIndex"; "required": false; }; "isHeatmap": { "alias": "isHeatmap"; "required": false; }; "activeDragMode": { "alias": "activeDragMode"; "required": false; }; "activeSurface3dMode": { "alias": "activeSurface3dMode"; "required": false; }; "axesVisible": { "alias": "axesVisible"; "required": false; }; "wireframeActive": { "alias": "wireframeActive"; "required": false; }; "resolutionScale": { "alias": "resolutionScale"; "required": false; }; "wandSensitivity": { "alias": "wandSensitivity"; "required": false; }; "brushSize": { "alias": "brushSize"; "required": false; }; "vertexEraserRadius": { "alias": "vertexEraserRadius"; "required": false; }; "canUndo": { "alias": "canUndo"; "required": false; }; "canRedo": { "alias": "canRedo"; "required": false; }; "stackOptions": { "alias": "stackOptions"; "required": false; }; "tools": { "alias": "tools"; "required": false; }; "imageSmoothingEnabled": { "alias": "imageSmoothingEnabled"; "required": false; }; "samModels": { "alias": "samModels"; "required": false; }; "samModelId": { "alias": "samModelId"; "required": false; }; }, { "selectPlotType": "selectPlotType"; "addProfileLine": "addProfileLine"; "toggleImageSmoothing": "toggleImageSmoothing"; "isoRangeChange": "isoRangeChange"; "openChannelHistogram": "openChannelHistogram"; "openRegionEditor": "openRegionEditor"; "selectStackOption": "selectStackOption"; "zScrub": "zScrub"; "zSlide": "zSlide"; "zIndexInput": "zIndexInput"; "reloadAndPlot": "reloadAndPlot"; "downloadImage": "downloadImage"; "autoscaleImage": "autoscaleImage"; "toggleDragMode": "toggleDragMode"; "zoomIn": "zoomIn"; "zoomOut": "zoomOut"; "toggleSurface3dMode": "toggleSurface3dMode"; "resetSurfaceCamera": "resetSurfaceCamera"; "toggleAxes": "toggleAxes"; "toggleWireframe": "toggleWireframe"; "selectResolution": "selectResolution"; "deleteRegion": "deleteRegion"; "undoRegion": "undoRegion"; "redoRegion": "redoRegion"; "segmentRegions": "segmentRegions"; "segmentCellpose": "segmentCellpose"; "samModelChange": "samModelChange"; "wandSensitivityChange": "wandSensitivityChange"; "brushSizeChange": "brushSizeChange"; "vertexEraserRadiusChange": "vertexEraserRadiusChange"; }, never, ["*"], false, never>;
|
|
167
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { WandService } from '../wand/wand.service';
|
|
2
|
+
import { IViewportHost, IRegionDataHost } from '../../contracts/coordinate-transform.contract';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Collaboration interface the vertex eraser needs from its host backend.
|
|
6
|
+
*
|
|
7
|
+
* Extends {@link IViewportHost} for coordinate conversion + overlay attachment,
|
|
8
|
+
* so the eraser is backend-agnostic (Plotly and OpenSeadragon both satisfy it).
|
|
9
|
+
*/
|
|
10
|
+
export interface VertexEraserToolHost extends IViewportHost, IRegionDataHost {
|
|
11
|
+
/**
|
|
12
|
+
* Drop the wand's in-progress stroke. Called after the eraser modifies
|
|
13
|
+
* regions — the wand's accumulator may now reference stale vertices.
|
|
14
|
+
*/
|
|
15
|
+
invalidateWandRegion(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Data-coords-per-image-pixel ratio (== cachedImageRatios[0] || 1). Used to
|
|
18
|
+
* convert between matrix coordinates (the eraser's native space) and the
|
|
19
|
+
* backend's data coordinates.
|
|
20
|
+
*/
|
|
21
|
+
getCachedImageRatio(): number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Vertex eraser. A custom canvas overlay that, on click/drag, removes any
|
|
25
|
+
* polygon vertex within `radius` matrix-pixels of the cursor from every
|
|
26
|
+
* `type: 'path'` shape on the plot. Polygons that fall below 3 vertices
|
|
27
|
+
* (or polylines below 2) are removed entirely.
|
|
28
|
+
*
|
|
29
|
+
* The cursor is rendered as a dashed-red circle on the overlay so the user
|
|
30
|
+
* can see the active radius while moving.
|
|
31
|
+
*/
|
|
32
|
+
export declare class VertexEraserToolService {
|
|
33
|
+
private wandService;
|
|
34
|
+
private host;
|
|
35
|
+
private overlay;
|
|
36
|
+
private dragging;
|
|
37
|
+
/** Eraser radius in image-pixel (matrix) coordinates. */
|
|
38
|
+
private radius;
|
|
39
|
+
private cursor;
|
|
40
|
+
private readonly boundMouseDown;
|
|
41
|
+
private readonly boundMouseMove;
|
|
42
|
+
private readonly boundMouseUp;
|
|
43
|
+
constructor(wandService: WandService);
|
|
44
|
+
bindHost(host: VertexEraserToolHost): void;
|
|
45
|
+
setMode(active: boolean): void;
|
|
46
|
+
/** Set eraser radius in matrix-pixel (image pixel) coordinates. */
|
|
47
|
+
setRadius(radius: number): void;
|
|
48
|
+
private createOverlay;
|
|
49
|
+
private destroyOverlay;
|
|
50
|
+
private onMouseDown;
|
|
51
|
+
private onMouseMove;
|
|
52
|
+
private onMouseUp;
|
|
53
|
+
private updateCursor;
|
|
54
|
+
/** Draw the eraser radius circle at the current cursor position. */
|
|
55
|
+
private drawCursor;
|
|
56
|
+
/**
|
|
57
|
+
* Drop every vertex of every path-shape that lies within the eraser's
|
|
58
|
+
* radius of the cursor. Polygons reduced below 3 vertices (or polylines
|
|
59
|
+
* below 2) are removed entirely.
|
|
60
|
+
*/
|
|
61
|
+
private applyAtClient;
|
|
62
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VertexEraserToolService, never>;
|
|
63
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<VertexEraserToolService>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { WandOptions, WandService } from './wand.service';
|
|
2
|
+
import { IViewportHost, IRegionDataHost } from '../../contracts/coordinate-transform.contract';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* The pixel data and frame state PlotlyService caches for sampling. Returned
|
|
6
|
+
* by `WandToolHost.getCachedImageData()`.
|
|
7
|
+
*/
|
|
8
|
+
export interface CachedImageData {
|
|
9
|
+
/** 2-D matrices, one per stack frame (length 1 for non-stack images). */
|
|
10
|
+
frames: any[];
|
|
11
|
+
/** Image-pixel width of each frame matrix. */
|
|
12
|
+
width: number;
|
|
13
|
+
/** Image-pixel height of each frame matrix. */
|
|
14
|
+
height: number;
|
|
15
|
+
/**
|
|
16
|
+
* Plot-data-coords-per-image-pixel along x (and y — they're the same
|
|
17
|
+
* for heatmap and image traces).
|
|
18
|
+
*/
|
|
19
|
+
ratios: number[];
|
|
20
|
+
/** Whether each frame is a 2-D scalar matrix (true) or 3-channel RGB (false). */
|
|
21
|
+
isGrayscale: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Data-coords of matrix pixel (0,0). Lets the matrix be a *crop* of the data
|
|
24
|
+
* space rather than starting at the origin — e.g. the OSD backend samples the
|
|
25
|
+
* currently rendered viewport, so when zoomed in the matrix covers only the
|
|
26
|
+
* visible sub-region at screen resolution. Defaults to 0 (full-frame matrix,
|
|
27
|
+
* as Plotly provides). matrixIndex = (data - origin) / ratio.
|
|
28
|
+
*/
|
|
29
|
+
originX?: number;
|
|
30
|
+
originY?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The collaboration interface the wand tool needs from PlotlyService.
|
|
34
|
+
*
|
|
35
|
+
* Keeping it explicit makes the dependency one-way: WandToolService never
|
|
36
|
+
* imports PlotlyService directly. PlotlyService satisfies this interface
|
|
37
|
+
* structurally and binds itself via `bindHost(this)`.
|
|
38
|
+
*/
|
|
39
|
+
export interface WandToolHost extends IViewportHost, IRegionDataHost {
|
|
40
|
+
/** Pixel data for sampling. null when no image is loaded yet. */
|
|
41
|
+
getCachedImageData(): CachedImageData | null;
|
|
42
|
+
/** Index of the currently visible frame in a stack (0 for non-stack). */
|
|
43
|
+
getActiveFrameIndex(): number;
|
|
44
|
+
/** Current image's filename — stamped onto new shapes for filtering. */
|
|
45
|
+
getFileName(): string | undefined;
|
|
46
|
+
/** Default stroke colour for new shapes. */
|
|
47
|
+
getShapeColor(): string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The wand drawing tool. Owns its own canvas overlay, mouse handlers, and
|
|
51
|
+
* stroke accumulator. Reads/writes the shape list via the WandToolHost
|
|
52
|
+
* interface so it stays decoupled from PlotlyService internals.
|
|
53
|
+
*
|
|
54
|
+
* Lifecycle: PlotlyService injects this service, calls `bindHost(this)` once
|
|
55
|
+
* during its own construction, then calls `setMode(true | false, options)` to
|
|
56
|
+
* activate/deactivate the tool.
|
|
57
|
+
*/
|
|
58
|
+
export declare class WandToolService {
|
|
59
|
+
private wandService;
|
|
60
|
+
private host;
|
|
61
|
+
private overlay;
|
|
62
|
+
private active;
|
|
63
|
+
/**
|
|
64
|
+
* Accumulated wand region. Every per-tick patch mask is OR'd into `mask`
|
|
65
|
+
* over a bbox that grows with the stroke, so the region keeps expanding
|
|
66
|
+
* as the user drags. The accumulator persists across mouseup/mousedown so
|
|
67
|
+
* that subsequent strokes extend the *same* region — matching QuPath's
|
|
68
|
+
* brush behaviour where the active annotation stays editable until the
|
|
69
|
+
* user switches tool.
|
|
70
|
+
*/
|
|
71
|
+
private stroke;
|
|
72
|
+
/** Id of the region this wand stroke is editing (null = a fresh region). */
|
|
73
|
+
private strokeRegionId;
|
|
74
|
+
/** Readback ratio/origin signature the active stroke's matrix coords are tied to; a change
|
|
75
|
+
* (zoom/pan) invalidates the stroke so it isn't re-committed at a different scale (jit-ui#102). */
|
|
76
|
+
private strokeRatioSig;
|
|
77
|
+
private dragging;
|
|
78
|
+
private options;
|
|
79
|
+
private readonly boundMouseDown;
|
|
80
|
+
private readonly boundMouseMove;
|
|
81
|
+
private readonly boundMouseUp;
|
|
82
|
+
constructor(wandService: WandService);
|
|
83
|
+
/** Wire the tool to its host. Must be called once before `setMode(true)`. */
|
|
84
|
+
bindHost(host: WandToolHost): void;
|
|
85
|
+
/** Toggle the wand on/off. */
|
|
86
|
+
setMode(active: boolean, options?: WandOptions): void;
|
|
87
|
+
/** Merge new options (e.g. live sensitivity slider updates). */
|
|
88
|
+
setOptions(options: WandOptions): void;
|
|
89
|
+
/** Drop the active wand region so the next click starts a new one. */
|
|
90
|
+
clearActiveRegion(): void;
|
|
91
|
+
private createOverlay;
|
|
92
|
+
private destroyOverlay;
|
|
93
|
+
private onMouseDown;
|
|
94
|
+
private onMouseMove;
|
|
95
|
+
private onMouseUp;
|
|
96
|
+
private resetStroke;
|
|
97
|
+
/**
|
|
98
|
+
* Sample the cached image at the click location, OR (or AND-NOT) the
|
|
99
|
+
* wand's per-tick patch mask into the active region's bbox-relative mask,
|
|
100
|
+
* re-trace the boundary, and update the in-progress shape — matching
|
|
101
|
+
* QuPath's additive brush/wand behaviour. Shift = erase. Cmd/Ctrl =
|
|
102
|
+
* exact-match flood fill.
|
|
103
|
+
*/
|
|
104
|
+
private applyAtClient;
|
|
105
|
+
/** True if (matrixX, matrixY) lies inside the current stroke accumulator. */
|
|
106
|
+
private pointInStroke;
|
|
107
|
+
/**
|
|
108
|
+
* Remove the region referenced by `strokeRegionId` from the region list and
|
|
109
|
+
* reset the active stroke — used when an erase stroke deletes every pixel.
|
|
110
|
+
*/
|
|
111
|
+
private dropActiveShape;
|
|
112
|
+
/**
|
|
113
|
+
* Whether a region can be faithfully rasterized into the wand stroke at the current view
|
|
114
|
+
* resolution (rx/ry = data units per matrix pixel). Editing rasterizes the region to the
|
|
115
|
+
* viewport grid and re-traces it, so a region whose matrix-space bbox exceeds the rasterizer's
|
|
116
|
+
* cap would be clipped/down-quantized and come back rescaled/corrupted (jit-ui#102) — e.g. a
|
|
117
|
+
* whole-slide annotation while zoomed out. Skip adopt/merge for those: leave them untouched and
|
|
118
|
+
* only edit them near native zoom.
|
|
119
|
+
*/
|
|
120
|
+
private fitsForEdit;
|
|
121
|
+
/** A region's closed-polygon vertices (image/data coords), or null when it
|
|
122
|
+
* isn't a fillable closed polygon (rectangles, open polylines). */
|
|
123
|
+
private regionVerts;
|
|
124
|
+
/** Convert a region's hole rings from image/data coords into matrix coords so
|
|
125
|
+
* they line up with the stroke accumulator (jit-ui#85). */
|
|
126
|
+
private holesToMatrix;
|
|
127
|
+
/**
|
|
128
|
+
* If (matrixX, matrixY) falls inside an existing region, rasterize it into
|
|
129
|
+
* the wand stroke accumulator so subsequent wand input extends it rather than
|
|
130
|
+
* starting a new region.
|
|
131
|
+
*/
|
|
132
|
+
private tryAdoptShapeAt;
|
|
133
|
+
/**
|
|
134
|
+
* Iterate every region; if its rasterized mask overlaps the wand stroke mask
|
|
135
|
+
* by at least one pixel, OR it into the stroke and remove it from the list.
|
|
136
|
+
* Called every tick so chained merges resolve. If the wand has no region id
|
|
137
|
+
* yet, the merged region's id is adopted so the merged region replaces it.
|
|
138
|
+
*/
|
|
139
|
+
private mergeOverlappingShapes;
|
|
140
|
+
/**
|
|
141
|
+
* Commit the in-progress polygon as a region — a new region on the first tick
|
|
142
|
+
* of a stroke, or an in-place replacement of the active region on later ticks
|
|
143
|
+
* — then ask the host to render. The store mints an id on the first commit,
|
|
144
|
+
* which we adopt so subsequent ticks replace the same region.
|
|
145
|
+
*/
|
|
146
|
+
private commitStroke;
|
|
147
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WandToolService, never>;
|
|
148
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WandToolService>;
|
|
149
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Polygon } from '../../models/region';
|
|
2
|
+
import { IWandOptions, WandType } from '../../contracts/display-types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export type { WandType };
|
|
5
|
+
export type WandOptions = IWandOptions;
|
|
6
|
+
export interface WandImage {
|
|
7
|
+
/**
|
|
8
|
+
* Grayscale: number[][] where data[y][x] is intensity.
|
|
9
|
+
* RGB: [r,g,b][][] where data[y][x] is a 3-tuple.
|
|
10
|
+
*/
|
|
11
|
+
data: number[][] | number[][][];
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
isGrayscale: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Wand region-growing tool, modelled after QuPath's WandToolEventHandler.
|
|
18
|
+
*
|
|
19
|
+
* Given an image and a click position, extracts a square patch around the
|
|
20
|
+
* click, optionally blurs it, computes a local threshold, runs a fixed-range
|
|
21
|
+
* flood fill from the centre, closes the resulting mask, and returns the
|
|
22
|
+
* traced contour as a polygon in image coordinates.
|
|
23
|
+
*/
|
|
24
|
+
export declare class WandService {
|
|
25
|
+
/**
|
|
26
|
+
* @param image full-image pixel matrix (already in memory).
|
|
27
|
+
* @param cx click x in image-pixel coordinates.
|
|
28
|
+
* @param cy click y in image-pixel coordinates.
|
|
29
|
+
* @param options wand parameters; missing fields fall back to defaults.
|
|
30
|
+
* @returns a Polygon in image-pixel coordinates, or null if no region grew.
|
|
31
|
+
*/
|
|
32
|
+
computeRegion(image: WandImage, cx: number, cy: number, options?: WandOptions): Polygon | null;
|
|
33
|
+
/**
|
|
34
|
+
* Compute the wand's per-click flood-fill mask in patch-local coordinates.
|
|
35
|
+
* Same algorithm as `computeRegion` but stops before contour tracing — useful
|
|
36
|
+
* for accumulating per-tick masks across a brush-style stroke.
|
|
37
|
+
*
|
|
38
|
+
* @returns mask of size W*W (0/1) plus W, or null if patchSize is invalid.
|
|
39
|
+
*/
|
|
40
|
+
computePatchMask(image: WandImage, cx: number, cy: number, options?: WandOptions): {
|
|
41
|
+
mask: Uint8Array;
|
|
42
|
+
size: number;
|
|
43
|
+
} | null;
|
|
44
|
+
/**
|
|
45
|
+
* Standard ray-cast point-in-polygon test. (px, py) and the polygon
|
|
46
|
+
* vertices must be in the same coordinate system.
|
|
47
|
+
*/
|
|
48
|
+
pointInPolygon(px: number, py: number, xpoints: number[], ypoints: number[]): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Drop every vertex whose Euclidean distance to (cx, cy) is less than
|
|
51
|
+
* `radius`. Returns trimmed parallel arrays plus how many vertices were
|
|
52
|
+
* removed (so the caller can detect a no-op tick and skip the relayout).
|
|
53
|
+
*/
|
|
54
|
+
dropVerticesWithinRadius(xpoints: number[], ypoints: number[], cx: number, cy: number, radius: number): {
|
|
55
|
+
xpoints: number[];
|
|
56
|
+
ypoints: number[];
|
|
57
|
+
removed: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Rasterize a closed polygon into a bbox-relative mask suitable as a
|
|
61
|
+
* starting point for a wand stroke accumulator.
|
|
62
|
+
*
|
|
63
|
+
* Returns the bbox origin (clamped to the image) plus the filled mask, or
|
|
64
|
+
* null if the polygon is degenerate or fully outside the image.
|
|
65
|
+
*/
|
|
66
|
+
rasterizePolygon(xpoints: number[], ypoints: number[], imageWidth: number, imageHeight: number, holes?: number[][][]): {
|
|
67
|
+
bx: number;
|
|
68
|
+
by: number;
|
|
69
|
+
bw: number;
|
|
70
|
+
bh: number;
|
|
71
|
+
mask: Uint8Array;
|
|
72
|
+
} | null;
|
|
73
|
+
/**
|
|
74
|
+
* Point-in-region test that honours interior rings (holes): inside the
|
|
75
|
+
* exterior AND outside every hole (even-odd). Coordinates must share the
|
|
76
|
+
* polygon's frame. With no holes this is exactly {@link pointInPolygon}.
|
|
77
|
+
*/
|
|
78
|
+
pointInPolygonWithHoles(px: number, py: number, xpoints: number[], ypoints: number[], holes?: number[][][]): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Trace the largest 4-connected blob in `mask` (sized w*h) and return a
|
|
81
|
+
* Polygon translated into image-pixel coordinates via (originX, originY).
|
|
82
|
+
* The traced vertices are NOT clamped to the image bounds: a region drawn while
|
|
83
|
+
* panned/zoomed keeps its true coordinates even where they fall outside the visible
|
|
84
|
+
* window (jit-ui#102). `imageWidth`/`imageHeight` are kept for signature compatibility
|
|
85
|
+
* but no longer used.
|
|
86
|
+
*/
|
|
87
|
+
maskToPolygon(mask: Uint8Array, w: number, h: number, _imageWidth: number, _imageHeight: number, originX: number, originY: number): Polygon | null;
|
|
88
|
+
/**
|
|
89
|
+
* Trace EVERY 4-connected blob in `mask` (sized w*h) whose area is at least
|
|
90
|
+
* `minSize` pixels, returning one Polygon per blob in image-pixel coordinates
|
|
91
|
+
* (translated via originX/originY, clamped to imageWidth/imageHeight), ordered
|
|
92
|
+
* largest-first. Unlike {@link maskToPolygon} (largest blob only), this lets
|
|
93
|
+
* the brush eraser split a region in two when a stroke cuts through it rather
|
|
94
|
+
* than discarding the smaller piece.
|
|
95
|
+
*/
|
|
96
|
+
maskToPolygons(mask: Uint8Array, w: number, h: number, imageWidth: number, imageHeight: number, originX: number, originY: number, minSize?: number, minHoleSize?: number): Polygon[];
|
|
97
|
+
/**
|
|
98
|
+
* Find interior rings (holes) of each foreground component in `mask`: a
|
|
99
|
+
* 4-connected run of background (0) pixels that is fully enclosed — i.e. not
|
|
100
|
+
* reachable from the grid border through background — is a hole, attributed to
|
|
101
|
+
* the foreground component that borders it most. Returns `fgLabel → rings`,
|
|
102
|
+
* each ring a list of `[x, y]` image-pixel pairs (same convention as a
|
|
103
|
+
* polygon's `coordinates`). Holes smaller than `minHoleSize` are dropped.
|
|
104
|
+
*/
|
|
105
|
+
private detectHoles;
|
|
106
|
+
/**
|
|
107
|
+
* Trace each instance in an integer label map (0 = background) into a Polygon
|
|
108
|
+
* — used to turn a cellpose-style segmentation into region outlines. Labels
|
|
109
|
+
* with area below `minSize` are skipped. Coords are translated via
|
|
110
|
+
* originX/originY and clamped to imageWidth/imageHeight.
|
|
111
|
+
*/
|
|
112
|
+
labelsToPolygons(labels: Uint32Array, w: number, h: number, imageWidth: number, imageHeight: number, originX: number, originY: number, minSize?: number): Polygon[];
|
|
113
|
+
private extractPatch;
|
|
114
|
+
private gaussianBlur;
|
|
115
|
+
private perChannelThreshold;
|
|
116
|
+
private labDistanceMap;
|
|
117
|
+
/**
|
|
118
|
+
* Fixed-range scanline flood fill from the patch centre. A neighbour is
|
|
119
|
+
* accepted iff for every channel `|p[c] - seed[c]| <= threshold[c]`.
|
|
120
|
+
*/
|
|
121
|
+
private floodFill;
|
|
122
|
+
private morphClose;
|
|
123
|
+
private dilate;
|
|
124
|
+
private erode;
|
|
125
|
+
/**
|
|
126
|
+
* Returns the outer boundary of the largest 4-connected blob in the mask
|
|
127
|
+
* sized w*h.
|
|
128
|
+
*/
|
|
129
|
+
private traceContour;
|
|
130
|
+
private mooreBoundary;
|
|
131
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WandService, never>;
|
|
132
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WandService>;
|
|
133
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* Collaboration interface the zoom-to-box tool needs from PlotlyService.
|
|
4
|
+
*/
|
|
5
|
+
export interface ZoomToBoxToolHost {
|
|
6
|
+
/** DOM id of the plot element the overlay canvas attaches to. */
|
|
7
|
+
getPlotDiv(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Convert an overlay-pixel point (relative to the plot element's top-left)
|
|
10
|
+
* into the backend's data coordinates — Plotly axis data for Plotly,
|
|
11
|
+
* image-pixel coords for OpenSeadragon. Keeps the tool backend-agnostic.
|
|
12
|
+
*/
|
|
13
|
+
pixelToData(px: number, py: number): {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Apply the user-selected zoom rectangle, ordered `[xMin, xMax, yMax, yMin]`.
|
|
19
|
+
* The host decides what that means: Plotly does a high-def re-fetch / axis
|
|
20
|
+
* relayout, OpenSeadragon fits the viewport to the image rectangle.
|
|
21
|
+
*/
|
|
22
|
+
applyZoomToBox(coordinates: number[]): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Custom canvas overlay for click-and-drag rectangular zoom. Plotly's
|
|
26
|
+
* built-in `dragmode: 'zoom'` works on heatmap/image traces too, but it
|
|
27
|
+
* doesn't drive the high-def zoom pipeline — this overlay does, by handing
|
|
28
|
+
* the selected coordinates back to the host.
|
|
29
|
+
*/
|
|
30
|
+
export declare class ZoomToBoxToolService {
|
|
31
|
+
private host;
|
|
32
|
+
private overlay;
|
|
33
|
+
private startPx;
|
|
34
|
+
private readonly boundMouseDown;
|
|
35
|
+
private readonly boundMouseMove;
|
|
36
|
+
private readonly boundMouseUp;
|
|
37
|
+
constructor();
|
|
38
|
+
bindHost(host: ZoomToBoxToolHost): void;
|
|
39
|
+
setMode(active: boolean): void;
|
|
40
|
+
private createOverlay;
|
|
41
|
+
private destroyOverlay;
|
|
42
|
+
private onMouseDown;
|
|
43
|
+
private onMouseMove;
|
|
44
|
+
private onMouseUp;
|
|
45
|
+
private drawSelection;
|
|
46
|
+
private clearCanvas;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ZoomToBoxToolService, never>;
|
|
48
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ZoomToBoxToolService>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./visualizer.component";
|
|
3
|
+
import * as i2 from "./toolbar/toolbar.component";
|
|
4
|
+
import * as i3 from "./region-editor/region-editor.component";
|
|
5
|
+
import * as i4 from "./hex-color-picker/hex-color-picker.component";
|
|
6
|
+
import * as i5 from "./channel-histogram/channel-histogram.component";
|
|
7
|
+
import * as i6 from "@angular/common";
|
|
8
|
+
import * as i7 from "@angular/forms";
|
|
9
|
+
import * as i8 from "primeng/toolbar";
|
|
10
|
+
import * as i9 from "primeng/button";
|
|
11
|
+
import * as i10 from "primeng/menu";
|
|
12
|
+
import * as i11 from "primeng/dropdown";
|
|
13
|
+
import * as i12 from "primeng/slider";
|
|
14
|
+
import * as i13 from "primeng/treeselect";
|
|
15
|
+
import * as i14 from "primeng/inputnumber";
|
|
16
|
+
import * as i15 from "primeng/dialog";
|
|
17
|
+
import * as i16 from "primeng/contextmenu";
|
|
18
|
+
import * as i17 from "primeng/progressbar";
|
|
19
|
+
import * as i18 from "primeng/toast";
|
|
20
|
+
import * as i19 from "primeng/tooltip";
|
|
21
|
+
import * as i20 from "primeng/ripple";
|
|
22
|
+
import * as i21 from "primeng/table";
|
|
23
|
+
import * as i22 from "primeng/paginator";
|
|
24
|
+
import * as i23 from "primeng/overlaypanel";
|
|
25
|
+
import * as i24 from "primeng/confirmdialog";
|
|
26
|
+
import * as i25 from "primeng/inputtext";
|
|
27
|
+
import * as i26 from "primeng/checkbox";
|
|
28
|
+
import * as i27 from "primeng/radiobutton";
|
|
29
|
+
import * as i28 from "primeng/selectbutton";
|
|
30
|
+
/**
|
|
31
|
+
* Self-contained plotting UI: the {@link VisualizerComponent} (plot surface
|
|
32
|
+
* + render orchestration), its {@link ToolbarComponent}, and the
|
|
33
|
+
* {@link RegionEditorComponent} (the Regions tab table/editor). Consumers embed
|
|
34
|
+
* `<visualizer>` / `<region-editor>` and need know nothing about the toolbar,
|
|
35
|
+
* the rendering backends, or region file I/O (supplied via the REGION_IO_PORT).
|
|
36
|
+
*
|
|
37
|
+
* Also exports {@link HexColorPickerComponent} (`<hex-color-picker>`) as a
|
|
38
|
+
* standalone reusable picker (`[color]` in, `(colorChange)` out) so consuming
|
|
39
|
+
* apps can use it on its own, the same way as the visualizer and region editor.
|
|
40
|
+
*/
|
|
41
|
+
export declare class VisualizationModule {
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VisualizationModule, never>;
|
|
43
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<VisualizationModule, [typeof i1.VisualizerComponent, typeof i2.ToolbarComponent, typeof i3.RegionEditorComponent, typeof i4.HexColorPickerComponent, typeof i5.ChannelHistogramComponent], [typeof i6.CommonModule, typeof i7.FormsModule, typeof i8.ToolbarModule, typeof i9.ButtonModule, typeof i10.MenuModule, typeof i11.DropdownModule, typeof i12.SliderModule, typeof i13.TreeSelectModule, typeof i14.InputNumberModule, typeof i15.DialogModule, typeof i16.ContextMenuModule, typeof i17.ProgressBarModule, typeof i18.ToastModule, typeof i19.TooltipModule, typeof i20.RippleModule, typeof i21.TableModule, typeof i22.PaginatorModule, typeof i23.OverlayPanelModule, typeof i24.ConfirmDialogModule, typeof i25.InputTextModule, typeof i26.CheckboxModule, typeof i27.RadioButtonModule, typeof i28.SelectButtonModule], [typeof i1.VisualizerComponent, typeof i3.RegionEditorComponent, typeof i4.HexColorPickerComponent, typeof i5.ChannelHistogramComponent]>;
|
|
44
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<VisualizationModule>;
|
|
45
|
+
}
|