copper3d 4.1.3 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +15 -1
  2. package/ai-index/guides/nrrd-tools.md +105 -1
  3. package/ai-index/guides/segmentation-module.md +75 -1
  4. package/ai-index/manifest.json +5 -5
  5. package/ai-index/symbols.json +1 -1
  6. package/dist/Utils/segmentation/DrawToolCore.d.ts +18 -0
  7. package/dist/Utils/segmentation/DrawToolCore.js +63 -11
  8. package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
  9. package/dist/Utils/segmentation/NrrdTools.d.ts +29 -1
  10. package/dist/Utils/segmentation/NrrdTools.js +82 -1
  11. package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
  12. package/dist/Utils/segmentation/RenderingUtils.d.ts +3 -0
  13. package/dist/Utils/segmentation/RenderingUtils.js +20 -4
  14. package/dist/Utils/segmentation/RenderingUtils.js.map +1 -1
  15. package/dist/Utils/segmentation/core/UndoManager.d.ts +18 -0
  16. package/dist/Utils/segmentation/core/UndoManager.js +19 -3
  17. package/dist/Utils/segmentation/core/UndoManager.js.map +1 -1
  18. package/dist/Utils/segmentation/core/index.d.ts +2 -2
  19. package/dist/Utils/segmentation/core/index.js +1 -1
  20. package/dist/Utils/segmentation/core/index.js.map +1 -1
  21. package/dist/Utils/segmentation/core/types.d.ts +9 -0
  22. package/dist/Utils/segmentation/core/types.js.map +1 -1
  23. package/dist/Utils/segmentation/coreTools/GuiState.d.ts +4 -2
  24. package/dist/Utils/segmentation/coreTools/GuiState.js +3 -1
  25. package/dist/Utils/segmentation/coreTools/GuiState.js.map +1 -1
  26. package/dist/Utils/segmentation/tools/DragSliceTool.js +6 -1
  27. package/dist/Utils/segmentation/tools/DragSliceTool.js.map +1 -1
  28. package/dist/Utils/segmentation/tools/DrawingTool.js +9 -1
  29. package/dist/Utils/segmentation/tools/DrawingTool.js.map +1 -1
  30. package/dist/Utils/segmentation/tools/HeatmapOverlay.d.ts +37 -0
  31. package/dist/Utils/segmentation/tools/HeatmapOverlay.js +185 -0
  32. package/dist/Utils/segmentation/tools/HeatmapOverlay.js.map +1 -0
  33. package/dist/Utils/segmentation/tools/SliceRenderPipeline.js +6 -0
  34. package/dist/Utils/segmentation/tools/SliceRenderPipeline.js.map +1 -1
  35. package/dist/Utils/segmentation/tools/SphereTool.js +6 -0
  36. package/dist/Utils/segmentation/tools/SphereTool.js.map +1 -1
  37. package/dist/bundle.esm.mjs +574 -206
  38. package/dist/bundle.umd.js +574 -205
  39. package/dist/index.d.ts +4 -3
  40. package/dist/index.js +2 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/types/Utils/segmentation/DrawToolCore.d.ts +18 -0
  43. package/dist/types/Utils/segmentation/NrrdTools.d.ts +29 -1
  44. package/dist/types/Utils/segmentation/RenderingUtils.d.ts +3 -0
  45. package/dist/types/Utils/segmentation/core/UndoManager.d.ts +18 -0
  46. package/dist/types/Utils/segmentation/core/index.d.ts +2 -2
  47. package/dist/types/Utils/segmentation/core/types.d.ts +9 -0
  48. package/dist/types/Utils/segmentation/coreTools/GuiState.d.ts +4 -2
  49. package/dist/types/Utils/segmentation/tools/HeatmapOverlay.d.ts +37 -0
  50. package/dist/types/index.d.ts +4 -3
  51. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ import { NrrdTools } from "./Utils/segmentation/NrrdTools";
18
18
  import { registerNiftiMaskGrid } from "./Utils/segmentation/tools/DataLoader";
19
19
  import type { NrrdHeaderLike } from "./Utils/segmentation/tools/DataLoader";
20
20
  import { GaussianSmoother } from "./Utils/segmentation/core/GaussianSmoother";
