@jax-data-science/sci-image-visualizer 0.8.2 → 0.9.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.
Files changed (525) hide show
  1. package/README.md +201 -460
  2. package/esm2022/index.mjs +28 -15
  3. package/esm2022/lib/channel-histogram/channel-histogram.component.mjs +163 -91
  4. package/esm2022/lib/contracts/capabilities.contract.mjs +4 -3
  5. package/esm2022/lib/contracts/cell-segmenter.contract.mjs +1 -1
  6. package/esm2022/lib/contracts/channel-histogram-api.contract.mjs +5 -1
  7. package/esm2022/lib/contracts/color.mjs +60 -0
  8. package/esm2022/lib/contracts/colormap-lut.mjs +213 -57
  9. package/esm2022/lib/contracts/coordinate-transform.contract.mjs +1 -1
  10. package/esm2022/lib/contracts/display-types.mjs +11 -1
  11. package/esm2022/lib/contracts/instance-segmenter.contract.mjs +1 -1
  12. package/esm2022/lib/contracts/intensity.mjs +48 -5
  13. package/esm2022/lib/contracts/plot-type-contribution.contract.mjs +1 -1
  14. package/esm2022/lib/contracts/plot-type.mjs +134 -17
  15. package/esm2022/lib/contracts/ports/image-state.port.mjs +4 -1
  16. package/esm2022/lib/contracts/ports/preferences.port.mjs +5 -1
  17. package/esm2022/lib/contracts/ports/region-io.port.mjs +2 -1
  18. package/esm2022/lib/contracts/ports/spatial-data.port.mjs +5 -1
  19. package/esm2022/lib/contracts/ports/tile-access.port.mjs +2 -1
  20. package/esm2022/lib/contracts/region-editor-api.contract.mjs +1 -1
  21. package/esm2022/lib/contracts/region-overlay.contract.mjs +1 -1
  22. package/esm2022/lib/contracts/sam.contract.mjs +1 -1
  23. package/esm2022/lib/contracts/semantic-segmenter.contract.mjs +1 -1
  24. package/esm2022/lib/contracts/spatial-dataset.contract.mjs +3 -1
  25. package/esm2022/lib/contracts/toolbar-tool.contract.mjs +6 -4
  26. package/esm2022/lib/contracts/visualizer.contract.mjs +1 -1
  27. package/esm2022/lib/contracts/viz-config.mjs +2 -1
  28. package/esm2022/lib/geometry/contour.mjs +63 -0
  29. package/esm2022/lib/geometry/raster.mjs +98 -0
  30. package/esm2022/lib/geometry/ring.mjs +201 -0
  31. package/esm2022/lib/hex-color-picker/hex-color-picker.component.mjs +202 -102
  32. package/esm2022/lib/implementations/base-store-visualizer.mjs +201 -48
  33. package/esm2022/lib/implementations/napari-js/napari-axes-gizmo.mjs +65 -0
  34. package/esm2022/lib/implementations/napari-js/napari-display-state.mjs +136 -0
  35. package/esm2022/lib/implementations/napari-js/napari-helpers.mjs +199 -0
  36. package/esm2022/lib/implementations/napari-js/napari-image-2d-scene.mjs +602 -0
  37. package/esm2022/lib/implementations/napari-js/napari-loading-badge.mjs +3 -4
  38. package/esm2022/lib/implementations/napari-js/napari-loading-state.mjs +66 -0
  39. package/esm2022/lib/implementations/napari-js/napari-region-overlay.mjs +157 -591
  40. package/esm2022/lib/implementations/napari-js/napari-scene.mjs +2 -0
  41. package/esm2022/lib/implementations/napari-js/napari-spatial-2d-scene.mjs +614 -0
  42. package/esm2022/lib/implementations/napari-js/napari-spatial-3d-scene.mjs +769 -0
  43. package/esm2022/lib/implementations/napari-js/napari-spatial-encoding.mjs +199 -0
  44. package/esm2022/lib/implementations/napari-js/napari-spatial-hover.mjs +263 -0
  45. package/esm2022/lib/implementations/napari-js/napari-spatial-scene.mjs +159 -0
  46. package/esm2022/lib/implementations/napari-js/napari-spatial-tiles.mjs +106 -1408
  47. package/esm2022/lib/implementations/napari-js/napari-spatial-tooltip.mjs +2 -2
  48. package/esm2022/lib/implementations/napari-js/napari-surface-scene.mjs +271 -0
  49. package/esm2022/lib/implementations/napari-js/napari-tile-client.mjs +562 -0
  50. package/esm2022/lib/implementations/napari-js/napari-tool-bridge.mjs +344 -0
  51. package/esm2022/lib/implementations/napari-js/napari-visualizer.service.mjs +361 -4184
  52. package/esm2022/lib/implementations/napari-js/napari-volume-scene.mjs +439 -0
  53. package/esm2022/lib/implementations/napari-js/napari-volume-z-handle.mjs +6 -6
  54. package/esm2022/lib/implementations/napari-js/region-overlay/overlay-projection.mjs +96 -0
  55. package/esm2022/lib/implementations/napari-js/region-overlay/region-edit.mjs +35 -0
  56. package/esm2022/lib/implementations/napari-js/region-overlay/region-svg-renderer.mjs +182 -0
  57. package/esm2022/lib/implementations/napari-js/spatial-tiles/categorical-lookup.mjs +30 -0
  58. package/esm2022/lib/implementations/napari-js/spatial-tiles/cell-layers.mjs +274 -0
  59. package/esm2022/lib/implementations/napari-js/spatial-tiles/density-layer.mjs +144 -0
  60. package/esm2022/lib/implementations/napari-js/spatial-tiles/layer-groups.mjs +165 -0
  61. package/esm2022/lib/implementations/napari-js/spatial-tiles/plan-context.mjs +78 -0
  62. package/esm2022/lib/implementations/napari-js/spatial-tiles/transcript-hover.mjs +182 -0
  63. package/esm2022/lib/implementations/napari-js/spatial-tiles/transcript-jobs.mjs +369 -0
  64. package/esm2022/lib/implementations/napari-js/spatial-tiles/transcript-layers.mjs +306 -0
  65. package/esm2022/lib/implementations/osd/display-pipeline.mjs +102 -40
  66. package/esm2022/lib/implementations/osd/histogram-sampler.mjs +56 -31
  67. package/esm2022/lib/implementations/osd/openseadragon-viewer-options.mjs +128 -0
  68. package/esm2022/lib/implementations/osd/openseadragon-visualizer.service.mjs +333 -1685
  69. package/esm2022/lib/implementations/osd/osd-coordinate-transform.mjs +1 -1
  70. package/esm2022/lib/implementations/osd/osd-coords.mjs +5 -6
  71. package/esm2022/lib/implementations/osd/osd-export.mjs +122 -0
  72. package/esm2022/lib/implementations/osd/osd-lib.mjs +15 -1
  73. package/esm2022/lib/implementations/osd/osd-navigator-chrome.mjs +205 -0
  74. package/esm2022/lib/implementations/osd/osd-pixel-readback.mjs +68 -0
  75. package/esm2022/lib/implementations/osd/osd-region-overlay-draw.mjs +153 -0
  76. package/esm2022/lib/implementations/osd/osd-region-overlay.mjs +185 -718
  77. package/esm2022/lib/implementations/osd/osd-scale-bar.mjs +52 -60
  78. package/esm2022/lib/implementations/osd/osd-tile-source.mjs +105 -0
  79. package/esm2022/lib/implementations/osd/osd-viewer-like.mjs +2 -0
  80. package/esm2022/lib/implementations/osd/osd-viewer-mount.mjs +44 -0
  81. package/esm2022/lib/implementations/osd/osd-viewport.mjs +184 -0
  82. package/esm2022/lib/implementations/osd/osd-zoom.mjs +7 -1
  83. package/esm2022/lib/implementations/osd/simple-source.mjs +395 -0
  84. package/esm2022/lib/implementations/osd/slice-cache.mjs +53 -48
  85. package/esm2022/lib/implementations/osd/tile-client.mjs +32 -11
  86. package/esm2022/lib/implementations/osd/tile-recolor.mjs +330 -0
  87. package/esm2022/lib/implementations/plotly/omics-trace-builders.mjs +161 -73
  88. package/esm2022/lib/implementations/plotly/plotly-coordinate-transform.mjs +1 -1
  89. package/esm2022/lib/implementations/plotly/plotly-image-loader.mjs +112 -0
  90. package/esm2022/lib/implementations/plotly/plotly-image-recolor.mjs +178 -0
  91. package/esm2022/lib/implementations/plotly/plotly-intensity-inset.mjs +33 -0
  92. package/esm2022/lib/implementations/plotly/plotly-isosurface-controls.mjs +83 -0
  93. package/esm2022/lib/implementations/plotly/plotly-layouts.mjs +121 -0
  94. package/esm2022/lib/implementations/plotly/plotly-readback.mjs +117 -0
  95. package/esm2022/lib/implementations/plotly/plotly-region-overlay.mjs +19 -10
  96. package/esm2022/lib/implementations/plotly/plotly-shape-projection.mjs +223 -0
  97. package/esm2022/lib/implementations/plotly/plotly-trace-builders.mjs +79 -19
  98. package/esm2022/lib/implementations/plotly/plotly-zoom-controller.mjs +223 -0
  99. package/esm2022/lib/implementations/plotly/plotly.service.mjs +439 -1655
  100. package/esm2022/lib/implementations/region-centroids.mjs +47 -0
  101. package/esm2022/lib/implementations/simple-slice-access.service.mjs +22 -12
  102. package/esm2022/lib/implementations/spatial-data-http/spatial-data-http.service.mjs +172 -92
  103. package/esm2022/lib/implementations/spatial-data-http/spatial-wire.mjs +103 -22
  104. package/esm2022/lib/implementations/tile-server/index.mjs +6 -0
  105. package/esm2022/lib/implementations/tile-server/native-histogram.mjs +30 -0
  106. package/esm2022/lib/implementations/tile-server/poll-descriptor.mjs +65 -0
  107. package/esm2022/lib/implementations/tile-server/tile-protocol.mjs +42 -0
  108. package/esm2022/lib/implementations/tile-server/transport.mjs +135 -0
  109. package/esm2022/lib/intensity/intensity-profile.mjs +107 -0
  110. package/esm2022/lib/intensity/intensity-profile.service.mjs +223 -0
  111. package/esm2022/lib/intensity-inset/intensity-inset.component.mjs +133 -0
  112. package/esm2022/lib/models/bezier.mjs +1 -11
  113. package/esm2022/lib/models/class-preset.mjs +41 -3
  114. package/esm2022/lib/models/geometry.mjs +27 -164
  115. package/esm2022/lib/models/polygon-edit.mjs +254 -0
  116. package/esm2022/lib/models/polygon-factory.mjs +118 -0
  117. package/esm2022/lib/models/region-clone.mjs +68 -0
  118. package/esm2022/lib/models/region-geojson.mjs +373 -0
  119. package/esm2022/lib/models/region.mjs +34 -33
  120. package/esm2022/lib/models/shape.mjs +18 -16
  121. package/esm2022/lib/plot-mode/contribution-host.mjs +297 -0
  122. package/esm2022/lib/plot-mode/plot-mode-controller.mjs +9 -6
  123. package/esm2022/lib/plot-mode/plot-type-menu.mjs +85 -0
  124. package/esm2022/lib/plot-mode/tool-params-model.mjs +87 -0
  125. package/esm2022/lib/plot.utilities.mjs +296 -473
  126. package/esm2022/lib/processing/image-crop.mjs +1 -1
  127. package/esm2022/lib/processing/processing-image.mjs +28 -15
  128. package/esm2022/lib/provide-visualization.mjs +40 -14
  129. package/esm2022/lib/region-editor/classes-panel/classes-panel.component.mjs +99 -0
  130. package/esm2022/lib/region-editor/file-stem.mjs +13 -0
  131. package/esm2022/lib/region-editor/manage-classes-dialog/manage-classes-dialog.component.mjs +118 -0
  132. package/esm2022/lib/region-editor/mask-export.service.mjs +98 -0
  133. package/esm2022/lib/region-editor/mask-raster.mjs +11 -5
  134. package/esm2022/lib/region-editor/region-color-dialog/region-color-dialog.component.mjs +56 -0
  135. package/esm2022/lib/region-editor/region-editor-help/region-editor-help.component.mjs +28 -0
  136. package/esm2022/lib/region-editor/region-editor.component.mjs +402 -651
  137. package/esm2022/lib/region-editor/region-metrics.mjs +68 -0
  138. package/esm2022/lib/region-editor/region-persistence.service.mjs +134 -0
  139. package/esm2022/lib/region-editor/region-table/region-table.component.mjs +153 -0
  140. package/esm2022/lib/region-editor/save-mask-dialog/save-mask-dialog.component.mjs +91 -0
  141. package/esm2022/lib/region-editor/save-regions-dialog/save-regions-dialog.component.mjs +92 -0
  142. package/esm2022/lib/region-ops.service.mjs +28 -70
  143. package/esm2022/lib/region-overlay/region-geometry.mjs +360 -0
  144. package/esm2022/lib/region-overlay/region-hit-test.mjs +103 -0
  145. package/esm2022/lib/region-overlay/svg-region-renderer.mjs +228 -0
  146. package/esm2022/lib/render-orchestrator.mjs +14 -11
  147. package/esm2022/lib/render-session.mjs +207 -0
  148. package/esm2022/lib/routing-visualizer.service.mjs +459 -411
  149. package/esm2022/lib/spatial/density-raster.mjs +14 -0
  150. package/esm2022/lib/spatial/embedding-compute-coordinator.mjs +239 -0
  151. package/esm2022/lib/spatial/embedding-compute.mjs +43 -10
  152. package/esm2022/lib/spatial/gene-search.mjs +1 -1
  153. package/esm2022/lib/spatial/glyphs.mjs +97 -0
  154. package/esm2022/lib/spatial/lod.mjs +187 -0
  155. package/esm2022/lib/spatial/spatial-controls.facade.mjs +200 -0
  156. package/esm2022/lib/spatial/spatial-density.mjs +25 -16
  157. package/esm2022/lib/spatial/spatial-encoding.mjs +26 -82
  158. package/esm2022/lib/spatial/spatial-expression.mjs +43 -42
  159. package/esm2022/lib/spatial/spatial-framing.mjs +1 -1
  160. package/esm2022/lib/spatial/spatial-heatmap.mjs +6 -3
  161. package/esm2022/lib/spatial/spatial-hover.mjs +5 -33
  162. package/esm2022/lib/spatial/spatial-panel-model.mjs +282 -0
  163. package/esm2022/lib/spatial/spatial-sections.mjs +1 -1
  164. package/esm2022/lib/spatial/spatial-selection.mjs +33 -46
  165. package/esm2022/lib/spatial/spatial-tile-merge.mjs +219 -0
  166. package/esm2022/lib/spatial/spatial-tiles.mjs +12 -648
  167. package/esm2022/lib/spatial/spatial-volume-image.mjs +2 -4
  168. package/esm2022/lib/spatial/stats.mjs +71 -0
  169. package/esm2022/lib/spatial/transcript-grouping.mjs +307 -0
  170. package/esm2022/lib/spatial-controls/spatial-cells-panel/spatial-cells-panel.component.mjs +150 -0
  171. package/esm2022/lib/spatial-controls/spatial-charts/chart-data-model.mjs +309 -0
  172. package/esm2022/lib/spatial-controls/spatial-charts/chart-help.mjs +145 -0
  173. package/esm2022/lib/spatial-controls/spatial-charts/plotly-chart-host.mjs +158 -0
  174. package/esm2022/lib/spatial-controls/spatial-charts/spatial-chart-window/spatial-chart-window.component.mjs +47 -0
  175. package/esm2022/lib/spatial-controls/spatial-charts/spatial-charts.component.mjs +297 -802
  176. package/esm2022/lib/spatial-controls/spatial-charts/spatial-embedding-controls/spatial-embedding-controls.component.mjs +89 -0
  177. package/esm2022/lib/spatial-controls/spatial-charts/spatial-heatmap-controls/spatial-heatmap-controls.component.mjs +52 -0
  178. package/esm2022/lib/spatial-controls/spatial-controls.component.mjs +143 -1238
  179. package/esm2022/lib/spatial-controls/spatial-gene-picker.mjs +153 -0
  180. package/esm2022/lib/spatial-controls/spatial-gene-tree/spatial-gene-tree.component.mjs +241 -0
  181. package/esm2022/lib/spatial-controls/spatial-groups-panel/spatial-groups-panel.component.mjs +193 -0
  182. package/esm2022/lib/spatial-controls/spatial-key/spatial-key.component.mjs +132 -0
  183. package/esm2022/lib/spatial-controls/spatial-key/spatial-key.model.mjs +67 -0
  184. package/esm2022/lib/spatial-controls/spatial-marker-genes-form/spatial-marker-genes-form.component.mjs +147 -0
  185. package/esm2022/lib/spatial-controls/spatial-observations-panel/spatial-observations-panel.component.mjs +300 -0
  186. package/esm2022/lib/spatial-controls/spatial-transcripts-panel/spatial-transcripts-panel.component.mjs +370 -0
  187. package/esm2022/lib/store/class-color.util.mjs +46 -3
  188. package/esm2022/lib/store/region-history.mjs +146 -0
  189. package/esm2022/lib/store/region-scope-cache.mjs +140 -0
  190. package/esm2022/lib/store/region-selection.mjs +82 -0
  191. package/esm2022/lib/store/region-store.service.mjs +279 -675
  192. package/esm2022/lib/store/spatial-selection.service.mjs +2 -2
  193. package/esm2022/lib/store/visualizer-store.service.mjs +49 -71
  194. package/esm2022/lib/toast-outlets.mjs +5 -4
  195. package/esm2022/lib/toolbar/brush/brush-tool.service.mjs +92 -434
  196. package/esm2022/lib/toolbar/canvas-tools.mjs +20 -0
  197. package/esm2022/lib/toolbar/crop/slide-crop.mjs +26 -42
  198. package/esm2022/lib/toolbar/plot-type-selector/plot-type-selector.component.mjs +85 -0
  199. package/esm2022/lib/toolbar/region-tools/region-tool-buttons.mjs +74 -0
  200. package/esm2022/lib/toolbar/region-tools/region-tools.component.mjs +114 -0
  201. package/esm2022/lib/toolbar/segmentation/cell-segment-tool.service.mjs +74 -78
  202. package/esm2022/lib/toolbar/segmentation/cellpose-segmenter.service.mjs +50 -8
  203. package/esm2022/lib/toolbar/segmentation/onnx-sam-session.mjs +61 -42
  204. package/esm2022/lib/toolbar/segmentation/pending-calls.mjs +47 -0
  205. package/esm2022/lib/toolbar/segmentation/sam-model-registry.mjs +12 -4
  206. package/esm2022/lib/toolbar/segmentation/sam-onnx-core.mjs +70 -14
  207. package/esm2022/lib/toolbar/segmentation/sam-point-tool.service.mjs +135 -172
  208. package/esm2022/lib/toolbar/segmentation/sam-prompt.mjs +9 -90
  209. package/esm2022/lib/toolbar/segmentation/sam-session.service.mjs +183 -0
  210. package/esm2022/lib/toolbar/segmentation/sam-tool.service.mjs +95 -150
  211. package/esm2022/lib/toolbar/segmentation/segmentation-commit.mjs +12 -0
  212. package/esm2022/lib/toolbar/segmentation/segmentation-runner.mjs +108 -0
  213. package/esm2022/lib/toolbar/segmentation-tools/segmentation-tools.component.mjs +155 -0
  214. package/esm2022/lib/toolbar/stack-controls/stack-controls.component.mjs +81 -0
  215. package/esm2022/lib/toolbar/tool-kit/async-tool-status.mjs +37 -0
  216. package/esm2022/lib/toolbar/tool-kit/canvas-tool-manager.mjs +63 -0
  217. package/esm2022/lib/toolbar/tool-kit/canvas-tool.mjs +2 -0
  218. package/esm2022/lib/toolbar/tool-kit/frame-pixels.mjs +108 -0
  219. package/esm2022/lib/toolbar/tool-kit/mask-stroke-editor.mjs +306 -0
  220. package/esm2022/lib/toolbar/tool-kit/matrix-frame.mjs +61 -0
  221. package/esm2022/lib/toolbar/tool-kit/tool-overlay.mjs +140 -0
  222. package/esm2022/lib/toolbar/tool-kit/undo-gesture.mjs +24 -0
  223. package/esm2022/lib/toolbar/tool-slider/tool-slider.component.mjs +63 -0
  224. package/esm2022/lib/toolbar/toolbar-help-dialog/toolbar-help-dialog.component.mjs +50 -0
  225. package/esm2022/lib/toolbar/toolbar.component.mjs +68 -117
  226. package/esm2022/lib/toolbar/vertex-eraser/vertex-eraser-tool.service.mjs +93 -115
  227. package/esm2022/lib/toolbar/view-controls/view-controls.component.mjs +107 -0
  228. package/esm2022/lib/toolbar/wand/wand-region-grow.mjs +321 -0
  229. package/esm2022/lib/toolbar/wand/wand-tool.service.mjs +121 -416
  230. package/esm2022/lib/toolbar/wand/wand.service.mjs +30 -894
  231. package/esm2022/lib/toolbar/zoom-to-box/zoom-to-box-tool.service.mjs +48 -90
  232. package/esm2022/lib/util/mark-for-check.mjs +17 -0
  233. package/esm2022/lib/util/supersede.mjs +56 -0
  234. package/esm2022/lib/visualization.module.mjs +39 -141
  235. package/esm2022/lib/visualizer/floating-drag.directive.mjs +58 -0
  236. package/esm2022/lib/visualizer/region-actions.mjs +149 -0
  237. package/esm2022/lib/visualizer/region-load.mjs +60 -0
  238. package/esm2022/lib/visualizer/spatial-dataset-binder.mjs +163 -0
  239. package/esm2022/lib/visualizer/tool-modes.mjs +113 -0
  240. package/esm2022/lib/visualizer/viewer-shortcuts.mjs +167 -0
  241. package/esm2022/lib/visualizer/visualizer-context-menu.mjs +119 -0
  242. package/esm2022/lib/visualizer.component.mjs +480 -1902
  243. package/esm2022/lib/workers/spatial-math-ops.mjs +43 -0
  244. package/esm2022/lib/workers/spatial-math-worker.mjs +10 -0
  245. package/esm2022/lib/workers/spatial-math.mjs +190 -0
  246. package/fesm2022/jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-Csxlnq7I.mjs +41083 -0
  247. package/fesm2022/jax-data-science-sci-image-visualizer-jax-data-science-sci-image-visualizer-Csxlnq7I.mjs.map +1 -0
  248. package/fesm2022/jax-data-science-sci-image-visualizer-onnx-sam-session-Bkujqg7m.mjs +238 -0
  249. package/fesm2022/jax-data-science-sci-image-visualizer-onnx-sam-session-Bkujqg7m.mjs.map +1 -0
  250. package/fesm2022/jax-data-science-sci-image-visualizer-spatial-math-worker-BzVFFqGS.mjs +12 -0
  251. package/fesm2022/jax-data-science-sci-image-visualizer-spatial-math-worker-BzVFFqGS.mjs.map +1 -0
  252. package/fesm2022/jax-data-science-sci-image-visualizer.mjs +41 -34430
  253. package/fesm2022/jax-data-science-sci-image-visualizer.mjs.map +1 -1
  254. package/fesm2022/mask.worker.js +36 -917
  255. package/fesm2022/onnx-sam.worker.js +52 -16
  256. package/fesm2022/spatial-math.worker.js +471 -0
  257. package/fesm2022/tsne.worker.js +32 -15
  258. package/index.d.ts +13 -10
  259. package/lib/channel-histogram/channel-histogram.component.d.ts +53 -43
  260. package/lib/contracts/capabilities.contract.d.ts +4 -2
  261. package/lib/contracts/cell-segmenter.contract.d.ts +1 -0
  262. package/lib/contracts/channel-histogram-api.contract.d.ts +4 -0
  263. package/lib/contracts/color.d.ts +27 -0
  264. package/lib/contracts/colormap-lut.d.ts +19 -4
  265. package/lib/contracts/coordinate-transform.contract.d.ts +3 -3
  266. package/lib/contracts/display-types.d.ts +21 -0
  267. package/lib/contracts/instance-segmenter.contract.d.ts +5 -0
  268. package/lib/contracts/intensity.d.ts +13 -2
  269. package/lib/contracts/plot-type.d.ts +3 -1
  270. package/lib/contracts/ports/image-state.port.d.ts +6 -2
  271. package/lib/contracts/ports/preferences.port.d.ts +4 -0
  272. package/lib/contracts/ports/region-io.port.d.ts +1 -0
  273. package/lib/contracts/ports/spatial-data.port.d.ts +4 -10
  274. package/lib/contracts/ports/tile-access.port.d.ts +1 -0
  275. package/lib/contracts/region-editor-api.contract.d.ts +1 -1
  276. package/lib/contracts/region-overlay.contract.d.ts +5 -0
  277. package/lib/contracts/sam.contract.d.ts +7 -0
  278. package/lib/contracts/semantic-segmenter.contract.d.ts +6 -0
  279. package/lib/contracts/spatial-dataset.contract.d.ts +19 -6
  280. package/lib/contracts/toolbar-tool.contract.d.ts +1 -0
  281. package/lib/contracts/visualizer.contract.d.ts +221 -54
  282. package/lib/contracts/viz-config.d.ts +1 -0
  283. package/lib/geometry/contour.d.ts +24 -0
  284. package/lib/geometry/raster.d.ts +42 -0
  285. package/lib/geometry/ring.d.ts +67 -0
  286. package/lib/hex-color-picker/hex-color-picker.component.d.ts +61 -27
  287. package/lib/implementations/base-store-visualizer.d.ts +61 -15
  288. package/lib/implementations/napari-js/napari-axes-gizmo.d.ts +36 -0
  289. package/lib/implementations/napari-js/napari-display-state.d.ts +76 -0
  290. package/lib/implementations/napari-js/napari-helpers.d.ts +129 -0
  291. package/lib/implementations/napari-js/napari-image-2d-scene.d.ts +162 -0
  292. package/lib/implementations/napari-js/napari-loading-badge.d.ts +0 -1
  293. package/lib/implementations/napari-js/napari-loading-state.d.ts +30 -0
  294. package/lib/implementations/napari-js/napari-region-overlay.d.ts +62 -70
  295. package/lib/implementations/napari-js/napari-scene.d.ts +93 -0
  296. package/lib/implementations/napari-js/napari-spatial-2d-scene.d.ts +163 -0
  297. package/lib/implementations/napari-js/napari-spatial-3d-scene.d.ts +212 -0
  298. package/lib/implementations/napari-js/napari-spatial-encoding.d.ts +114 -0
  299. package/lib/implementations/napari-js/napari-spatial-hover.d.ts +89 -0
  300. package/lib/implementations/napari-js/napari-spatial-scene.d.ts +118 -0
  301. package/lib/implementations/napari-js/napari-spatial-tiles.d.ts +56 -263
  302. package/lib/implementations/napari-js/napari-spatial-tooltip.d.ts +1 -1
  303. package/lib/implementations/napari-js/napari-surface-scene.d.ts +76 -0
  304. package/lib/implementations/napari-js/napari-tile-client.d.ts +214 -0
  305. package/lib/implementations/napari-js/napari-tool-bridge.d.ts +179 -0
  306. package/lib/implementations/napari-js/napari-visualizer.service.d.ts +121 -878
  307. package/lib/implementations/napari-js/napari-volume-scene.d.ts +104 -0
  308. package/lib/implementations/napari-js/napari-volume-z-handle.d.ts +8 -12
  309. package/lib/implementations/napari-js/region-overlay/overlay-projection.d.ts +59 -0
  310. package/lib/implementations/napari-js/region-overlay/region-edit.d.ts +15 -0
  311. package/lib/implementations/napari-js/region-overlay/region-svg-renderer.d.ts +54 -0
  312. package/lib/implementations/napari-js/spatial-tiles/categorical-lookup.d.ts +26 -0
  313. package/lib/implementations/napari-js/spatial-tiles/cell-layers.d.ts +70 -0
  314. package/lib/implementations/napari-js/spatial-tiles/density-layer.d.ts +61 -0
  315. package/lib/implementations/napari-js/spatial-tiles/layer-groups.d.ts +67 -0
  316. package/lib/implementations/napari-js/spatial-tiles/plan-context.d.ts +38 -0
  317. package/lib/implementations/napari-js/spatial-tiles/transcript-hover.d.ts +71 -0
  318. package/lib/implementations/napari-js/spatial-tiles/transcript-jobs.d.ts +105 -0
  319. package/lib/implementations/napari-js/spatial-tiles/transcript-layers.d.ts +56 -0
  320. package/lib/implementations/osd/display-pipeline.d.ts +38 -9
  321. package/lib/implementations/osd/histogram-sampler.d.ts +22 -12
  322. package/lib/implementations/osd/openseadragon-viewer-options.d.ts +35 -0
  323. package/lib/implementations/osd/openseadragon-visualizer.service.d.ts +78 -354
  324. package/lib/implementations/osd/osd-coordinate-transform.d.ts +2 -1
  325. package/lib/implementations/osd/osd-coords.d.ts +6 -4
  326. package/lib/implementations/osd/osd-export.d.ts +36 -0
  327. package/lib/implementations/osd/osd-lib.d.ts +7 -0
  328. package/lib/implementations/osd/osd-navigator-chrome.d.ts +69 -0
  329. package/lib/implementations/osd/osd-pixel-readback.d.ts +22 -0
  330. package/lib/implementations/osd/osd-region-overlay-draw.d.ts +37 -0
  331. package/lib/implementations/osd/osd-region-overlay.d.ts +36 -48
  332. package/lib/implementations/osd/osd-scale-bar.d.ts +8 -6
  333. package/lib/implementations/osd/osd-tile-source.d.ts +49 -0
  334. package/lib/implementations/osd/osd-viewer-like.d.ts +100 -0
  335. package/lib/implementations/osd/osd-viewer-mount.d.ts +14 -0
  336. package/lib/implementations/osd/osd-viewport.d.ts +77 -0
  337. package/lib/implementations/osd/osd-zoom.d.ts +6 -0
  338. package/lib/implementations/osd/simple-source.d.ts +161 -0
  339. package/lib/implementations/osd/slice-cache.d.ts +12 -3
  340. package/lib/implementations/osd/tile-client.d.ts +11 -14
  341. package/lib/implementations/osd/tile-recolor.d.ts +141 -0
  342. package/lib/implementations/plotly/omics-trace-builders.d.ts +32 -20
  343. package/lib/implementations/plotly/plotly-image-loader.d.ts +49 -0
  344. package/lib/implementations/plotly/plotly-image-recolor.d.ts +75 -0
  345. package/lib/implementations/plotly/plotly-intensity-inset.d.ts +8 -0
  346. package/lib/implementations/plotly/plotly-isosurface-controls.d.ts +38 -0
  347. package/lib/implementations/plotly/plotly-layouts.d.ts +188 -0
  348. package/lib/implementations/plotly/plotly-readback.d.ts +41 -0
  349. package/lib/implementations/plotly/plotly-region-overlay.d.ts +2 -2
  350. package/lib/implementations/plotly/plotly-shape-projection.d.ts +92 -0
  351. package/lib/implementations/plotly/plotly-trace-builders.d.ts +23 -12
  352. package/lib/implementations/plotly/plotly-zoom-controller.d.ts +86 -0
  353. package/lib/implementations/plotly/plotly.service.d.ts +136 -401
  354. package/lib/implementations/region-centroids.d.ts +14 -0
  355. package/lib/implementations/simple-slice-access.service.d.ts +7 -4
  356. package/lib/implementations/spatial-data-http/spatial-data-http.service.d.ts +42 -18
  357. package/lib/implementations/spatial-data-http/spatial-wire.d.ts +34 -9
  358. package/lib/implementations/tile-server/index.d.ts +5 -0
  359. package/lib/implementations/tile-server/native-histogram.d.ts +25 -0
  360. package/lib/implementations/tile-server/poll-descriptor.d.ts +39 -0
  361. package/lib/implementations/tile-server/tile-protocol.d.ts +80 -0
  362. package/lib/implementations/tile-server/transport.d.ts +62 -0
  363. package/lib/intensity/intensity-profile.d.ts +66 -0
  364. package/lib/intensity/intensity-profile.service.d.ts +108 -0
  365. package/lib/intensity-inset/intensity-inset.component.d.ts +58 -0
  366. package/lib/models/bezier.d.ts +0 -5
  367. package/lib/models/class-preset.d.ts +18 -0
  368. package/lib/models/geometry.d.ts +14 -48
  369. package/lib/models/polygon-edit.d.ts +72 -0
  370. package/lib/models/polygon-factory.d.ts +40 -0
  371. package/lib/models/region-clone.d.ts +20 -0
  372. package/lib/models/region-geojson.d.ts +17 -0
  373. package/lib/models/region.d.ts +40 -4
  374. package/lib/models/shape.d.ts +8 -0
  375. package/lib/plot-mode/contribution-host.d.ts +125 -0
  376. package/lib/plot-mode/plot-type-menu.d.ts +60 -0
  377. package/lib/plot-mode/tool-params-model.d.ts +49 -0
  378. package/lib/plot.utilities.d.ts +19 -30
  379. package/lib/processing/processing-image.d.ts +5 -2
  380. package/lib/provide-visualization.d.ts +19 -2
  381. package/lib/region-editor/classes-panel/classes-panel.component.d.ts +56 -0
  382. package/lib/region-editor/file-stem.d.ts +7 -0
  383. package/lib/region-editor/manage-classes-dialog/manage-classes-dialog.component.d.ts +45 -0
  384. package/lib/region-editor/mask-export.service.d.ts +54 -0
  385. package/lib/region-editor/mask-raster.d.ts +2 -8
  386. package/lib/region-editor/region-color-dialog/region-color-dialog.component.d.ts +29 -0
  387. package/lib/region-editor/region-editor-help/region-editor-help.component.d.ts +11 -0
  388. package/lib/region-editor/region-editor.component.d.ts +166 -199
  389. package/lib/region-editor/region-metrics.d.ts +26 -0
  390. package/lib/region-editor/region-persistence.service.d.ts +69 -0
  391. package/lib/region-editor/region-table/region-table.component.d.ts +83 -0
  392. package/lib/region-editor/save-mask-dialog/save-mask-dialog.component.d.ts +36 -0
  393. package/lib/region-editor/save-regions-dialog/save-regions-dialog.component.d.ts +37 -0
  394. package/lib/region-ops.service.d.ts +1 -7
  395. package/lib/region-overlay/region-geometry.d.ts +157 -0
  396. package/lib/region-overlay/region-hit-test.d.ts +38 -0
  397. package/lib/region-overlay/svg-region-renderer.d.ts +110 -0
  398. package/lib/render-orchestrator.d.ts +6 -2
  399. package/lib/render-session.d.ts +75 -0
  400. package/lib/routing-visualizer.service.d.ts +110 -58
  401. package/lib/spatial/density-raster.d.ts +6 -0
  402. package/lib/spatial/embedding-compute-coordinator.d.ts +123 -0
  403. package/lib/spatial/embedding-compute.d.ts +21 -2
  404. package/lib/spatial/glyphs.d.ts +16 -0
  405. package/lib/spatial/lod.d.ts +94 -0
  406. package/lib/spatial/spatial-controls.facade.d.ts +64 -0
  407. package/lib/spatial/spatial-density.d.ts +15 -5
  408. package/lib/spatial/spatial-encoding.d.ts +11 -44
  409. package/lib/spatial/spatial-expression.d.ts +40 -22
  410. package/lib/spatial/spatial-framing.d.ts +1 -0
  411. package/lib/spatial/spatial-heatmap.d.ts +2 -0
  412. package/lib/spatial/spatial-hover.d.ts +4 -16
  413. package/lib/spatial/spatial-panel-model.d.ts +135 -0
  414. package/lib/spatial/spatial-selection.d.ts +21 -26
  415. package/lib/spatial/spatial-tile-merge.d.ts +41 -0
  416. package/lib/spatial/spatial-tiles.d.ts +9 -256
  417. package/lib/spatial/stats.d.ts +38 -0
  418. package/lib/spatial/transcript-grouping.d.ts +119 -0
  419. package/lib/spatial-controls/spatial-cells-panel/spatial-cells-panel.component.d.ts +64 -0
  420. package/lib/spatial-controls/spatial-charts/chart-data-model.d.ts +153 -0
  421. package/lib/spatial-controls/spatial-charts/chart-help.d.ts +69 -0
  422. package/lib/spatial-controls/spatial-charts/plotly-chart-host.d.ts +98 -0
  423. package/lib/spatial-controls/spatial-charts/spatial-chart-window/spatial-chart-window.component.d.ts +26 -0
  424. package/lib/spatial-controls/spatial-charts/spatial-charts.component.d.ts +101 -260
  425. package/lib/spatial-controls/spatial-charts/spatial-embedding-controls/spatial-embedding-controls.component.d.ts +43 -0
  426. package/lib/spatial-controls/spatial-charts/spatial-heatmap-controls/spatial-heatmap-controls.component.d.ts +27 -0
  427. package/lib/spatial-controls/spatial-controls.component.d.ts +68 -448
  428. package/lib/spatial-controls/spatial-gene-picker.d.ts +86 -0
  429. package/lib/spatial-controls/spatial-gene-tree/spatial-gene-tree.component.d.ts +102 -0
  430. package/lib/spatial-controls/spatial-groups-panel/spatial-groups-panel.component.d.ts +72 -0
  431. package/lib/spatial-controls/spatial-key/spatial-key.component.d.ts +66 -0
  432. package/lib/spatial-controls/spatial-key/spatial-key.model.d.ts +33 -0
  433. package/lib/spatial-controls/spatial-marker-genes-form/spatial-marker-genes-form.component.d.ts +64 -0
  434. package/lib/spatial-controls/spatial-observations-panel/spatial-observations-panel.component.d.ts +117 -0
  435. package/lib/spatial-controls/spatial-transcripts-panel/spatial-transcripts-panel.component.d.ts +142 -0
  436. package/lib/store/class-color.util.d.ts +35 -1
  437. package/lib/store/region-history.d.ts +66 -0
  438. package/lib/store/region-scope-cache.d.ts +63 -0
  439. package/lib/store/region-selection.d.ts +36 -0
  440. package/lib/store/region-store.service.d.ts +104 -112
  441. package/lib/store/visualizer-store.service.d.ts +22 -33
  442. package/lib/toast-outlets.d.ts +4 -3
  443. package/lib/toolbar/brush/brush-tool.service.d.ts +31 -98
  444. package/lib/toolbar/canvas-tools.d.ts +20 -0
  445. package/lib/toolbar/crop/slide-crop.d.ts +10 -4
  446. package/lib/toolbar/plot-type-selector/plot-type-selector.component.d.ts +38 -0
  447. package/lib/toolbar/region-tools/region-tool-buttons.d.ts +21 -0
  448. package/lib/toolbar/region-tools/region-tools.component.d.ts +60 -0
  449. package/lib/toolbar/segmentation/cell-segment-tool.service.d.ts +10 -14
  450. package/lib/toolbar/segmentation/cellpose-segmenter.service.d.ts +12 -2
  451. package/lib/toolbar/segmentation/onnx-sam-session.d.ts +22 -3
  452. package/lib/toolbar/segmentation/pending-calls.d.ts +31 -0
  453. package/lib/toolbar/segmentation/sam-model-registry.d.ts +9 -3
  454. package/lib/toolbar/segmentation/sam-onnx-core.d.ts +18 -5
  455. package/lib/toolbar/segmentation/sam-point-tool.service.d.ts +46 -32
  456. package/lib/toolbar/segmentation/sam-prompt.d.ts +7 -31
  457. package/lib/toolbar/segmentation/sam-session.service.d.ts +74 -0
  458. package/lib/toolbar/segmentation/sam-tool.service.d.ts +23 -30
  459. package/lib/toolbar/segmentation/segmentation-commit.d.ts +8 -0
  460. package/lib/toolbar/segmentation/segmentation-runner.d.ts +52 -0
  461. package/lib/toolbar/segmentation-tools/segmentation-tools.component.d.ts +87 -0
  462. package/lib/toolbar/stack-controls/stack-controls.component.d.ts +40 -0
  463. package/lib/toolbar/tool-kit/async-tool-status.d.ts +21 -0
  464. package/lib/toolbar/tool-kit/canvas-tool-manager.d.ts +36 -0
  465. package/lib/toolbar/tool-kit/canvas-tool.d.ts +86 -0
  466. package/lib/toolbar/tool-kit/frame-pixels.d.ts +45 -0
  467. package/lib/toolbar/tool-kit/mask-stroke-editor.d.ts +125 -0
  468. package/lib/toolbar/tool-kit/matrix-frame.d.ts +40 -0
  469. package/lib/toolbar/tool-kit/tool-overlay.d.ts +60 -0
  470. package/lib/toolbar/tool-kit/undo-gesture.d.ts +17 -0
  471. package/lib/toolbar/tool-slider/tool-slider.component.d.ts +33 -0
  472. package/lib/toolbar/toolbar-help-dialog/toolbar-help-dialog.component.d.ts +24 -0
  473. package/lib/toolbar/toolbar.component.d.ts +47 -83
  474. package/lib/toolbar/vertex-eraser/vertex-eraser-tool.service.d.ts +33 -40
  475. package/lib/toolbar/view-controls/view-controls.component.d.ts +54 -0
  476. package/lib/toolbar/wand/wand-region-grow.d.ts +49 -0
  477. package/lib/toolbar/wand/wand-tool.service.d.ts +39 -124
  478. package/lib/toolbar/wand/wand.service.d.ts +22 -116
  479. package/lib/toolbar/zoom-to-box/zoom-to-box-tool.service.d.ts +17 -37
  480. package/lib/util/mark-for-check.d.ts +11 -0
  481. package/lib/util/supersede.d.ts +53 -0
  482. package/lib/visualization.module.d.ts +18 -39
  483. package/lib/visualizer/floating-drag.directive.d.ts +30 -0
  484. package/lib/visualizer/region-actions.d.ts +54 -0
  485. package/lib/visualizer/region-load.d.ts +27 -0
  486. package/lib/visualizer/spatial-dataset-binder.d.ts +74 -0
  487. package/lib/visualizer/tool-modes.d.ts +49 -0
  488. package/lib/visualizer/viewer-shortcuts.d.ts +71 -0
  489. package/lib/visualizer/visualizer-context-menu.d.ts +55 -0
  490. package/lib/visualizer.component.d.ts +201 -447
  491. package/lib/workers/spatial-math-ops.d.ts +65 -0
  492. package/lib/workers/spatial-math-worker.d.ts +7 -0
  493. package/lib/workers/spatial-math.d.ts +74 -0
  494. package/package.json +12 -3
  495. package/src/lib/styles/_viz-icons-rules.scss +73 -0
  496. package/src/lib/styles/viz-icons.scss +14 -0
  497. package/esm2022/lib/implementations/napari-js/napari-axes-labels.mjs +0 -97
  498. package/esm2022/lib/implementations/napari-js/napari-navigator.mjs +0 -195
  499. package/esm2022/lib/implementations/napari-js/napari-scale-bar.mjs +0 -92
  500. package/fesm2022/jax-data-science-sci-image-visualizer-onnx-sam-session-BwP-A11m.mjs +0 -329
  501. package/fesm2022/jax-data-science-sci-image-visualizer-onnx-sam-session-BwP-A11m.mjs.map +0 -1
  502. package/lib/implementations/napari-js/napari-axes-labels.d.ts +0 -49
  503. package/lib/implementations/napari-js/napari-navigator.d.ts +0 -72
  504. package/lib/implementations/napari-js/napari-scale-bar.d.ts +0 -35
  505. package/src/lib/assets/cell-detection.svg +0 -37
  506. package/src/lib/assets/click.svg +0 -1
  507. package/src/lib/assets/colormap-luts.json +0 -1
  508. package/src/lib/assets/edit-selection-white.svg +0 -47
  509. package/src/lib/assets/icons/colormap-earth.png +0 -0
  510. package/src/lib/assets/icons/colormap-placeholder.png +0 -0
  511. package/src/lib/assets/icons/colormap-pubu.png +0 -0
  512. package/src/lib/assets/interactive-segmentation-cursor.svg +0 -1
  513. package/src/lib/assets/picture-segmentation.svg +0 -43
  514. package/src/lib/assets/test/download-379.svg +0 -1
  515. package/src/lib/assets/test/download-98.svg +0 -1
  516. package/src/lib/assets/test/json-1.svg +0 -1
  517. package/src/lib/assets/test/load-53.svg +0 -1
  518. package/src/lib/assets/test/mask-44.svg +0 -1
  519. package/src/lib/assets/test/mask-download-44.svg +0 -15
  520. package/src/lib/assets/test/mask-save-44.svg +0 -11
  521. package/src/lib/assets/test/overlay-1.svg +0 -1
  522. package/src/lib/assets/test/overlay-4.svg +0 -1
  523. package/src/lib/assets/test/region-26.svg +0 -1
  524. package/src/lib/assets/test/save-56.svg +0 -1
  525. package/src/lib/assets/test/upload-43.svg +0 -1
