copper3d 3.10.1 → 3.10.3

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 (42) hide show
  1. package/README.md +23 -3
  2. package/dist/Utils/segmentation/DrawToolCore.js +1 -0
  3. package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
  4. package/dist/Utils/segmentation/NrrdTools.d.ts +41 -1
  5. package/dist/Utils/segmentation/NrrdTools.js +76 -0
  6. package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
  7. package/dist/Utils/segmentation/RenderingUtils.d.ts +32 -0
  8. package/dist/Utils/segmentation/RenderingUtils.js +107 -12
  9. package/dist/Utils/segmentation/RenderingUtils.js.map +1 -1
  10. package/dist/Utils/segmentation/core/MarchingSquares.d.ts +26 -0
  11. package/dist/Utils/segmentation/core/MarchingSquares.js +113 -0
  12. package/dist/Utils/segmentation/core/MarchingSquares.js.map +1 -1
  13. package/dist/Utils/segmentation/core/MaskVolume.d.ts +32 -5
  14. package/dist/Utils/segmentation/core/MaskVolume.js +95 -18
  15. package/dist/Utils/segmentation/core/MaskVolume.js.map +1 -1
  16. package/dist/Utils/segmentation/core/index.d.ts +3 -3
  17. package/dist/Utils/segmentation/core/index.js +2 -2
  18. package/dist/Utils/segmentation/core/index.js.map +1 -1
  19. package/dist/Utils/segmentation/core/types.d.ts +32 -21
  20. package/dist/Utils/segmentation/core/types.js +77 -10
  21. package/dist/Utils/segmentation/core/types.js.map +1 -1
  22. package/dist/Utils/segmentation/coreTools/GuiState.js +2 -0
  23. package/dist/Utils/segmentation/coreTools/GuiState.js.map +1 -1
  24. package/dist/Utils/segmentation/tools/DrawingTool.d.ts +19 -2
  25. package/dist/Utils/segmentation/tools/DrawingTool.js +30 -6
  26. package/dist/Utils/segmentation/tools/DrawingTool.js.map +1 -1
  27. package/dist/Utils/segmentation/tools/ToolHost.d.ts +7 -1
  28. package/dist/bundle.esm.js +503 -48
  29. package/dist/bundle.umd.js +503 -47
  30. package/dist/index.d.ts +4 -3
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/types/Utils/segmentation/NrrdTools.d.ts +41 -1
  34. package/dist/types/Utils/segmentation/RenderingUtils.d.ts +32 -0
  35. package/dist/types/Utils/segmentation/core/MarchingSquares.d.ts +26 -0
  36. package/dist/types/Utils/segmentation/core/MaskVolume.d.ts +32 -5
  37. package/dist/types/Utils/segmentation/core/index.d.ts +3 -3
  38. package/dist/types/Utils/segmentation/core/types.d.ts +32 -21
  39. package/dist/types/Utils/segmentation/tools/DrawingTool.d.ts +19 -2
  40. package/dist/types/Utils/segmentation/tools/ToolHost.d.ts +7 -1
  41. package/dist/types/index.d.ts +4 -3
  42. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -55,12 +55,13 @@ import { nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadR
55
55
  import { IPaintImage, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, IGuiMeta } from "./Utils/segmentation/core/types";
56
56
  import { NrrdState } from "./Utils/segmentation/coreTools/NrrdState";
57
57
  import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
58
- import type { ToolMode, IAnnotationCallbacks } from "./Utils/segmentation/core/types";
58
+ import type { ToolMode, IAnnotationCallbacks, MaskRenderMode } from "./Utils/segmentation/core/types";
59
59
  import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
60
60
  import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
61
+ import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
61
62
  import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
62
63
  import "./css/style.css";
63
64
  export declare const REVISION: string;
64
- 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, 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
65
- 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, 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, };
65
+ 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
66
+ 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, 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, };
66
67
  export type { CameraViewPreset } from "./Controls/orbitFraming";
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ import { easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPos
38
38
  import { installFastSliceRepaint } from "./Loader/fastSliceRepaint";
39
39
  import { SurfaceAnnotator } from "./Utils/surfaceAnnotation";
40
40
  import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
41
+ import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
41
42
  import "./css/style.css";
42
43
  // __REVISION__ is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
43
44
  // When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
@@ -57,5 +58,5 @@ if (typeof window !== "undefined") {
57
58
  if (typeof console !== "undefined") {
58
59
  console.log(`%cCopper3D Visualisation %c${REVISION}`, "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
59
60
  }
60
- 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, 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
61
+ 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
61
62
  //# 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,YAAY,GACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,qB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BAAmB,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,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,YAAY,EACZ,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,GACxB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { nrrdSliceType, storeExportPaintImageType, loadingBarType } from "../../types/types";
2
2
  import { GUI } from "dat.gui";
3
- import { IMaskData, IDragOpts, IKeyBoardSettings, ToolMode, IGuiMeta } from "./core/types";
3
+ import { IMaskData, IDragOpts, IKeyBoardSettings, ToolMode, IGuiMeta, MaskRenderMode } from "./core/types";
4
4
  import { DragOperator } from "./DragOperator";
5
5
  import type { ChannelValue, RGBAColor, ChannelColorMap } from "./core";
6
6
  import type { SphereType } from "./tools/SphereTool";
@@ -98,6 +98,34 @@ export declare class NrrdTools {
98
98
  executeAction(action: "undo" | "redo" | "clearActiveSliceMask" | "clearActiveLayerMask" | "resetZoom" | "downloadCurrentMask" | "gaussianSmooth", opts?: {
99
99
  sigma?: number;
100
100
  }): void;
101
+ /**
102
+ * Erase one channel's mask on one layer, undoably.
103
+ *
104
+ * The missing third of the clear family that `executeAction` exposes:
105
+ * `clearActiveSliceMask` takes one slice, `clearActiveLayerMask` takes a whole layer,
106
+ * and neither can take a single label. Deleting one annotation needs exactly that —
107
+ * its mask is one label inside a volume shared with every other annotation on the
108
+ * layer.
109
+ *
110
+ * Not folded into `executeAction`: that signature is an action name plus an options
111
+ * bag, and this needs two required arguments.
112
+ *
113
+ * Deltas go onto the engine's own undo stack, so a mistaken clear is recoverable for
114
+ * as long as the case stays open. That is the whole reason this lives here rather
115
+ * than in the app: writing zeros from outside and forcing a repaint by stepping the
116
+ * slice would bypass the stack, and an accidental clear would be permanent.
117
+ *
118
+ * Only slices that actually carry the label are touched, so a small annotation in a
119
+ * deep volume costs a scan and a handful of callbacks rather than one per slice.
120
+ *
121
+ * @param layerId Layer whose mask to edit.
122
+ * @param channel Label to erase, 1-255.
123
+ * @throws {Error} If `layerId` names no layer. Deliberately NOT routed through
124
+ * `getVolumeForLayer`, which warns and falls back to the first layer — for a
125
+ * destructive call that would quietly erase a different layer's annotation.
126
+ * @throws {RangeError} If `channel` is outside [1, 255] (from `MaskVolume`).
127
+ */
128
+ clearChannel(layerId: string, channel: number): void;
101
129
  undo(): void;
102
130
  redo(): void;
103
131
  enterKeyboardConfig(): void;
@@ -226,6 +254,18 @@ export declare class NrrdTools {
226
254
  setLayerOpacity(layerId: string, opacity: number): void;
227
255
  getLayerOpacity(layerId: string): number;
228
256
  getLayerOpacityMap(): Record<string, number>;
257
+ /**
258
+ * Fill every mask, or stroke only its boundary — for every layer and channel at once.
259
+ *
260
+ * A display decision, and nothing but: `MaskVolume` is not read differently and not written
261
+ * at all, so what is stored, uploaded, exported and undone is the complete mask either way.
262
+ *
263
+ * Repaints immediately, the same way `setChannelVisible` does, because there is no other
264
+ * event that would bring the change to the screen — a clinician who switched the mode and
265
+ * then had to scrub a slice to see it would reasonably call that broken.
266
+ */
267
+ setMaskRenderMode(mode: MaskRenderMode): void;
268
+ getMaskRenderMode(): MaskRenderMode;
229
269
  updateOriginAndChangedWH(): void;
230
270
  setSyncsliceNum(): void;
231
271
  resetPaintAreaUIPosition(l?: number, t?: number): void;
@@ -31,6 +31,12 @@ export declare class RenderingUtils {
31
31
  * applied at fill time and intentionally *not* cached, so toggling them
32
32
  * needs no recompute.
33
33
  *
34
+ * The render mode is not in the key either. Fill paths and outline paths
35
+ * are built lazily and side by side under the same entry, so switching
36
+ * mode costs one extraction per visible label the first time and is a
37
+ * cache hit every time after — and a session that never leaves fill mode
38
+ * never builds an outline.
39
+ *
34
40
  * One entry per layer (the current slice). Switching slice/axis or
35
41
  * editing overwrites it.
36
42
  */
@@ -67,6 +73,15 @@ export declare class RenderingUtils {
67
73
  * allocating a new ImageData per layer per slice switch.
68
74
  */
69
75
  getOrCreateSliceBuffer(axis: "x" | "y" | "z"): ImageData | null;
76
+ /**
77
+ * Populate one cache entry's paths for one render mode.
78
+ *
79
+ * Split out because the two modes are built at different times: whichever is in use when
80
+ * a slice is first drawn, and the other one only if the clinician switches while still on
81
+ * that slice. Building both eagerly would make every slice scrub pay for a mode most
82
+ * sessions never turn on.
83
+ */
84
+ private buildPaths;
70
85
  /**
71
86
  * Render a layer's slice onto the target canvas as vector contours.
72
87
  *
@@ -79,6 +94,23 @@ export declare class RenderingUtils {
79
94
  * is no longer used on this path — callers may pass any valid ImageData.
80
95
  */
81
96
  renderSliceToCanvas(layer: string, axis: "x" | "y" | "z", sliceIndex: number, _buffer: ImageData, targetCtx: CanvasRenderingContext2D, scaledWidth: number, scaledHeight: number): void;
97
+ /**
98
+ * Render a layer's slice FILLED, whatever the clinician is currently looking at.
99
+ *
100
+ * For the tools that bake (`syncLayerSliceData` — pencil and eraser) the layer canvas is
101
+ * not a picture of the mask, it is the input the mask is rebuilt from: the bake replaces
102
+ * the whole slice in `MaskVolume` with whatever pixels it finds there.
103
+ *
104
+ * An outline is a lossy picture — it says where a mask ends, not what it contains — so
105
+ * baking one back writes rings and erases every interior on that slice, taking every other
106
+ * finding on the layer with it. One pencil stroke was enough.
107
+ *
108
+ * Hence a separate entry point rather than a flag threaded through the display path: a
109
+ * render that is about to be read back has a different requirement from one that is about
110
+ * to be looked at, and the two only coincided while there was one way to draw a mask.
111
+ */
112
+ renderSliceForBake(layer: string, axis: "x" | "y" | "z", sliceIndex: number, targetCtx: CanvasRenderingContext2D, scaledWidth: number, scaledHeight: number): void;
113
+ private drawSlice;
82
114
  /**
83
115
  * Invalidate the reusable buffer (e.g. when switching datasets).
84
116
  */
@@ -66,6 +66,32 @@ export declare function extractLabelPolygons(labels: Uint8Array, width: number,
66
66
  * visited so the contour closes correctly at the bbox edges.
67
67
  */
68
68
  export declare function extractLabelContours(labels: Uint8Array, width: number, height: number, targetLabel: number, stride?: number, channelOffset?: number, bbox?: ContourBBox): Path2D;
69
+ /**
70
+ * Emit the boundary of the region where `labels === targetLabel`, as open two-point segments.
71
+ *
72
+ * The counterpart to {@link extractLabelPolygons}: that one covers the region, this one traces
73
+ * its edge. Both walk the same cells with the same sampling, the same out-of-bounds rule and
74
+ * the same `+0.5` shift, so a renderer can fill one and stroke the other and have the mask end
75
+ * in exactly the same place either way.
76
+ *
77
+ * Segments are emitted per cell and left unjoined. Canvas rasterises a whole `Path2D` in one
78
+ * compositing pass, so segments meeting at a shared endpoint produce no seam and no doubled
79
+ * alpha where their round caps overlap — joining them into polylines would buy nothing and
80
+ * cost a chaining pass.
81
+ *
82
+ * Cost follows the perimeter, not the area: solid interior is case 15, which has no boundary.
83
+ *
84
+ * Parameters match {@link extractLabelContours}.
85
+ */
86
+ export declare function extractLabelBoundarySegments(labels: Uint8Array, width: number, height: number, targetLabel: number, stride?: number, channelOffset?: number, bbox?: ContourBBox): ContourPolygon[];
87
+ /**
88
+ * {@link extractLabelBoundarySegments} as a `Path2D`, ready to stroke.
89
+ *
90
+ * The outline counterpart to {@link extractLabelContours}. Stroke this; do not stroke the
91
+ * contour path — that one is per-cell polygons whose union is the silhouette, and stroking it
92
+ * draws every internal cell edge as well, covering the mask in a grid.
93
+ */
94
+ export declare function extractLabelOutline(labels: Uint8Array, width: number, height: number, targetLabel: number, stride?: number, channelOffset?: number, bbox?: ContourBBox): Path2D;
69
95
  /**
70
96
  * Detect the distinct non-zero labels present in a slice region.
71
97
  *
@@ -127,12 +127,12 @@ export declare class MaskVolume {
127
127
  * Update the color for a specific label/channel in the color map.
128
128
  *
129
129
  * For label-based volumes (1-channel), the channel parameter refers to
130
- * the label value (0-8), not the storage channel index.
130
+ * the label value, not the storage channel index.
131
131
  *
132
- * @param channel Label/channel index to update (0-8).
132
+ * @param channel Label/channel index to update (0-`MAX_ENGINE_CHANNEL`).
133
133
  * @param color New RGBA color.
134
134
  *
135
- * @throws {RangeError} If channel is outside valid label range [0, 8].
135
+ * @throws {RangeError} If channel is outside the storable label range.
136
136
  */
137
137
  setChannelColor(channel: number, color: RGBAColor): void;
138
138
  /**
@@ -228,7 +228,8 @@ export declare class MaskVolume {
228
228
  * @param sliceIndex Index along the specified axis.
229
229
  * @param imageData Canvas ImageData (RGBA) to convert.
230
230
  * @param axis `'x'`, `'y'`, or `'z'`.
231
- * @param activeChannel Fallback label for pixels whose RGB doesn't match any channel (1-8).
231
+ * @param activeChannel Fallback label for pixels whose RGB matches no channel exactly,
232
+ * and one of the candidates the nearest-colour search considers.
232
233
  * @param channelVisible Optional map of visible channels (true=visible, false=hidden).
233
234
  * If provided, data for hidden channels will be preserved
234
235
  * when the canvas pixel is transparent.
@@ -236,7 +237,7 @@ export declare class MaskVolume {
236
237
  setSliceLabelsFromImageData(sliceIndex: number, imageData: ImageData, axis?: 'x' | 'y' | 'z', activeChannel?: number, channelVisible?: Record<number, boolean>): void;
237
238
  /**
238
239
  * Build a Map from RGB packed integer to channel label for reverse lookup.
239
- * Uses this instance's colorMap (channels 1-8, skips 0 = transparent).
240
+ * Covers every label this instance has a colour for, skipping 0 (transparent).
240
241
  *
241
242
  * Instance method ensures custom per-layer colors are correctly reverse-mapped.
242
243
  */
@@ -349,6 +350,32 @@ export declare class MaskVolume {
349
350
  * ```
350
351
  */
351
352
  clear(): void;
353
+ /**
354
+ * Zero every voxel carrying one label, leaving every other label in place.
355
+ *
356
+ * The third member of the clear family: `clear()` takes the whole volume and
357
+ * `clearSlice()` takes one slice, both regardless of label. Deleting a single
358
+ * annotation needs neither — its mask is one label inside a volume it shares with
359
+ * every other annotation on that layer, so anything coarser takes the neighbours
360
+ * with it.
361
+ *
362
+ * Label-based volumes only, which is what `numChannels === 1` means here: the voxel
363
+ * value IS the label. A multi-plane volume stores channels as separate planes and
364
+ * would need a different sweep.
365
+ *
366
+ * The version is bumped only when a voxel actually changed. Every derived cache keyed
367
+ * on it — the contour cache above all — is invalidated by a bump, so bumping for a
368
+ * clear that found nothing would redraw the layer for no reason.
369
+ *
370
+ * @param channel Label to erase, 1-255. Zero is "empty", not a channel.
371
+ * @throws {RangeError} If `channel` is outside [1, 255].
372
+ *
373
+ * @example
374
+ * ```ts
375
+ * vol.clearChannel(3); // finding 3's voxels go; 1, 2 and 4 stay
376
+ * ```
377
+ */
378
+ clearChannel(channel: number): void;
352
379
  /**
353
380
  * Check if the volume contains any non-zero voxel data.
354
381
  *
@@ -67,10 +67,10 @@
67
67
  * const legacy = convertVolumeToIPaintImages(volume);
68
68
  * ```
69
69
  */
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, IConvertObjType, ICursorPage, IDragOpts, IDrawOpts, IKeyBoardSettings, } from './types';
71
- export { RenderMode, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, } from './types';
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, IConvertObjType, ICursorPage, IDragOpts, IDrawOpts, IKeyBoardSettings, MaskRenderMode, } from './types';
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
73
  export type { MaskDelta, UndoEntry } from './UndoManager';
74
74
  export { UndoManager } from './UndoManager';
75
75
  export type { ContourBBox, ContourPolygon } from './MarchingSquares';
76
- export { extractLabelContours, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
76
+ export { extractLabelBoundarySegments, extractLabelContours, extractLabelOutline, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
@@ -74,38 +74,39 @@ export interface SliceRenderOptions {
74
74
  * | 7 | Auxiliary annotation | Orange |
75
75
  * | 8 | Extended annotation | Purple |
76
76
  */
77
- export declare const MASK_CHANNEL_COLORS: Readonly<ChannelColorMap>;
78
77
  /**
79
- * CSS color strings for the default channel palette (for reference / UI).
78
+ * The largest label a mask voxel can carry. `MaskVolume` stores one byte per voxel and the
79
+ * value IS the label, so 0 is empty and 1-255 are annotation channels.
80
80
  */
81
- export declare const MASK_CHANNEL_CSS_COLORS: Readonly<Record<number, string>>;
81
+ export declare const MAX_ENGINE_CHANNEL = 255;
82
82
  /**
83
83
  * Layer identifier. Any string key is valid — layers are dynamically defined.
84
84
  */
85
85
  export type LayerId = string;
86
86
  /**
87
- * Channel value (0 = transparent/erased, 1-8 = annotation channels).
87
+ * Channel value: 0 is transparent/erased, 1..`MAX_ENGINE_CHANNEL` are annotation channels.
88
+ *
89
+ * A bare `number`, not a union. The union held while there were eight of them and cannot be
90
+ * written for 255; what it bought — a compile error on a bad literal — is now a runtime
91
+ * `RangeError` from `MaskVolume` instead. That is a real loss, and it is the price of the
92
+ * range: the storage is one byte per voxel whose value IS the label, so the engine has no
93
+ * standing to cap it lower than the byte does. A product's own limit is the product's
94
+ * business.
88
95
  */
89
- export type ChannelValue = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
96
+ export type ChannelValue = number;
97
+ export declare const MASK_CHANNEL_COLORS: Readonly<Record<number, RGBAColor>>;
98
+ export declare const MASK_CHANNEL_CSS_COLORS: Readonly<Record<number, string>>;
99
+ export declare const CHANNEL_HEX_COLORS: Readonly<Record<number, string>>;
100
+ export declare const AI_MASK_CHANNEL_COLORS: Readonly<Record<number, RGBAColor>>;
101
+ export declare const AI_CHANNEL_HEX_COLORS: Readonly<Record<number, string>>;
90
102
  /**
91
103
  * Convenience alias for MASK_CHANNEL_CSS_COLORS.
92
104
  * Used by Vue components via `Copper.CHANNEL_COLORS[channel]`.
105
+ *
106
+ * Declared here, with the tables it aliases. It used to sit further up, which was fine while
107
+ * those were object literals and is a temporal-dead-zone error now that they are built.
93
108
  */
94
109
  export declare const CHANNEL_COLORS: Readonly<Record<number, string>>;
95
- /**
96
- * Hex color strings for each channel (no alpha), used for fillColor/brushColor.
97
- */
98
- export declare const CHANNEL_HEX_COLORS: Readonly<Record<number, string>>;
99
- /**
100
- * AI-Assist channel palette. Identical to the default palette EXCEPT:
101
- * - channel 1 = cyan (the AI-Assist accent #5ec8ff), so the 2D AI overlay aligns
102
- * with the cyan ai_generated GLB in the 3D panel;
103
- * - channel 6 takes the emerald that channel 1 vacated, so cyan isn't duplicated.
104
- * Applied ONLY to the AI scratch layer (set per-volume in AiAssistTool.enter) —
105
- * the global palette above is untouched, so the clinician mask stays emerald.
106
- */
107
- export declare const AI_MASK_CHANNEL_COLORS: Readonly<ChannelColorMap>;
108
- export declare const AI_CHANNEL_HEX_COLORS: Readonly<Record<number, string>>;
109
110
  /**
110
111
  * Convert an RGBAColor to a hex string (no alpha), e.g. '#ff0000'.
111
112
  */
@@ -239,6 +240,14 @@ export interface IToolModeState {
239
240
  activeSphereType: "tumour" | "skin" | "nipple" | "ribcage";
240
241
  }
241
242
  /** Drawing configuration — brush/pencil appearance and behavior */
243
+ /**
244
+ * How a mask is drawn onto the slice.
245
+ *
246
+ * `"fill"` paints the silhouette; `"outline"` strokes only its edge, leaving the interior
247
+ * clear so the image underneath stays readable. Purely a render-time choice — the mask stored
248
+ * in `MaskVolume`, uploaded, exported and undone is the same either way.
249
+ */
250
+ export type MaskRenderMode = "fill" | "outline";
242
251
  export interface IDrawingConfig {
243
252
  globalAlpha: number;
244
253
  lineWidth: number;
@@ -246,6 +255,8 @@ export interface IDrawingConfig {
246
255
  fillColor: string;
247
256
  brushColor: string;
248
257
  brushAndEraserSize: number;
258
+ /** Fill the mask or stroke only its boundary. Applies to every layer and channel at once. */
259
+ maskRenderMode: MaskRenderMode;
249
260
  }
250
261
  /** View configuration — UI layout and interaction parameters */
251
262
  export interface IViewConfig {
@@ -259,11 +270,11 @@ export interface IViewConfig {
259
270
  /** Layer/channel state — active layer, channel, and visibility */
260
271
  export interface ILayerChannelState {
261
272
  layer: string;
262
- /** Currently active channel (1-8). Channel 0 is transparent/erased. */
273
+ /** Currently active channel. 0 is transparent/erased. */
263
274
  activeChannel: number;
264
275
  /** Layer visibility state: { layer1: true, layer2: true, layer3: true } */
265
276
  layerVisibility: Record<string, boolean>;
266
- /** Per-layer channel visibility: { layer1: { 1: true, ..., 8: true }, ... } */
277
+ /** Per-layer channel visibility: { layer1: { 1: true, 2: false, ... }, ... } */
267
278
  channelVisibility: Record<string, Record<number, boolean>>;
268
279
  /** Per-layer opacity: { layer1: 1.0, layer2: 0.6, ... }. Range [0.1, 1.0]. */
269
280
  layerOpacity: Record<string, number>;
@@ -115,10 +115,27 @@ export declare class DrawingTool extends BaseTool {
115
115
  /** Push delta to UndoManager after drawing completes */
116
116
  private pushUndoDelta;
117
117
  /**
118
- * Redraws persisted layer data onto ctx before new pencil fill.
119
- * Delegates to the host's vector renderSliceToCanvas for consistency.
118
+ * Redraws persisted layer data onto ctx before the new pencil fill.
119
+ *
120
+ * Uses the BAKE renderer, not the display one. What lands on this canvas is about to be
121
+ * read straight back into the MaskVolume by `syncLayerSliceData`, which replaces the whole
122
+ * slice -- so this render is the data, not a picture of it. Drawing outlines here would
123
+ * bake rings and erase the interior of every mask on the layer.
120
124
  */
121
125
  private redrawPreviousImageToLayerCtx;
126
+ /**
127
+ * Put the active layer's canvas into the solid state the eraser and the bake both need.
128
+ *
129
+ * The eraser removes pixels matching the active channel's colour, and `syncLayerSliceData`
130
+ * then rebuilds the whole slice from what is left on the canvas. Against an outline there
131
+ * is nothing to match inside a mask, so a drag over a lesion erases nothing -- and the bake
132
+ * that follows writes the ring back and loses every interior on the layer.
133
+ *
134
+ * Unconditional rather than checked against the display mode: in fill mode this redraws
135
+ * what is already on screen, and a mode-dependent branch here is one more thing that can
136
+ * fall out of step with the renderer.
137
+ */
138
+ private solidifyLayerForErase;
122
139
  /** Draw a line segment on a layer canvas (pencil mode only) */
123
140
  private drawLinesOnLayer;
124
141
  /** Paint a segment on the current layer canvas and composite to master (pencil mode) */
@@ -18,6 +18,12 @@ export interface ToolHost {
18
18
  drawImageOnEmptyImage(canvas: HTMLCanvasElement): void;
19
19
  compositeAllLayers(): void;
20
20
  renderSliceToCanvas(layer: string, axis: "x" | "y" | "z", sliceIndex: number, buffer: ImageData, targetCtx: CanvasRenderingContext2D, scaledWidth: number, scaledHeight: number): void;
21
+ /**
22
+ * Render a layer's slice filled, whatever the display mode is. For tools that follow a
23
+ * render with `syncLayerSliceData`, which rebuilds the whole slice from the canvas: an
24
+ * outline would bake back as a ring and erase every mask interior on that slice.
25
+ */
26
+ renderSliceForBake(layer: string, axis: "x" | "y" | "z", sliceIndex: number, targetCtx: CanvasRenderingContext2D, scaledWidth: number, scaledHeight: number): void;
21
27
  getOrCreateSliceBuffer(axis: "x" | "y" | "z"): ImageData | null;
22
28
  flipDisplayImageByAxis(): void;
23
29
  redrawDisplayCanvas(): void;
@@ -71,7 +77,7 @@ export type ZoomHostDeps = Pick<ToolHost, 'resetPaintAreaUIPosition' | 'resizePa
71
77
  /** SphereTool host dependencies */
72
78
  export type SphereHostDeps = Pick<ToolHost, 'setEmptyCanvasSize' | 'drawImageOnEmptyImage' | 'enableCrosshair' | 'setUpSphereOrigins'>;
73
79
  /** DrawingTool host dependencies */
74
- export type DrawingHostDeps = Pick<ToolHost, 'setCurrentLayer' | 'compositeAllLayers' | 'syncLayerSliceData' | 'filterDrawedImage' | 'getVolumeForLayer' | 'pushUndoDelta' | 'renderSliceToCanvas' | 'getOrCreateSliceBuffer'>;
80
+ export type DrawingHostDeps = Pick<ToolHost, 'setCurrentLayer' | 'compositeAllLayers' | 'syncLayerSliceData' | 'filterDrawedImage' | 'getVolumeForLayer' | 'pushUndoDelta' | 'renderSliceToCanvas' | 'renderSliceForBake' | 'getOrCreateSliceBuffer'>;
75
81
  /** DragSliceTool host dependencies */
76
82
  export type DragSliceHostDeps = Pick<ToolHost, 'setSyncsliceNum' | 'setIsDrawFalse' | 'flipDisplayImageByAxis' | 'setEmptyCanvasSize' | 'getOrCreateSliceBuffer' | 'renderSliceToCanvas' | 'refreshSphereOverlay' | 'compositeAllLayers'>;
77
83
  /** LayerChannelManager host dependencies */
@@ -55,12 +55,13 @@ import { nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadR
55
55
  import { IPaintImage, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, IGuiMeta } from "./Utils/segmentation/core/types";
56
56
  import { NrrdState } from "./Utils/segmentation/coreTools/NrrdState";
57
57
  import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
58
- import type { ToolMode, IAnnotationCallbacks } from "./Utils/segmentation/core/types";
58
+ import type { ToolMode, IAnnotationCallbacks, MaskRenderMode } from "./Utils/segmentation/core/types";
59
59
  import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, AI_MASK_CHANNEL_COLORS, AI_CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
60
60
  import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
61
+ import { MAX_ENGINE_CHANNEL } from "./Utils/segmentation/core/index";
61
62
  import type { AiPromptTool, AiPromptPoint, AiPromptPayload, AiMaskResult } from "./Utils/segmentation/tools/AiAssistTool";
62
63
  import "./css/style.css";
63
64
  export declare const REVISION: string;
64
- 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, 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
65
- 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, 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, };
65
+ 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, DEFAULT_AXES, ensureAxisExtracted, copperGltfLoader, setDracoDecoderPath, setKTX2TranscoderPath, easeInOutCubic, viewPointToPose, rotateAroundAxis, interpolateFlightPose, poseDistance, orbitStepPose, zoomPose, orbitSwingAngle, installFastSliceRepaint, };
66
+ 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, 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, };
66
67
  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": "3.10.1",
4
+ "version": "3.10.3",
5
5
  "main": "dist/bundle.umd.js",
6
6
  "moudle": "dist/bundle.esm.js",
7
7
  "types": "dist/types/index.d.ts",