21
+ import { HEATMAP_COLORMAP } from "./Utils/segmentation/tools/HeatmapOverlay";
21
22
  import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls";
22
23
  import { Copper3dOrbitControls } from "./Controls/Copper3dOrbitControls";
23
24
  import { MeshNodeTool } from "./Utils/MeshNodeTool";
@@ -58,13 +59,13 @@ import { NrrdState } from "./Utils/segmentation/coreTools/NrrdState";
58
59
  import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
59
60
  import type { ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode } from "./Utils/segmentation/core/types";
60
61
  import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
61
- import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
62
+ import type { LayerId, ChannelValue, ChannelClear } from "./Utils/segmentation/core/index";
62
63
  import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
63
64
  import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
64
65
  import { OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels } from "./Utils/orientation";
65
66
  import type { NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation } from "./Utils/orientation";
66
67
  import "./css/style.css";
67
68
  export declare const REVISION: string;
68
- export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
69
- export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
69
+ export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, HEATMAP_COLORMAP, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
70
+ export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, ChannelClear, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
70
71
  export type { CameraViewPreset } from "./Controls/orbitFraming";
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ import kiwrious from "./Utils/kiwrious/configKiwrious";
17
17
  import { NrrdTools } from "./Utils/segmentation/NrrdTools";
18
18
  import { registerNiftiMaskGrid } from "./Utils/segmentation/tools/DataLoader";
19
19
  import { GaussianSmoother } from "./Utils/segmentation/core/GaussianSmoother";
20
+ import { HEATMAP_COLORMAP } from "./Utils/segmentation/tools/HeatmapOverlay";
20
21
  // Phase 7: Segmentation Module - Unified exports
21
22
  import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls";
22
23
  import { Copper3dOrbitControls } from "./Controls/Copper3dOrbitControls";