@@ -1,25 +1,45 @@
1
- import { ChangeDetectorRef, AfterViewInit, ElementRef, EventEmitter, Injector, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges, Type } from '@angular/core';
2
- import { Subscription } from 'rxjs';
3
- import { MenuItem, MessageService, TreeNode } from 'primeng/api';
1
+ import { AfterViewInit, ChangeDetectorRef, DestroyRef, ElementRef, EventEmitter, Injector, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
2
+ import { MenuItem, MessageService } from 'primeng/api';
4
3
  import { ContextMenu } from 'primeng/contextmenu';
5
4
  import { IImageInfo } from './contracts/image.contract';
6
5
  import { ImageStatePort } from './contracts/ports/image-state.port';
7
6
  import { Polygon } from './models/region';
8
7
  import { RegionOpsService } from './region-ops.service';
9
8
  import { VisualizerStore } from './store/visualizer-store.service';
9
+ import { ImageRenderSession } from './render-session';
10
10
  import { PlotType, PlotTypeDescriptor, PlotTypeId } from './contracts/plot-type';
11
11
  import { PlotTypeContribution, PlotTypeOption } from './contracts/plot-type-contribution.contract';
12
12
  import { PlotModeController } from './plot-mode/plot-mode-controller';
13
+ import { ToolParamsModel } from './plot-mode/tool-params-model';
14
+ import { ContributionHost, PlotModePanelView, ToolDialogView } from './plot-mode/contribution-host';
13
15
  import { IVisualizer } from './contracts/visualizer.contract';
14
16
  import { SamToolService } from './toolbar/segmentation/sam-tool.service';
15
17
  import { SamPointToolService } from './toolbar/segmentation/sam-point-tool.service';
16
18
  import { CellSegmentToolService } from './toolbar/segmentation/cell-segment-tool.service';
17
- import { NumberParamSpec, SelectParamSpec, ToolParamSpec, ToolbarContribution, ToolbarDialogToolContribution, ToolbarToolContribution } from './contracts/toolbar-tool.contract';
19
+ import { SegmentationRunner } from './toolbar/segmentation/segmentation-runner';
20
+ import { ToolbarContribution, ToolbarDialogToolContribution, ToolbarToolContribution } from './contracts/toolbar-tool.contract';
18
21
  import { ToolbarToolVisibility } from './contracts/toolbar-config';
19
22
  import { VizConfig } from './contracts/viz-config';
20
23
  import { SpatialDataPort } from './contracts/ports/spatial-data.port';
24
+ import { ContextMenuActions } from './visualizer/visualizer-context-menu';
25
+ import { RegionActions } from './visualizer/region-actions';
26
+ import { ToolModes } from './visualizer/tool-modes';
27
+ import { FloatingPos } from './visualizer/floating-drag.directive';
28
+ import { IntensityInsetComponent } from './intensity-inset/intensity-inset.component';
29
+ import { SpatialDatasetBinder } from './visualizer/spatial-dataset-binder';
21
30
  import * as i0 from "@angular/core";
22
- export declare class VisualizerComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy {
31
+ /**
32
+ * The viewer (`<visualizer>`): the plot surface, its toolbar, the loading overlay and
33
+ * the dialogs it opens (Channels & Histogram, spatial-omics controls, Region Editor,
34
+ * contributed modes and tools). It orchestrates rendering through the `VISUALIZER`
35
+ * contract and reads the image from the host's `IMAGE_STATE_PORT`.
36
+ *
37
+ * OnPush. Template events re-render it; state that lands asynchronously goes through
38
+ * {@link changed} (or a signal: the loading overlay), and the collaborators that must
39
+ * render synchronously (the render session's overlay, a contributed panel's slot, the
40
+ * context menu before it opens) still call `detectChanges()`.
41
+ */
42
+ export declare class VisualizerComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy, ContextMenuActions {
23
43
  private state;
24
44
  plotService: IVisualizer;
25
45
  messageService: MessageService;
@@ -33,6 +53,8 @@ export declare class VisualizerComponent implements OnInit, OnChanges, AfterView
33
53
  private vizConfig?;
34
54
  private spatialData?;
35
55
  private injector?;
56
+ private hostRef?;
57
+ private readonly destroyRef;
36
58
  /** Per-instance toast key. MessageService is a global singleton, so two live
37
59
  * `<visualizer>` instances (main viewer + pipeline-dialog preview) sharing
38
60
  * one key would each render the same message — a duplicate toast. A unique
@@ -51,8 +73,8 @@ export declare class VisualizerComponent implements OnInit, OnChanges, AfterView
51
73
  * releases on destroy, so the surviving viewer picks them up.
52
74
  */
53
75
  private static readonly liveInstances;
54
- readonly vizToastKey = "sci-viz-notice";
55
- readonly vizAlertToastKey = "sci-viz-alert";
76
+ protected readonly vizToastKey = "sci-viz-notice";
77
+ protected readonly vizAlertToastKey = "sci-viz-alert";
56
78
  /**
57
79
  * Whether this instance renders the shared outlets. The owner is simply the
58
80
  * oldest live visualizer — a `Set` iterates in insertion order, so when the
@@ -62,8 +84,10 @@ export declare class VisualizerComponent implements OnInit, OnChanges, AfterView
62
84
  * initialised would leave nobody rendering the outlets, and every notice from
63
85
  * the root service would silently vanish again.
64
86
  */
65
- get ownsSharedToasts(): boolean;
87
+ protected get ownsSharedToasts(): boolean;
88
+ /** Each new image: whether it is a z-stack. */
66
89
  isStackEvent: EventEmitter<any>;
90
+ /** Each new image: whether it is single-channel (grayscale). */
67
91
  isGrayscaleEvent: EventEmitter<any>;
68
92
  /** Which toolbar groups to show. A partial override merges over the full set,
69
93
  * so `{ specialTools: false }` hides only that group. Defaults to everything. */
@@ -76,327 +100,175 @@ export declare class VisualizerComponent implements OnInit, OnChanges, AfterView
76
100
  testMode: boolean;
77
101
  /** Image-smoothing state for the toolbar's Smoothen toggle (OSD only).
78
102
  * Defaults to `false` so OSD shows raw pixels (nearest-neighbour). */
79
- imageSmoothingEnabled: boolean;
80
- loadingMessage: string;
81
- zoom: boolean;
103
+ protected imageSmoothingEnabled: boolean;
82
104
  fileName: string | undefined;
83
105
  private loadedFileName;
84
- imageInfo: IImageInfo | undefined;
85
- private unsub;
86
- private previewSubscription;
87
- stackLoading: boolean;
88
- imgLoading: boolean;
89
- loadingPercentage: number;
90
- cacheProgress: number | null;
91
- sharpening: boolean;
106
+ protected imageInfo: IImageInfo | undefined;
107
+ protected readonly loadingMessage: import("@angular/core").WritableSignal<string>;
108
+ /** The host is loading at zoom (the overlay message moves out of the way). */
109
+ protected readonly zoom: import("@angular/core").WritableSignal<boolean>;
110
+ protected readonly stackLoading: import("@angular/core").WritableSignal<boolean>;
111
+ protected readonly imgLoading: import("@angular/core").WritableSignal<boolean>;
112
+ protected readonly loadingPercentage: import("@angular/core").WritableSignal<number>;
113
+ protected readonly cacheProgress: import("@angular/core").WritableSignal<number | null>;
92
114
  /** A jit-service cache copy is actively in progress (determinate 0..99). Drives the cache
93
115
  * progress bar independently of `imgLoading` so the bar can't be dropped — or masked by the
94
116
  * "Sharpening preview..." overlay — mid-download if the loading flag flips early. */
95
- get isCaching(): boolean;
96
- private running;
97
- /**
98
- * Monotonic render generation. Bumped when a render starts, so a render that
99
- * has been superseded by a newer image can be recognised and made inert: its
100
- * callbacks return early instead of painting, clearing `running`, releasing
101
- * the newer render's overlay, or applying its ROIs.
102
- */
103
- private renderToken;
104
- /** Set once the template, and with it the plot div, exists (see ngAfterViewInit). */
105
- private viewReady;
106
- /** An image-less dataset whose draw waits for the view: see plotSpatialWithoutImage. */
107
- private pendingSpatialDraw;
108
- zIndex: number;
109
- maxIndex: number;
117
+ protected readonly isCaching: import("@angular/core").Signal<boolean>;
118
+ /** Emits once when this view is destroyed; the collaborators end their subscriptions on it. */
119
+ private readonly destroyed$;
120
+ /** Host image-info objects whose one-shot `initialZIndex` was already applied. */
121
+ private readonly consumedSliceHints;
122
+ protected zIndex: number;
123
+ protected maxIndex: number;
110
124
  contextMenu: ContextMenu;
111
- contextMenuItems: MenuItem[];
112
- activeDragMode: string | null;
113
- /** Whether a region action is available to undo (jit-ui#85). Mirrors the
114
- * shared RegionStore's history depth; drives the toolbar Undo button. */
115
- canUndoRegion: boolean;
116
- /** Whether an undone region action is available to redo (jit-ui#85). */
117
- canRedoRegion: boolean;
118
- /** Custom-threshold Simplify dialog (jit-ui#85). */
119
- displaySimplifyDialog: boolean;
120
- simplifyThreshold: number;
121
- /** Current region selection (array indices) — mirrored from the store so the
122
- * context-menu region actions can read it synchronously (jit-ui#85). */
123
- private selectedIndices;
124
- /** Wand sensitivity — higher = stricter (smaller selection). Matches QuPath default. */
125
- wandSensitivity: number;
126
- /** Brush diameter in image-pixel coordinates (drives the painted disc size). */
127
- brushSize: number;
128
- /** Class the brush paints while a plot mode armed it (PlotModeTools.armBrush); null = plain brush. */
129
- private brushClass;
125
+ protected contextMenuItems: MenuItem[];
126
+ /** The armed tool mode and the toolbar's tool settings. */
127
+ protected readonly tools: ToolModes;
128
+ protected get activeDragMode(): string | null;
129
+ protected set activeDragMode(mode: string | null);
130
+ protected get wandSensitivity(): number;
131
+ protected set wandSensitivity(v: number);
132
+ protected get brushSize(): number;
133
+ protected get vertexEraserRadius(): number;
134
+ protected set vertexEraserRadius(v: number);
135
+ /** Region set-operations on the selection, and the store mirrors they read (jit-ui#85). */
136
+ protected readonly regionActions: RegionActions;
137
+ /** Custom-threshold Simplify dialog visibility (see {@link RegionActions}). */
138
+ protected get displaySimplifyDialog(): boolean;
139
+ protected set displaySimplifyDialog(v: boolean);
130
140
  /** SAM model picker options + current selection (jit-ui#90 P1). Only models
131
141
  * with a hosted ONNX pair (configured via setSamModelUrls at app init) are
132
142
  * offered, so the picker can't select a model that can't run. */
133
- samModels: {
143
+ protected samModels: {
134
144
  id: string;
135
145
  label: string;
136
146
  }[];
137
- samModelId: string;
147
+ protected samModelId: string;
138
148
  /**
139
149
  * No-prompt tools registered through {@link TOOLBAR_TOOLS}, filtered to those
140
150
  * with configured models and sorted. This library registers none — a host
141
151
  * supplies them — so an open build has an empty array here and the toolbar
142
152
  * and help dialog simply omit that group.
143
153
  */
144
- contributedTools: ToolbarToolContribution[];
145
- /**
146
- * Dialog tools registered through {@link TOOLBAR_TOOLS} (`kind: 'dialog'`),
147
- * sorted. Their buttons sit with the host's own actions and show in the Image
148
- * view only; each opens a floating dialog the tool fills.
149
- */
150
- dialogTools: ToolbarDialogToolContribution[];
154
+ protected contributedTools: ToolbarToolContribution[];
155
+ /** Checkpoints and parameter values of {@link contributedTools}, and their dialog. */
156
+ protected readonly toolParams: ToolParamsModel;
157
+ /** Contributed plot modes and dialog tools, and their live sessions. */
158
+ readonly contributions: ContributionHost;
159
+ /** Dialog tools registered through {@link TOOLBAR_TOOLS} (`kind: 'dialog'`). */
160
+ protected get dialogTools(): ToolbarDialogToolContribution[];
151
161
  /** The dialog tool the user has open (its session may be between renders). */
152
- openDialogToolId: string | null;
162
+ protected get openDialogToolId(): string | null;
153
163
  /** The open dialog tool's live dialog, as the template renders it. */
154
- toolDialog: {
155
- title: string;
156
- width: string;
157
- host: HTMLElement;
158
- } | null;
159
- /** Dialog-tool sessions: the same lifecycle and isolation as contributed plot modes. */
160
- private readonly toolDialogs;
161
- /** Active checkpoint per contributed tool. */
162
- toolModelIds: Record<string, string>;
164
+ protected get toolDialog(): ToolDialogView | null;
165
+ protected readonly samToastKey: string;
163
166
  /**
164
- * Parameter values per contributed tool, seeded from each tool's own defaults
165
- * — which encode the scale and crowding its checkpoint was trained for.
167
+ * Outlet for the library's own result/error notices, keyed to this instance so they
168
+ * do not depend on the host mounting a keyless `<p-toast>` (most hosts don't, and a
169
+ * failed segmentation then looked like a dead button). Deliberately NOT the sticky
170
+ * toast's key: that is cleared when a run settles, which would wipe the result.
166
171
  */
167
- toolParams: Record<string, Record<string, unknown>>;
168
- /** Which tool's parameter dialog is open, or null. */
169
- openParamsToolId: string | null;
170
- /** SAM download/segment toast state (bound by the `sam` p-toast template). */
171
- samStatus: string;
172
- samProgress: number;
173
- samDownloading: boolean;
174
- samBusy: boolean;
175
- /** Whether the shared `sam` toast is currently shown (avoids stacking it on
176
- * every point click, which re-runs inference). */
177
- private samToastShown;
178
- readonly samToastKey: string;
179
- /**
180
- * Outlet for the library's own result/error notices.
181
- *
182
- * PrimeNG routes a message to a `<p-toast>` only when the keys match — a
183
- * keyless message reaches a keyless toast and nothing else. These notices used
184
- * to be emitted with no key, so they rendered only in hosts that happen to
185
- * mount a bare `<p-toast>` (jit-ui does, in its file-tree component). Every
186
- * other host — including this repo's own browser example — dropped them
187
- * silently, which made a failed or no-op segmentation look like a dead button:
188
- * the sticky progress toast is cleared in the same tick by hideSamToast, and
189
- * the message explaining why never appeared anywhere.
190
- *
191
- * Keyed to this component instance so the library renders its own outlet and
192
- * is not dependent on host markup. Deliberately NOT the sticky toast's key:
193
- * {@link hideSamToast} clears that key in the `finally`, which would wipe the
194
- * result the moment it was posted, and the sticky toast's custom template is
195
- * built for the live status + progress bar.
196
- */
197
- readonly resultToastKey: string;
198
- /** Subscriptions to the point tool's live feeds (status/busy/download). */
199
- private samPointSub;
200
- /** Vertex eraser radius in image-pixel coordinates. */
201
- vertexEraserRadius: number;
202
- colormapsOptions: any;
203
- reversescale: boolean;
204
- selectedColormap: any;
172
+ protected readonly resultToastKey: string;
173
+ /** Segmentation runs and their sticky progress toast. */
174
+ protected readonly segmentation: SegmentationRunner;
205
175
  /** Channels & Histogram dialog visibility (opened from the toolbar). */
206
- showChannelHistogram: boolean;
176
+ protected showChannelHistogram: boolean;
207
177
  /** Spatial-omics controls dialog visibility (toolbar button). */
208
- showSpatialControls: boolean;
178
+ protected showSpatialControls: boolean;
209
179
  /** Region Editor dialog visibility (opened from the toolbar). */
210
- showRegionEditor: boolean;
180
+ protected showRegionEditor: boolean;
211
181
  /** Region Editor dialog width. On open it is set to the configured host
212
182
  * element's current width, or — when no selector is configured / the element
213
183
  * isn't found — to a quarter of the page (see openRegionEditor). */
214
- regionEditorWidth: string;
215
- stackOptions: {
216
- name: string;
217
- val: string;
218
- }[];
219
- selectedStackOption: {
220
- name: string;
221
- val: string;
222
- } | undefined;
223
- readonly plotDivName: string;
184
+ protected regionEditorWidth: string;
185
+ protected readonly plotDivName: string;
186
+ /** The render pipeline: the newest image (or image-less dataset) always wins. */
187
+ protected readonly render: ImageRenderSession;
224
188
  plotType: PlotType;
225
- isHeatmap: boolean;
226
- activeSurface3dMode: string;
189
+ protected isHeatmap: boolean;
190
+ protected activeSurface3dMode: string;
227
191
  /** Whether the napari 3D coordinate-axes / scale gizmo is shown (volume/isosurface). */
228
- axesVisible: boolean;
229
- wireframeActive: boolean;
192
+ protected axesVisible: boolean;
193
+ protected wireframeActive: boolean;
230
194
  /** napari 3D decimate factor (1 = Full … 8 = ⅛; default ½); changing it re-plots. */
231
- resolutionScale: number;
195
+ protected resolutionScale: number;
232
196
  /** The selector's entries: the built-in plot types the active backend
233
197
  * advertises (3D gated by capability), then any contributed modes
234
198
  * ({@link PLOT_TYPE_CONTRIBUTIONS}). */
235
- plotTypeMenu: PlotTypeOption[];
199
+ protected plotTypeMenu: PlotTypeOption[];
236
200
  /**
237
201
  * The built-in plot types on offer — {@link plotTypeMenu} without contributed
238
202
  * modes. Kept with its original type so existing readers are unaffected.
239
203
  */
240
- plotTypeOptions: PlotTypeDescriptor[];
204
+ protected plotTypeOptions: PlotTypeDescriptor[];
241
205
  /**
242
206
  * What the selector shows: a built-in type or a contributed mode's id. Every
243
207
  * rendering and tool decision goes through {@link basePlotType} instead, so a
244
208
  * contributed mode behaves exactly like the built-in type it rides on.
245
209
  */
246
- selectedPlotTypeId: PlotTypeId;
210
+ protected selectedPlotTypeId: PlotTypeId;
247
211
  /**
248
212
  * The built-in plot type being rendered. With no contributed mode active this
249
213
  * is the selection itself; during one it is the mode's `baseType`. Kept with its
250
214
  * original `PlotType` type for existing readers — use {@link selectedPlotTypeId}
251
215
  * for the selector's id. Assigning selects that built-in type.
252
216
  */
253
- get selectedPlotType(): PlotType;
254
- set selectedPlotType(type: PlotType);
217
+ protected get selectedPlotType(): PlotType;
218
+ protected set selectedPlotType(type: PlotType);
255
219
  /** Contributed plot modes and their single live session. */
256
- readonly plotModes: PlotModeController;
257
- /**
258
- * The live contributed mode's side panel, as the template renders it: an
259
- * Angular component with its own injector, or a plain host element a `mount`
260
- * panel rendered into. Null while no contributed session is live.
261
- */
262
- plotModePanel: {
263
- title: string;
264
- component: Type<unknown> | null;
265
- injector: Injector | null;
266
- host: HTMLElement | null;
267
- } | null;
268
- private destroying;
220
+ get plotModes(): PlotModeController;
221
+ /** The live contributed mode's side panel; null while no contributed session is live. */
222
+ protected get plotModePanel(): PlotModePanelView | null;
269
223
  /** Where a `mount` panel's host element is attached once the dialog renders. */
270
224
  set plotModePanelSlot(ref: ElementRef<HTMLElement> | undefined);
271
225
  /** The built-in type actually rendered for {@link selectedPlotTypeId}: itself
272
226
  * for a built-in type, `baseType` for a contributed mode. */
273
- get basePlotType(): PlotType;
274
- /** Floating intensity-profile inset (LINE mode). */
275
- readonly intensityInsetDiv = "intensity-inset-plot";
276
- profilePanelPos: {
277
- x: number;
278
- y: number;
279
- };
280
- private profilePanelDragging;
281
- private profilePanelStart;
227
+ protected get basePlotType(): PlotType;
228
+ /** Div the floating intensity-profile inset is charted into. Per instance, like
229
+ * {@link plotDivName}: the backend resolves it by id, so a fixed id made two live
230
+ * viewers draw both insets into whichever div came first in the document. */
231
+ protected readonly intensityInsetDiv: string;
282
232
  /** Toolbar docking: docked across the top by default; dragging its handle
283
233
  * detaches it into a floating, movable window (frees the top row for the
284
234
  * visualization). */
285
- toolbarFloating: boolean;
286
- toolbarPos: {
235
+ protected toolbarFloating: boolean;
236
+ protected toolbarPos: {
287
237
  x: number;
288
238
  y: number;
289
239
  };
290
- private toolbarDragging;
291
- private toolbarStart;
292
- private latestProfiles;
293
- /** Drives the intensity inset panel's visibility — true whenever any
294
- * intensity-profile line exists (independent of the current plot type). */
295
- hasProfiles: boolean;
296
- private intensityProfileSub?;
297
- private viewportChangeSub?;
298
- private profileDragMoveListener?;
299
- private profileDragUpListener?;
300
- private profileResizeListener?;
240
+ /** Where a toolbar-handle drag starts from: grabbing the docked toolbar floats it. */
241
+ protected readonly toolbarDragOrigin: () => FloatingPos;
242
+ /** The floating intensity-profile inset (always mounted; shows itself while lines exist). */
243
+ inset?: IntensityInsetComponent;
301
244
  /** True while the 3D spatial cloud is the active mode. The controls drop the ROI
302
245
  * selection there: region tools are screen-space, and against an orbiting
303
246
  * camera a drawn rectangle has no fixed meaning in the data. */
304
- get isSpatial3dMode(): boolean;
305
- /** LINE plot type shows the image + draggable line ROI + intensity inset. */
306
- get isProfileMode(): boolean;
247
+ protected get isSpatial3dMode(): boolean;
307
248
  /** True for the Image plot type, which renders as a natively pan/zoom-able
308
249
  * raster — so the backend-agnostic zoom/pan toolbar tools are hidden. The
309
250
  * component drives this off the plot type, not the active backend. */
310
- get isImageView(): boolean;
251
+ protected get isImageView(): boolean;
311
252
  /** Isosurface band as a 0–255 slider position, mapped onto the volume's real
312
253
  * intensity range by the renderer. Defaults to the full range. */
313
- isoRange: number[];
314
- /** Whether a spatial-omics dataset is currently published on
315
- * `SPATIAL_DATA_PORT` — gates the spatial plot types in the selector. */
316
- /** Bound by the toolbar, which offers the plot modes for a dataset with no image too. */
317
- hasSpatialDataset: boolean;
318
- /** The spatial dataset on offer, for drawing one that brings no image (see reloadAndPlot). */
319
- private spatialDataset;
320
- /** Whether that dataset's observations carry a z, gating the 3D spatial mode. */
321
- private hasSpatial3dDataset;
322
- /** Whether it carries a registered volume. Change detection only: a volume
323
- * appearing is what publishes it as the image, and the plot-type gates then
324
- * see an ordinary grayscale stack. */
325
- private hasSpatialVolume;
326
- /** Dataset identity + capability shape the last emission was handled at, so a
327
- * switch between two datasets of the same shape is not mistaken for a repeat. */
328
- private spatialDatasetKey;
329
- /** Dataset + geometry the currently published volume image was built from, so a
330
- * re-emitted dataset doesn't re-fetch megabytes or reset the user's scrub. */
331
- private volumeImageKey;
332
- /** Blob URLs backing that image — ours to revoke. */
333
- private volumeImageUrls;
334
- private spatialDatasetSubscription?;
335
- plotWidthSubscription?: Subscription;
336
- imageLoadingSubscription?: Subscription;
337
- imgLoadingMessageSubscription?: Subscription;
338
- isZoomSubscription?: Subscription;
339
- filenameSubscription?: Subscription;
340
- autoscaleSubscription?: Subscription;
341
- private plotContextMenuListener?;
342
- private keydownListener?;
343
- private wheelListener?;
254
+ protected isoRange: number[];
255
+ /** The spatial-omics dataset on offer and the gates it puts on the selector. */
256
+ protected readonly spatial: SpatialDatasetBinder;
257
+ /** Whether a spatial-omics dataset is published on `SPATIAL_DATA_PORT` — gates the
258
+ * spatial plot types; the toolbar offers the plot modes for an image-less one too. */
259
+ protected get hasSpatialDataset(): boolean;
260
+ /** Keyboard, wheel and context-menu handling; created once the view exists. */
261
+ private shortcuts?;
344
262
  /** Debounced z-slice scrubbing (see SliceScrubber — refactoring plan Step 7). */
345
263
  private readonly scrubber;
346
- constructor(state: ImageStatePort, plotService: IVisualizer, messageService: MessageService, ngZone: NgZone, cdr: ChangeDetectorRef, session: VisualizerStore, samTool: SamToolService, cellSegmentTool: CellSegmentToolService, samPointTool: SamPointToolService, regionOps: RegionOpsService, vizConfig?: VizConfig | undefined, toolContributions?: readonly ToolbarContribution[], spatialData?: SpatialDataPort | undefined, plotTypeContributions?: readonly PlotTypeContribution[], injector?: Injector | undefined);
347
- /**
348
- * Plot types offered in the selector for the current image:
349
- * - Outside **test mode**, only the curated default set (descriptors with a
350
- * `productionLabel`) is offered, shown under suffix-free names — Image,
351
- * Heatmap, Contour and the napari Surface / Volume / Isosurface. Test mode
352
- * exposes every backend's type under its full (backend-suffixed) label.
353
- * - 3D types hidden when the backend can't render a 3D scene.
354
- * - stack-only types (volume, isosurface) hidden unless the file is a stack —
355
- * a volume needs multiple z-slices.
356
- * - scalar-intensity types (contour, surface, isosurface) hidden for RGB
357
- * images — they map a single intensity per pixel. Image and Heatmap render
358
- * any image.
359
- * - spatial-omics types hidden until a `SpatialDataset` is published on
360
- * `SPATIAL_DATA_PORT` — the mode has nothing to draw without observations,
361
- * exactly as a volume has nothing to draw without a stack.
362
- */
363
- /**
364
- * Track whether a spatial-omics dataset is available. A dataset appearing (or
365
- * being cleared) changes which plot types make sense, so it drives the same
366
- * recompute + reconcile that the image stream and the test-mode toggle do.
367
- *
368
- * No-op when the host provides no `SPATIAL_DATA_PORT` — the spatial types then
369
- * stay hidden for the life of the component.
370
- */
264
+ constructor(state: ImageStatePort, plotService: IVisualizer, messageService: MessageService, ngZone: NgZone, cdr: ChangeDetectorRef, session: VisualizerStore, samTool: SamToolService, cellSegmentTool: CellSegmentToolService, samPointTool: SamPointToolService, regionOps: RegionOpsService, vizConfig?: VizConfig | undefined, toolContributions?: readonly ToolbarContribution[], spatialData?: SpatialDataPort | undefined, plotTypeContributions?: readonly PlotTypeContribution[], injector?: Injector | undefined, hostRef?: ElementRef<HTMLElement> | undefined, destroyRef?: DestroyRef);
265
+ /** Follow the spatial-omics dataset: a dataset appearing, switching or being cleared
266
+ * re-gates the selector exactly as the image stream and the test-mode toggle do. */
371
267
  private watchSpatialDataset;
372
- /**
373
- * Publish a dataset's reference volume AS the image, and open the 2D Image view
374
- * on it.
375
- *
376
- * The volume is a 3D image delivered in one file, so for a dataset that has no
377
- * section image it is the honest thing to put on screen: the slice bar scrubs z,
378
- * and the contrast window, colormaps and region tools all work because the
379
- * volume genuinely is the image now. The 3D cloud stays one menu pick away.
380
- *
381
- * Keyed by dataset + geometry: the dataset stream re-emits on things like a
382
- * colour-column change, and rebuilding then would re-fetch the voxels and throw
383
- * the user back to the middle slice.
384
- */
385
- private showVolumeAsImage;
386
- /** Forget the published volume image so re-selecting the dataset rebuilds it.
387
- * The URLs deliberately stay alive: the host may still be displaying that image
388
- * at this instant, and revoking under it would break every later tile read. They
389
- * are freed when the next volume replaces them, or on destroy. */
390
- private dropVolumeImage;
391
- private revokeVolumeImageUrls;
268
+ /** Recompute the selector's entries for the current image, dataset and test mode
269
+ * (see {@link computePlotTypeMenu}). */
392
270
  private computePlotTypeOptions;
393
271
  ngOnChanges(changes: SimpleChanges): void;
394
- /** If the active plot type is no longer in the offered options (e.g. test mode
395
- * turned off while a test-only type was active, or a scalar type carried onto
396
- * an RGB image), fall back to the default 2D Image view. */
397
- /** Whether the live spatial dataset brings pixels of its own — a tissue image it
398
- * registers onto, or a volume that is published as a z-stack image. */
399
- private spatialDatasetHasPixels;
400
272
  /**
401
273
  * The host published NO image — a spatial dataset that brings none does this.
402
274
  *
@@ -405,216 +277,145 @@ export declare class VisualizerComponent implements OnInit, OnChanges, AfterView
405
277
  * `isStack`/`isGrayscale` decision is made against a file that is no longer loaded.
406
278
  */
407
279
  private onImageCleared;
280
+ /** If the active plot type is no longer in the offered options (e.g. test mode
281
+ * turned off while a test-only type was active, or a scalar type carried onto
282
+ * an RGB image), fall back to the default 2D Image view. */
408
283
  private reconcileSelectedPlotType;
409
284
  ngOnInit(): void;
285
+ /**
286
+ * Follow `source` until destroy. Host streams can emit outside the Angular zone (a
287
+ * serverless host clears its loading flag from an image decode or an OpenSeadragon
288
+ * callback); setting a signal there marks this OnPush view but schedules no change
289
+ * detection, so the update is applied inside the zone, as {@link changed} does.
290
+ */
291
+ private mirror;
292
+ /**
293
+ * State this view shows changed outside one of its template events (a stream, a
294
+ * resolved promise, a host call): mark the OnPush view for check, re-entering the
295
+ * zone when it changed outside it so a change-detection pass follows.
296
+ */
297
+ private changed;
298
+ /**
299
+ * Lay a new image out once the old view is gone: the stack flag, the slice bounds (one
300
+ * url per slice, so the last index is length-1), and the one-shot `initialZIndex` hint
301
+ * (e.g. the file the user clicked within a numbered series). The hint is consumed so
302
+ * re-delivering the same info (a plot-type switch, reloadAndPlot) does not reset the
303
+ * user's scrub; the host's object is never written to (a host store may freeze it) —
304
+ * the component keeps a copy without the hint, and remembers the host object.
305
+ */
306
+ private layOutSlices;
410
307
  ngAfterViewInit(): void;
411
308
  /** The plot div exists now: run an image-less draw that arrived before it did. */
412
309
  private onViewReady;
413
- onProfilePanelDragStart(e: MouseEvent): void;
414
- /** Grab the toolbar handle: detach it into a floating window (if still docked)
415
- * and start dragging. */
416
- onToolbarDragStart(e: MouseEvent): void;
310
+ /** What the keyboard, wheel and context-menu shortcuts act on. Their listeners live
311
+ * outside this view, so every action that changes what it shows marks it for check. */
312
+ private shortcutHost;
417
313
  /** Snap the floating toolbar back to its docked position across the top. */
418
- dockToolbar(): void;
419
- /** Render the intensity inset chart from the latest profile data. The actual
420
- * charting is owned by the visualizer service — the component just decides
421
- * when (profile mode + a fresh profile). */
422
- private renderIntensityInset;
314
+ protected dockToolbar(): void;
423
315
  /** Toolbar "Intensity" group: add another line ROI (next bright colour). */
424
- addProfileLine(): Promise<void>;
316
+ protected addProfileLine(): Promise<void>;
425
317
  ngOnDestroy(): void;
318
+ /** What the host gets through `setDiagram` — see {@link VisualizerHandle}. */
319
+ private readonly hostHandle;
426
320
  hasRegions(): boolean;
427
- /**
428
- * This method is called in mainFacade.configRequest() - DO NOT DELETE
429
- */
321
+ /** The current regions as polygons (also on the host handle). */
430
322
  getRegionPolygons(): Polygon[];
431
- /**
432
- * Select the color scale type: called by the color scale select button
433
- * @param event
434
- */
435
- toggleReverseScale(): void;
436
- /**
437
- * Select a color map: called by the color map dropdown button
438
- * @param colormapNode
439
- */
440
- selectColormap(colormapNode: TreeNode): void;
441
323
  /** Open the Channels & Histogram dialog (toolbar button). */
442
- openChannelHistogram(): void;
324
+ protected openChannelHistogram(): void;
443
325
  /** Toolbar → open the spatial-omics controls. */
444
- openSpatialControls(): void;
326
+ protected openSpatialControls(): void;
445
327
  /** Open the Region Editor dialog (toolbar button). The editor stays linked to
446
328
  * this plotting instance through the root RegionStore singleton, so it works
447
329
  * the same as the former right-panel Regions tab. */
448
- openRegionEditor(): void;
449
- /**
450
- * Called by the stack/single image dropdown button
451
- * @param showstack
452
- */
453
- selectStackOption(selectedStackOption: any): void;
454
- updateZIndex(urls?: string[]): void;
330
+ protected openRegionEditor(): void;
331
+ /** The toolbar's Single image / Stack toggle. */
332
+ protected selectStackOption(selectedStackOption: {
333
+ name: string;
334
+ val: string;
335
+ }): void;
336
+ /** Clamp the slice index into [0, maxIndex] and push it to the renderer. */
337
+ protected updateZIndex(): void;
455
338
  /**
456
339
  * Live z-slice scrub for the Image view: the renderer swaps the displayed
457
340
  * slice in place (no re-mount), so dragging the slider steps through the
458
341
  * stack the same way the heatmap frame slider does.
459
342
  */
460
- onZSlide(z: number | undefined): void;
343
+ protected onZSlide(z: number | undefined): void;
461
344
  /**
462
345
  * Live (debounced) scrub while dragging the Image-view z-slider: update the
463
346
  * slice as the user drags, but coalesce rapid changes so we don't fire a
464
347
  * slice swap on every pixel. The final value also lands via onZSlide (onSlideEnd).
465
348
  */
466
- onZScrub(z: number | undefined): void;
467
- /**
468
- * Keyboard stack navigation: ←/→ step the z-slice in the Image view, the same
469
- * way the slider does. Only active for a loaded stack in Image view, and
470
- * ignored while a form field is focused so typing isn't hijacked. Up/Down are
471
- * left to OpenSeadragon (panning).
472
- */
473
- onKeydown(e: KeyboardEvent): void;
349
+ protected onZScrub(z: number | undefined): void;
474
350
  /** Move the displayed slice by `delta`, clamped to the stack bounds. */
475
351
  stepSlice(delta: number): void;
476
- reloadAndPlot(): void;
477
- /**
478
- * Draw a spatial mode with no image behind it: the observations alone, framed on their own
479
- * extent, as the seqFISH example shows them. The image info is a placeholder naming the
480
- * dataset, so regions drawn here are kept per dataset like any image's.
481
- */
482
- private plotSpatialWithoutImage;
483
- cancelLoading(): void;
484
- downloadImage(): void;
352
+ protected reloadAndPlot(): void;
353
+ protected cancelLoading(): void;
354
+ protected downloadImage(): void;
485
355
  autoscaleImage(): void;
486
356
  /** Toolbar pixel/smooth toggle: flip smoothing and apply to the active backend. */
487
- onToggleImageSmoothing(): void;
357
+ protected onToggleImageSmoothing(): void;
488
358
  resetAxes(): void;
489
359
  toggleDragMode(mode: string): void;
490
- /** Arm `mode` (or nothing) across every tool, keeping the toolbar in step. */
491
- private applyDragMode;
492
- /** Region draw/select/edit modes routed through the region overlay. The
493
- * The vertex tools (drawpolygon/addpoint/deletepoint/move) are
494
- * handled by the OpenSeadragon overlay; Plotly's overlay maps them to no-op. */
495
- private isRegionMode;
496
360
  /** Live-update the isosurface as the range slider moves. The control is only
497
361
  * available when the active backend renders isosurfaces (ISOSURFACE mode). */
498
- onIsoRangeChange(values: number[] | undefined): void;
499
- onWandSensitivityChange(value: number | undefined): void;
500
- onBrushSizeChange(value: number | undefined): void;
501
- onVertexEraserRadiusChange(value: number | undefined): void;
362
+ protected onIsoRangeChange(values: number[] | undefined): void;
363
+ protected onWandSensitivityChange(value: number | undefined): void;
364
+ protected onBrushSizeChange(value: number | undefined): void;
365
+ protected onVertexEraserRadiusChange(value: number | undefined): void;
502
366
  zoomIn(): void;
503
367
  zoomOut(): void;
504
368
  deleteRegion(): void;
505
369
  /** Undo the most recent region action (jit-ui#85). Up to 10 steps back. */
506
- undoRegion(): void;
370
+ protected undoRegion(): void;
507
371
  /** Redo the most recently undone region action (jit-ui#85). */
508
- redoRegion(): void;
509
- /** The currently-selected regions (live store instances). */
510
- private get selectedRegions();
511
- /** Regions eligible for set-ops: closed areas (rect / closed polygon /
512
- * multi-polygon), excluding intensity-profile lines. */
513
- private opEligible;
514
- /** Image pixel dimensions for the raster ops; falls back to the selection's
515
- * extent when the image size isn't known (keeps clamping sane). */
516
- private opImageDims;
517
- /** True when ≥2 eligible regions are selected (Merge available). */
518
- get canMergeRegions(): boolean;
519
- /** True when any selected region is multi-part (Ungroup available). */
520
- get canUngroupRegions(): boolean;
521
- /** True when ≥1 eligible region is selected (Inverse / Simplify available). */
522
- get hasEligibleSelection(): boolean;
523
- /** Select every region on the image (excludes intensity-profile lines). */
372
+ protected redoRegion(): void;
524
373
  selectAllRegions(): void;
525
- /** Merge the selected regions into a single (possibly multi-part) region. */
526
374
  mergeRegions(): void;
527
- /** Split each selected multi-part region into one region per part. */
528
375
  ungroupRegions(): void;
529
- /** Replace the selection with its inverse inside the image rectangle. */
530
376
  inverseRegions(): void;
531
- /** Douglas–Peucker simplify each selected region by `thresholdPx`. */
532
377
  simplifyRegions(thresholdPx: number): void;
533
- /** Open the custom-threshold simplify dialog. */
534
378
  openSimplifyDialog(): void;
535
- /**
536
- * Commit a set-op: drop the `remove` regions, append `add`, and select the
537
- * results. Goes through setRegions so it's undo-tracked and re-rendered;
538
- * profile lines and unselected regions are preserved.
539
- */
540
- private replaceRegions;
541
379
  /** Box-prompted SAM segmentation of the drawn rectangles (jit-ui#90). A sticky
542
380
  * `sam` toast shows live status + a download progress bar (first run pulls the
543
381
  * encoder, ~170 MB); it stays open until the run finishes (bar hits 100%). */
544
- segmentRegions(): Promise<void>;
382
+ protected segmentRegions(): Promise<void>;
545
383
  /** Auto-segment cells inside each drawn rectangle with cellpose-SAM, client-side
546
384
  * (jit-ui#90). Each box is cropped (browser slide-crop) then run through the
547
385
  * cellpose-js model; the same sticky `sam` toast + progress bar is reused. */
548
- segmentCellpose(): Promise<void>;
549
- /**
550
- * Parameters currently bound by the generic parameter dialog, for whichever
551
- * tool is open. Seeded lazily: a tool's defaults are only asked for when the
552
- * user first touches it, so registering a tool costs nothing until used.
553
- */
386
+ protected segmentCellpose(): Promise<void>;
554
387
  paramsFor(toolId: string): Record<string, unknown>;
555
- /** Active checkpoint for a tool, falling back to the tool's own default. */
556
- modelIdFor(tool: ToolbarToolContribution): string;
557
- /** Switching checkpoint re-seeds the parameters, since the defaults belong to
558
- * the model rather than to the tool. */
559
- onToolModelChange(e: {
388
+ protected onToolModelChange(e: {
560
389
  toolId: string;
561
390
  modelId: string;
562
391
  }): void;
563
- /** A tool's defaults for a checkpoint, with that checkpoint's own overrides
564
- * applied on top — per-model defaults beat per-tool ones. */
565
- private seedParams;
566
- /**
567
- * Narrow a param spec for the template.
568
- *
569
- * `*ngSwitchCase` does not narrow a discriminated union in Angular's template
570
- * type checker the way a `switch` does in TypeScript, so the template asks for
571
- * the variant it has already matched on.
572
- */
573
- numberParam(p: ToolParamSpec): NumberParamSpec;
574
- selectParam(p: ToolParamSpec): SelectParamSpec;
575
- openToolParams(toolId: string): void;
576
- /** The tool whose parameter dialog is open, for the generic dialog's header
577
- * and field list. */
578
- get openParamsTool(): ToolbarToolContribution | undefined;
579
- resetToolParams(toolId: string): void;
392
+ protected openToolParams(toolId: string): void;
393
+ protected closeToolParams(): void;
394
+ protected resetToolParams(toolId: string): void;
580
395
  /** Run a contributed tool over the current view. No prompt: these sweep the
581
396
  * whole view rather than being pointed at something. Reuses the shared
582
397
  * segmentation toast so progress reads the same as the SAM/cellpose tools. */
583
- runTool(toolId: string): Promise<void>;
584
- /** Shared driver for the box-prompt segment tools: wires the tool's status +
585
- * download progress into the sticky `sam` toast, runs `op`, and reports the
586
- * region count. Keeps the toast open until the run settles (bar hits 100%). */
587
- private runSegmentWithToast;
588
- /** Show the shared sticky `sam` toast once (idempotent — re-adding would stack
589
- * a new toast on every point click). */
590
- private showSamToast;
591
- /** Dismiss the shared `sam` toast and reset its progress/spinner state. */
592
- private hideSamToast;
398
+ protected runTool(toolId: string): Promise<void>;
593
399
  /** Pick the SAM model the segment tools use (jit-ui#90 P1). */
594
- onSamModelChange(id: string): void;
400
+ protected onSamModelChange(id: string): void;
595
401
  /** Convert the selected region to a smooth bezier curve. */
596
402
  toBezierRegion(): void;
597
403
  /** Convert the selected region back to a straight-edged polygon. */
598
404
  toPolygonRegion(): void;
599
- /**
600
- * Immediate region actions on the current selection (jit-ui#85): merge,
601
- * ungroup, inverse, simplify, the Bézier conversions, and delete — the
602
- * one-shot geometry transforms, grouped apart from the tool/mode toggles and
603
- * shown only when something is selected. Each item is gated on what the
604
- * selection supports.
605
- */
606
- private buildRegionActionItems;
405
+ /** The right-click menu for the current view, armed mode and selection. */
607
406
  private buildContextMenuItems;
407
+ private contextMenuState;
408
+ /** 3D scene interaction mode (orbit / turntable / pan / zoom); no-op on a 2D-only backend. */
608
409
  toggleSurface3dMode(mode: string): void;
609
410
  resetSurfaceCamera(): void;
610
411
  /** Toggle the napari 3D coordinate-axes / scale gizmo (volume/isosurface). No-op on backends
611
412
  * that don't render one (the control method is optional). */
612
- toggleAxes(): void;
413
+ protected toggleAxes(): void;
613
414
  /** Toggle the napari surface wireframe (edges vs filled). No-op on backends without a surface. */
614
- toggleWireframe(): void;
415
+ protected toggleWireframe(): void;
615
416
  /** Change the napari 3D decimate factor. Decimation changes the fetched/assembled data, so this
616
417
  * re-plots the current 3D type at the new resolution (unlike axes/wireframe, which are live). */
617
- selectResolution(scale: number): void;
418
+ protected selectResolution(scale: number): void;
618
419
  /**
619
420
  * Switch the active plot type (heatmap, surface, contour, scatter, line,
620
421
  * scatter3d, isosurface). Keeps `isHeatmap` as the 2D-vs-3D flag the rest of
@@ -622,59 +423,12 @@ export declare class VisualizerComponent implements OnInit, OnChanges, AfterView
622
423
  * moving to a 3D type, then re-plots.
623
424
  */
624
425
  onSelectPlotType(selected: PlotTypeId): void;
625
- /**
626
- * Start the selected contributed mode's session, once its base view has
627
- * plotted. No-op for a built-in type, or when the base on screen is not the
628
- * one the mode rides on. A backend that cannot provide a viewport for it
629
- * (e.g. OSD fell back to Plotly) counts as a failed activation.
630
- */
631
- private activateSelectedPlotMode;
632
- /** Render the live mode's panel. Activation can resolve outside Angular (an
633
- * OSD callback, a contribution's own promise), hence the zone re-entry. */
634
- private showPlotModePanel;
635
- /** Drop the panel (destroying a component panel) before the session ends. */
636
- private hidePlotModePanel;
637
- /**
638
- * A contributed mode could not start. Its base type is already on screen —
639
- * the base plotted first — so just select it: nothing needs to re-plot.
640
- */
641
- private fallBackFromPlotMode;
642
- /** Run change detection; returns what it threw (logged), or null. */
643
- private detectChangesSafely;
644
426
  /** The toolbar button: open the tool's dialog, or close it if it is open. */
645
- toggleDialogTool(id: string): void;
427
+ protected toggleDialogTool(id: string): void;
646
428
  /** Close the open dialog tool: its body is torn down, then its session ends. */
647
- closeDialogTool(): void;
648
- /** Start (or restart, after a re-render) the open dialog tool's session. */
649
- private activateOpenDialogTool;
650
- /** The live dialog body's teardown, and a pending wait for its host to connect. */
651
- private toolDialogTeardown;
652
- private toolDialogFrame;
653
- /**
654
- * The session is live: render the dialog, then mount the tool's body once the host
655
- * element is in the document, so `mount()` can measure it and start widgets that need
656
- * a connected element.
657
- */
658
- private showToolDialog;
659
- /** How many animation frames to wait for the dialog to attach the body's host. */
660
- private static readonly TOOL_DIALOG_ATTACH_FRAMES;
661
- /**
662
- * Mount `tool`'s body into `host` once it is connected (the dialog may attach it a
663
- * frame later, when it moves itself to `<body>`). If it never connects within
664
- * {@link TOOL_DIALOG_ATTACH_FRAMES} it is mounted anyway, with a warning, rather than
665
- * leaving an empty dialog. A throwing `mount()` fails the session like a failed start.
666
- */
667
- private mountToolDialogBody;
668
- /** The session is about to end: tear the body down first, then drop the dialog. */
669
- private hideToolDialog;
670
- /** A dialog tool could not start: close it and say so. */
671
- private dialogToolFailed;
429
+ protected closeDialogTool(): void;
672
430
  /** Where the open dialog tool's host element is attached once its dialog renders. */
673
431
  set toolDialogSlot(ref: ElementRef<HTMLElement> | undefined);
674
- /** Toolbar tools for contributed modes. Calls can come from outside Angular, hence the zone. */
675
- private readonly plotModeTools;
676
- /** Deactivate whatever tool is armed and clear every tool mode. */
677
- private deactivateActiveTool;
678
- static ɵfac: i0.ɵɵFactoryDeclaration<VisualizerComponent, [null, null, null, null, null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
679
- static ɵcmp: i0.ɵɵComponentDeclaration<VisualizerComponent, "visualizer", never, { "toolbarTools": { "alias": "toolbarTools"; "required": false; }; "testMode": { "alias": "testMode"; "required": false; }; }, { "isStackEvent": "isStackEvent"; "isGrayscaleEvent": "isGrayscaleEvent"; }, never, ["*"], false, never>;
432
+ static ɵfac: i0.ɵɵFactoryDeclaration<VisualizerComponent, [null, null, null, null, null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, null]>;
433
+ static ɵcmp: i0.ɵɵComponentDeclaration<VisualizerComponent, "visualizer", never, { "toolbarTools": { "alias": "toolbarTools"; "required": false; }; "testMode": { "alias": "testMode"; "required": false; }; }, { "isStackEvent": "isStackEvent"; "isGrayscaleEvent": "isGrayscaleEvent"; }, never, ["*"], true, never>;
680
434
  }