copper3d 3.10.0 → 3.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -3
- package/dist/Utils/segmentation/DrawToolCore.d.ts +20 -0
- package/dist/Utils/segmentation/DrawToolCore.js +78 -47
- package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +40 -0
- package/dist/Utils/segmentation/NrrdTools.js +77 -0
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/core/MaskVolume.d.ts +32 -5
- package/dist/Utils/segmentation/core/MaskVolume.js +95 -18
- package/dist/Utils/segmentation/core/MaskVolume.js.map +1 -1
- package/dist/Utils/segmentation/core/index.d.ts +1 -1
- package/dist/Utils/segmentation/core/index.js +1 -1
- package/dist/Utils/segmentation/core/index.js.map +1 -1
- package/dist/Utils/segmentation/core/types.d.ts +22 -21
- package/dist/Utils/segmentation/core/types.js +77 -10
- package/dist/Utils/segmentation/core/types.js.map +1 -1
- package/dist/bundle.esm.js +330 -78
- package/dist/bundle.umd.js +330 -77
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/types/Utils/segmentation/DrawToolCore.d.ts +20 -0
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +40 -0
- package/dist/types/Utils/segmentation/core/MaskVolume.d.ts +32 -5
- package/dist/types/Utils/segmentation/core/index.d.ts +1 -1
- package/dist/types/Utils/segmentation/core/types.d.ts +22 -21
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -257,6 +285,18 @@ export declare class NrrdTools {
|
|
|
257
285
|
/** Layer visibility snapshot taken on enter, restored on exit. */
|
|
258
286
|
private _aiPrevVisibility;
|
|
259
287
|
isAiAssistActive(): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Suspend or resume annotation input.
|
|
290
|
+
*
|
|
291
|
+
* While suspended the reader may still scrub slices, zoom, pan and place the crosshair,
|
|
292
|
+
* but no input can write into a mask. This is the enforcement behind "during loading you
|
|
293
|
+
* may preview, not annotate": greying the Operation panel's buttons does not achieve it,
|
|
294
|
+
* because a tool selected before the load began stays armed on the canvas -- and a stroke
|
|
295
|
+
* made then cannot even be undone, since `afterLoadSlice` clears the undo stack each time
|
|
296
|
+
* a slice arrives.
|
|
297
|
+
*/
|
|
298
|
+
setAnnotationSuspended(suspended: boolean): void;
|
|
299
|
+
isAnnotationSuspended(): boolean;
|
|
260
300
|
/**
|
|
261
301
|
* Enter AI-assist mode (sandbox): hides the existing layer masks so ONLY the
|
|
262
302
|
* AI overlay is shown, takes canvas ownership (left-click = prompt), and creates
|
|
@@ -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
|
|
130
|
+
* the label value, not the storage channel index.
|
|
131
131
|
*
|
|
132
|
-
* @param channel Label/channel index to update (0
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
*
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
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, 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';
|
|
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';
|
|
@@ -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
|
-
*
|
|
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
|
|
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
|
|
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 =
|
|
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
|
*/
|
|
@@ -259,11 +260,11 @@ export interface IViewConfig {
|
|
|
259
260
|
/** Layer/channel state — active layer, channel, and visibility */
|
|
260
261
|
export interface ILayerChannelState {
|
|
261
262
|
layer: string;
|
|
262
|
-
/** Currently active channel
|
|
263
|
+
/** Currently active channel. 0 is transparent/erased. */
|
|
263
264
|
activeChannel: number;
|
|
264
265
|
/** Layer visibility state: { layer1: true, layer2: true, layer3: true } */
|
|
265
266
|
layerVisibility: Record<string, boolean>;
|
|
266
|
-
/** Per-layer channel visibility: { layer1: { 1: true,
|
|
267
|
+
/** Per-layer channel visibility: { layer1: { 1: true, 2: false, ... }, ... } */
|
|
267
268
|
channelVisibility: Record<string, Record<number, boolean>>;
|
|
268
269
|
/** Per-layer opacity: { layer1: 1.0, layer2: 0.6, ... }. Range [0.1, 1.0]. */
|
|
269
270
|
layerOpacity: Record<string, number>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -58,9 +58,10 @@ import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
|
|
|
58
58
|
import type { ToolMode, IAnnotationCallbacks } 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 { 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, };
|
|
65
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, 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.
|
|
4
|
+
"version": "3.10.2",
|
|
5
5
|
"main": "dist/bundle.umd.js",
|
|
6
6
|
"moudle": "dist/bundle.esm.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|