@@ -71,5 +72,5 @@ if (typeof window !== "undefined") {
71
72
  if (typeof console !== "undefined") {
72
73
  console.log(`%cCopper3D Visualisation %c${REVISION}`, "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
73
74
  }
74
- export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
75
+ export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, HEATMAP_COLORMAP, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
75
76
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,eAAe,EAGf,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAY,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EACL,mBAAmB,EACnB,YAA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AA8C,EAC9C,8CAA8C,CAC/C,CAAC;AACJ,CAAC;AAED,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,qBAAqB,EACrB,OAAO,EACP,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,kBAAkB,EAClB,UAAU,GACX,CAAC"}
@@ -13,6 +13,7 @@ import { ImageStoreHelper } from "./tools/ImageStoreHelper";
13
13
  import { SphereBrushTool } from "./tools/SphereBrushTool";
14
14
  import { AiAssistTool } from "./tools/AiAssistTool";
15
15
  import { UndoManager } from "./core";
16
+ import type { UndoEntry } from "./core";
16
17
  /**
17
18
  * DrawToolCore — Tool orchestration and event routing.
18
19
  *
@@ -69,6 +70,11 @@ export declare class DrawToolCore {
69
70
  private annotationSuspended;
70
71
  setAnnotationSuspended(suspended: boolean): void;
71
72
  isAnnotationSuspended(): boolean;
73
+ /**
74
+ * True while a mask must not be written: annotation is suspended, or the heatmap is
75
+ * shown (it owns the master canvas, and what is on screen is not a mask).
76
+ */
77
+ private writesBlocked;
72
78
  /**
73
79
  * Left/right button press on the drawing canvas.
74
80
  *
@@ -76,6 +82,8 @@ export declare class DrawToolCore {
76
82
  * directly: it is the single point that decides whether an input may modify a mask.
77
83
  */
78
84
  onCanvasPointerDown(e: MouseEvent): void;
85
+ /** Pointer move while a stroke or pan is active; a stroke can only continue where writes are allowed. */
86
+ private onCanvasPointerMove;
79
87
  /**
80
88
  * Left/right button release on the drawing canvas.
81
89
  *
@@ -188,6 +196,16 @@ export declare class DrawToolCore {
188
196
  * Undo the last drawing operation on the active layer.
189
197
  */
190
198
  undoLastPainting(): void;
199
+ /**
200
+ * Undo `entry` on its own layer if it is still that layer's latest operation, whichever
201
+ * layer is active; otherwise change nothing.
202
+ *
203
+ * @returns Whether it was undone. False when a later operation is stacked on top of it, or
204
+ * when it has already been undone.
205
+ */
206
+ undoEntry(entry: UndoEntry): boolean;
207
+ /** Write an entry's "before" state back into its volume, repaint, and report the change. */
208
+ private applyUndo;
191
209
  /**
192
210
  * Redo the last undone operation on the active layer.
193
211
  */
@@ -2,6 +2,7 @@ import { nrrdSliceType, storeExportPaintImageType, loadingBarType } from "../../
2
2
  import { GUI } from "dat.gui";
3
3
  import { IMaskData, IDragOpts, IKeyBoardSettings, ToolMode, IGuiMeta, MaskRenderMode } from "./core/types";
4
4
  import { DragOperator } from "./DragOperator";
5
+ import type { ChannelClear } from "./core/UndoManager";
5
6
  import type { ChannelValue, RGBAColor, ChannelColorMap } from "./core";
6
7
  import type { SphereType } from "./tools/SphereTool";
7
8
  import type { AiPromptTool, AiPromptPayload, AiMaskResult } from "./tools/AiAssistTool";
@@ -129,12 +130,27 @@ export declare class NrrdTools {
129
130
  *
130
131
  * @param layerId Layer whose mask to edit.
131
132
  * @param channel Label to erase, 1-255.
133
+ * @returns The clear, for `undoChannelClear`; null when the channel held nothing.
132
134
  * @throws {Error} If `layerId` names no layer. Deliberately NOT routed through
133
135
  * `getVolumeForLayer`, which warns and falls back to the first layer — for a
134
136
  * destructive call that would quietly erase a different layer's annotation.
135
137
  * @throws {RangeError} If `channel` is outside [1, 255] (from `MaskVolume`).
136
138
  */
137
- clearChannel(layerId: string, channel: number): void;
139
+ clearChannel(layerId: string, channel: number): ChannelClear | null;
140
+ /**
141
+ * Undo one `clearChannel`, on its own layer, whatever layer is active now.
142
+ *
143
+ * `undo()` acts on the active layer's latest operation, and by the time a caller offers to
144
+ * reverse a clear the active layer may have changed. This names the clear instead, and
145
+ * reverses it only while it is still the latest operation on its layer: a later edit there is
146
+ * newer work, never undone in passing -- `undo()` steps back through it in order.
147
+ *
148
+ * Reported through `onMaskChanged` with the channels it restored, exactly as `undo()` reports.
149
+ *
150
+ * @returns Whether the clear was undone. False when a later operation is stacked on it, or
151
+ * it has already been undone.
152
+ */
153
+ undoChannelClear(clear: ChannelClear): boolean;
138
154
  undo(): void;
139
155
  redo(): void;
140
156
  enterKeyboardConfig(): void;
@@ -304,6 +320,18 @@ export declare class NrrdTools {
304
320
  */
305
321
  setMaskRenderMode(mode: MaskRenderMode): void;
306
322
  getMaskRenderMode(): MaskRenderMode;
323
+ /**
324
+ * Canonical uint8 probabilities (p × 255), x fastest, in the loaded image's dimensions.
325
+ * Throws when `dims` differ from the image's or do not match the volume's length. null clears.
326
+ */
327
+ setHeatmap(volume: Uint8Array | null, dims?: [number, number, number]): void;
328
+ /** Show the heatmap instead of every mask layer, or bring the layers back. */
329
+ setHeatmapVisible(visible: boolean): void;
330
+ isHeatmapVisible(): boolean;
331
+ /** Probabilities below `t` (clamped to 0–1) are not drawn. */
332
+ setHeatmapThreshold(t: number): void;
333
+ /** Clamped to 0–1. */
334
+ setHeatmapOpacity(a: number): void;
307
335
  updateOriginAndChangedWH(): void;
308
336
  setSyncsliceNum(): void;
309
337
  resetPaintAreaUIPosition(l?: number, t?: number): void;
@@ -2,6 +2,7 @@ import type { INewMaskData } from "./core/types";
2
2
  import type { MaskVolume } from "./core/index";
3
3
  import type { CanvasState } from "./CanvasState";
4
4
  import type { MaskMirror } from "./tools/MaskMirror";
5
+ import { type HeatmapOverlay } from "./tools/HeatmapOverlay";
5
6
  /**
6
7
  * RenderingUtils — Rendering / slice-buffer helper methods.
7
8
  *
@@ -18,6 +19,8 @@ export declare class RenderingUtils {
18
19
  setEmptyCanvasSize: (axis?: "x" | "y" | "z") => void;
19
20
  /** Set while this viewer draws another viewer's masks; painted after this viewer's own layers. */
20
21
  mirror: MaskMirror | null;
22
+ /** The probability heatmap; painted instead of the layers while the heatmap view is on. */
23
+ heatmap: HeatmapOverlay | null;
21
24
  /** Called after every composite. The owner refreshes the viewers mirroring this one. */
22
25
  onComposited: (() => void) | null;
23
26
  private _reusableSliceBuffer;
@@ -33,6 +33,17 @@ export interface VolumeSnapshot {
33
33
  }
34
34
  /** A slice-delta group or a whole-volume snapshot. `Array.isArray` discriminates. */
35
35
  export type UndoEntry = MaskDelta[] | VolumeSnapshot;
36
+ /**
37
+ * One channel clear, as `NrrdTools.clearChannel` returns it, for `NrrdTools.undoChannelClear`.
38
+ * `entry` is the undo entry the clear pushed and is compared by identity.
39
+ */
40
+ export interface ChannelClear {
41
+ readonly layerId: string;
42
+ readonly channel: number;
43
+ readonly entry: UndoEntry;
44
+ }
45
+ /** The layer an entry belongs to. */
46
+ export declare function entryLayer(entry: UndoEntry): string | undefined;
36
47
  export declare class UndoManager {
37
48
  private undoStacks;
38
49
  private redoStacks;
@@ -67,6 +78,13 @@ export declare class UndoManager {
67
78
  * @returns The delta(s) that were undone, or undefined if nothing to undo.
68
79
  */
69
80
  undo(): UndoEntry | undefined;
81
+ /**
82
+ * Undo the last operation on `layerId`, whichever layer is active. The entry moves to that
83
+ * layer's redo stack, exactly as `undo` does for the active one.
84
+ */
85
+ undoOn(layerId: string): UndoEntry | undefined;
86
+ /** The entry an undo on `layerId` would take next, left in place. */
87
+ peek(layerId: string): UndoEntry | undefined;
70
88
  /**
71
89
  * Redo the last undone operation on the active layer.
72
90
  * @returns The delta(s) that were redone, or undefined if nothing to redo.
@@ -70,7 +70,7 @@
70
70
  export type { Dimensions, RGBAColor, ChannelColorMap, SliceRenderOptions, LayerId, ChannelValue, ICommXYZ, ICommXY, ISkipSlicesDictType, ToolMode, IDragPrameters, IDrawingEvents, IContrastEvents, IPaintImages, IPaintImage, ILayerRenderTarget, IDownloadImageConfig, INewMaskData, IMaskData, IProtected, IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState, IGUIStates, IGuiMeta, IGuiParameterSettings, IImageMetadata, IViewState, IInteractionState, ISphereState, IInternalFlags, INrrdStates, IAnnotationCallbacks, IMaskHistoryChange, IConvertObjType, ICursorPage, IDragOpts, IDrawOpts, IKeyBoardSettings, MaskRenderMode, } from './types';
71
71
  export { RenderMode, MAX_ENGINE_CHANNEL, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, } from './types';
72
72
  export { MaskVolume } from './MaskVolume';
73
- export type { MaskDelta, UndoEntry } from './UndoManager';
74
- export { UndoManager } from './UndoManager';
73
+ export type { MaskDelta, UndoEntry, ChannelClear } from './UndoManager';
74
+ export { UndoManager, entryLayer } from './UndoManager';
75
75
  export type { ContourBBox, ContourPolygon } from './MarchingSquares';
76
76
  export { extractLabelBoundarySegments, extractLabelContours, extractLabelOutline, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
@@ -279,7 +279,16 @@ export interface ILayerChannelState {
279
279
  /** Per-layer opacity: { layer1: 1.0, layer2: 0.6, ... }. Range [0.1, 1.0]. */
280
280
  layerOpacity: Record<string, number>;
281
281
  }
282
+ /** The probability heatmap view. While visible it is drawn instead of every mask layer. */
283
+ export interface IHeatmapViewState {
284
+ visible: boolean;
285
+ /** Probabilities below this (0–1) are not drawn. */
286
+ threshold: number;
287
+ /** 0–1. */
288
+ opacity: number;
289
+ }
282
290
  export interface IGUIStates extends IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState {
291
+ heatmap: IHeatmapViewState;
283
292
  }
284
293
  /** Metadata for a GUI slider/control — used by Vue components to configure slider UI */
285
294
  export interface IGuiMeta {
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * GuiState — Grouped state management for GUI configuration.
3
3
  *
4
- * Replaces the flat IGUIStates object with 4 semantic sub-groups:
4
+ * Replaces the flat IGUIStates object with 5 semantic sub-groups:
5
5
  * - mode: Tool mode flags (pencil/eraser/sphere)
6
6
  * - drawing: Brush/pencil appearance and behavior
7
7
  * - viewConfig: UI layout and interaction parameters
8
8
  * - layerChannel: Active layer, channel, and visibility
9
+ * - heatmap: Probability heatmap view: shown, threshold, opacity
9
10
  */
10
- import type { IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState } from "../core/types";
11
+ import type { IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState, IHeatmapViewState } from "../core/types";
11
12
  export declare class GuiState {
12
13
  readonly mode: IToolModeState;
13
14
  readonly drawing: IDrawingConfig;
14
15
  readonly viewConfig: IViewConfig;
15
16
  readonly layerChannel: ILayerChannelState;
17
+ readonly heatmap: IHeatmapViewState;
16
18
  constructor(options?: {
17
19
  defaultPaintCursor?: string;
18
20
  defaultFillColor?: string;
@@ -0,0 +1,37 @@
1
+ type Axis = "x" | "y" | "z";
2
+ /** 256 × RGBA: probability byte → colour. */
3
+ export declare const HEATMAP_COLORMAP: Uint8ClampedArray;
4
+ /** The smallest byte drawn for a 0–1 threshold. */
5
+ export declare function heatmapThresholdByte(t: number): number;
6
+ /** Whether the heatmap view is on. Older state fakes carry no `heatmap`. */
7
+ export declare function isHeatmapShown(state: {
8
+ gui_states: unknown;
9
+ }): boolean;
10
+ /** The most raster pixels per voxel along an axis. */
11
+ export declare const HEATMAP_MAX_UPSAMPLE = 4;
12
+ export declare class HeatmapOverlay {
13
+ readonly dims: [number, number, number];
14
+ private volume;
15
+ private makeCanvas;
16
+ private cache;
17
+ /** The offscreen canvas and its pixels, kept while the raster size stays the same. */
18
+ private raster;
19
+ constructor(volume: Uint8Array, dims: [number, number, number], makeCanvas?: (w: number, h: number) => HTMLCanvasElement);
20
+ /** Raster pixels per voxel along one axis: enough for the displayed size, at most HEATMAP_MAX_UPSAMPLE. */
21
+ static rasterFactor(displayed: number, voxels: number): number;
22
+ /**
23
+ * One slice as RGBA at `fx × fy` raster pixels per voxel. The probability is interpolated
24
+ * bilinearly between voxel centres; a pixel is drawn, in the colour of that value, where it
25
+ * reaches `thresholdByte`. Elsewhere it is fully transparent. With `out` (exactly
26
+ * `width × height × 4` bytes) the slice is written into it, cleared first, instead of a new array.
27
+ * `fx` and `fy` must be integers of at least 1.
28
+ */
29
+ sliceRGBA(axis: Axis, index: number, thresholdByte: number, fx?: number, fy?: number, outBytes?: Uint8ClampedArray): {
30
+ data: Uint8ClampedArray;
31
+ width: number;
32
+ height: number;
33
+ };
34
+ /** Draw a slice scaled to `width × height`; the offscreen slice is reused until its key changes. */
35
+ paint(ctx: CanvasRenderingContext2D, axis: Axis, index: number, width: number, height: number, threshold: number, opacity: number): void;
36
+ }
37
+ export {};
@@ -18,6 +18,7 @@ import { NrrdTools } from "./Utils/segmentation/NrrdTools";
18
18
  import { registerNiftiMaskGrid } from "./Utils/segmentation/tools/DataLoader";
19
19
  import type { NrrdHeaderLike } from "./Utils/segmentation/tools/DataLoader";
20
20
  import { GaussianSmoother } from "./Utils/segmentation/core/GaussianSmoother";
21
+ import { HEATMAP_COLORMAP } from "./Utils/segmentation/tools/HeatmapOverlay";
21
22
  import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls";
22
23
  import { Copper3dOrbitControls } from "./Controls/Copper3dOrbitControls";
23
24
  import { MeshNodeTool } from "./Utils/MeshNodeTool";
@@ -58,13 +59,13 @@ import { NrrdState } from "./Utils/segmentation/coreTools/NrrdState";
58
59
  import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
59
60
  import type { ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode } from "./Utils/segmentation/core/types";
60
61
  import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
61
- import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
62
+ import type { LayerId, ChannelValue, ChannelClear } from "./Utils/segmentation/core/index";
62
63
  import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
63
64
  import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
64
65
  import { OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels } from "./Utils/orientation";
65
66
  import type { NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation } from "./Utils/orientation";
66
67
  import "./css/style.css";
67
68
  export declare const REVISION: string;
68
- export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
69
- export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
69
+ export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, loadKiwrious, NrrdTools, registerNiftiMaskGrid, loading, Copper3dTrackballControls, Copper3dOrbitControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, MAX_ENGINE_CHANNEL, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, GaussianSmoother, HEATMAP_COLORMAP, SurfaceAnnotator, exposureExponent, DEFAULT_TARGET_GREY, disposeObject3D, disposeMaterial, collectFadeTargets, setFade, restoreFade, createSceneBudget, defaultBudgetBytes, disposeScene, removeSceneFromMap, fitDistance, fitView, isRotateEnabled, setRotateEnabled, isPanEnabled, setPanEnabled, isZoomEnabled, setZoomEnabled, beginGesture, isGestureActive, setCameraPose, addVolumeBoundingBox, VOLUME_BOUNDS_NAME, rasDimensions, DEFAULT_AXES, ensureAxisExtracted, prepareVolumeSlices, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, OrientationError, canonicalTransform, geometryFromNrrd, readNrrdOrientationFields, reorientVoxels, reorientedGeometry, viewLabels, };
70
+ export type { positionType, screenPosType, optsType, NrrdHeaderLike, GltfLoadOpts, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, aligned4DSurfaceType, aligned4DOptsType, Aligned4DController, raw4DVolumeTransformType, raw4DVolumeOptsType, Raw4DVolumeController, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, IMaskHistoryChange, MaskRenderMode, LayerId, ChannelValue, ChannelClear, AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult, SurfaceAnnotatorOptions, Annotation, AnnotationMode, ExportOptions, ExposureVolume, DisposableObject3D, DisposableMaterial, FadeTarget, FadeableMaterial, SceneBudget, DisposableScene, SceneDisposalHost, FitBounds, FitViewScene, AxisGatedControls, GestureAxes, PosableScene, BoundingBoxHost, VolumeBoundingBoxOpts, NrrdAxis, Pose, NrrdOrientationFields, OrientationErrorCode, OrientationTransform, ViewAxis, ViewLabels, VolumeGeometry, VolumeOrientation, };
70
71
  export type { CameraViewPreset } from "./Controls/orbitFraming";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "copper3d",
3
3
  "description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.",
4
- "version": "4.1.3",
4
+ "version": "4.2.0",
5
5
  "main": "dist/bundle.umd.js",
6
6
  "module": "dist/bundle.esm.mjs",
7
7
  "types": "dist/types/index.d.ts",