copper3d 3.0.0 → 3.0.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 +195 -28
- package/dist/Utils/segmentation/CommToolsData.d.ts +32 -18
- package/dist/Utils/segmentation/CommToolsData.js +69 -152
- package/dist/Utils/segmentation/CommToolsData.js.map +1 -1
- package/dist/Utils/segmentation/DragOperator.d.ts +10 -2
- package/dist/Utils/segmentation/DragOperator.js +18 -8
- package/dist/Utils/segmentation/DragOperator.js.map +1 -1
- package/dist/Utils/segmentation/DrawToolCore.d.ts +24 -18
- package/dist/Utils/segmentation/DrawToolCore.js +255 -436
- package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +152 -10
- package/dist/Utils/segmentation/NrrdTools.js +604 -203
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/core/MaskVolume.d.ts +1 -34
- package/dist/Utils/segmentation/core/MaskVolume.js +24 -124
- package/dist/Utils/segmentation/core/MaskVolume.js.map +1 -1
- package/dist/Utils/segmentation/core/UndoManager.d.ts +1 -1
- package/dist/Utils/segmentation/core/UndoManager.js +1 -1
- package/dist/Utils/segmentation/core/index.d.ts +0 -2
- package/dist/Utils/segmentation/core/index.js +0 -1
- package/dist/Utils/segmentation/core/index.js.map +1 -1
- package/dist/Utils/segmentation/core/types.js +24 -24
- package/dist/Utils/segmentation/core/types.js.map +1 -1
- package/dist/Utils/segmentation/coreTools/GuiState.d.ts +22 -0
- package/dist/Utils/segmentation/coreTools/GuiState.js +48 -0
- package/dist/Utils/segmentation/coreTools/GuiState.js.map +1 -0
- package/dist/Utils/segmentation/coreTools/NrrdState.d.ts +25 -0
- package/dist/Utils/segmentation/coreTools/NrrdState.js +85 -0
- package/dist/Utils/segmentation/coreTools/NrrdState.js.map +1 -0
- package/dist/Utils/segmentation/coreTools/coreType.d.ts +88 -65
- package/dist/Utils/segmentation/coreTools/coreType.js.map +1 -1
- package/dist/Utils/segmentation/coreTools/divControlTools.js +1 -1
- package/dist/Utils/segmentation/coreTools/divControlTools.js.map +1 -1
- package/dist/Utils/segmentation/coreTools/gui.d.ts +12 -9
- package/dist/Utils/segmentation/coreTools/gui.js +81 -107
- package/dist/Utils/segmentation/coreTools/gui.js.map +1 -1
- package/dist/Utils/segmentation/eventRouter/EventRouter.d.ts +2 -0
- package/dist/Utils/segmentation/eventRouter/EventRouter.js +19 -8
- package/dist/Utils/segmentation/eventRouter/EventRouter.js.map +1 -1
- package/dist/Utils/segmentation/eventRouter/types.d.ts +3 -3
- package/dist/Utils/segmentation/tools/BaseTool.d.ts +11 -5
- package/dist/Utils/segmentation/tools/BaseTool.js +1 -2
- package/dist/Utils/segmentation/tools/BaseTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/CrosshairTool.js +25 -25
- package/dist/Utils/segmentation/tools/CrosshairTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/DragSliceTool.d.ts +2 -0
- package/dist/Utils/segmentation/tools/DragSliceTool.js +63 -53
- package/dist/Utils/segmentation/tools/DragSliceTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/DrawingTool.d.ts +93 -0
- package/dist/Utils/segmentation/tools/DrawingTool.js +222 -0
- package/dist/Utils/segmentation/tools/DrawingTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/EraserTool.js +8 -8
- package/dist/Utils/segmentation/tools/EraserTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/ImageStoreHelper.d.ts +12 -32
- package/dist/Utils/segmentation/tools/ImageStoreHelper.js +45 -102
- package/dist/Utils/segmentation/tools/ImageStoreHelper.js.map +1 -1
- package/dist/Utils/segmentation/tools/PanTool.d.ts +53 -0
- package/dist/Utils/segmentation/tools/PanTool.js +90 -0
- package/dist/Utils/segmentation/tools/PanTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/SphereTool.d.ts +208 -3
- package/dist/Utils/segmentation/tools/SphereTool.js +456 -45
- package/dist/Utils/segmentation/tools/SphereTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/ZoomTool.js +5 -4
- package/dist/Utils/segmentation/tools/ZoomTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/index.d.ts +6 -2
- package/dist/Utils/segmentation/tools/index.js +4 -1
- package/dist/Utils/segmentation/tools/index.js.map +1 -1
- package/dist/bundle.esm.js +2451 -1622
- package/dist/bundle.umd.js +2451 -1622
- package/dist/index.d.ts +6 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/Utils/segmentation/CommToolsData.d.ts +32 -18
- package/dist/types/Utils/segmentation/DragOperator.d.ts +10 -2
- package/dist/types/Utils/segmentation/DrawToolCore.d.ts +24 -18
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +152 -10
- package/dist/types/Utils/segmentation/core/MaskVolume.d.ts +1 -34
- package/dist/types/Utils/segmentation/core/UndoManager.d.ts +1 -1
- package/dist/types/Utils/segmentation/core/index.d.ts +0 -2
- package/dist/types/Utils/segmentation/coreTools/GuiState.d.ts +22 -0
- package/dist/types/Utils/segmentation/coreTools/NrrdState.d.ts +25 -0
- package/dist/types/Utils/segmentation/coreTools/coreType.d.ts +88 -65
- package/dist/types/Utils/segmentation/coreTools/gui.d.ts +12 -9
- package/dist/types/Utils/segmentation/eventRouter/EventRouter.d.ts +2 -0
- package/dist/types/Utils/segmentation/eventRouter/types.d.ts +3 -3
- package/dist/types/Utils/segmentation/tools/BaseTool.d.ts +11 -5
- package/dist/types/Utils/segmentation/tools/DragSliceTool.d.ts +2 -0
- package/dist/types/Utils/segmentation/tools/DrawingTool.d.ts +93 -0
- package/dist/types/Utils/segmentation/tools/ImageStoreHelper.d.ts +12 -32
- package/dist/types/Utils/segmentation/tools/PanTool.d.ts +53 -0
- package/dist/types/Utils/segmentation/tools/SphereTool.d.ts +208 -3
- package/dist/types/Utils/segmentation/tools/index.d.ts +6 -2
- package/dist/types/index.d.ts +6 -3
- package/package.json +1 -1
- package/dist/Utils/segmentation/core/MigrationUtils.d.ts +0 -97
- package/dist/Utils/segmentation/core/MigrationUtils.js +0 -163
- package/dist/Utils/segmentation/core/MigrationUtils.js.map +0 -1
- package/dist/types/Utils/segmentation/core/MigrationUtils.d.ts +0 -97
package/dist/index.d.ts
CHANGED
|
@@ -17,10 +17,13 @@ import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls"
|
|
|
17
17
|
import { MeshNodeTool } from "./Utils/MeshNodeTool";
|
|
18
18
|
import { removeGuiFolderChilden } from "./Utils/segmentation/coreTools/gui";
|
|
19
19
|
import { nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, exportPaintImageType, IOptVTKLoader } from "./types/types";
|
|
20
|
-
import { IPaintImage, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates } from "./Utils/segmentation/coreTools/coreType";
|
|
20
|
+
import { IPaintImage, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, IGuiMeta } from "./Utils/segmentation/coreTools/coreType";
|
|
21
|
+
import { NrrdState } from "./Utils/segmentation/coreTools/NrrdState";
|
|
22
|
+
import { GuiState } from "./Utils/segmentation/coreTools/GuiState";
|
|
23
|
+
import type { ToolMode, IAnnotationCallbacks } from "./Utils/segmentation/coreTools/coreType";
|
|
21
24
|
import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
|
|
22
25
|
import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
|
|
23
26
|
import "./css/style.css";
|
|
24
|
-
export declare const REVISION = "v3.0.
|
|
27
|
+
export declare const REVISION = "v3.0.2-beta";
|
|
25
28
|
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, CHANNEL_COLORS, CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, };
|
|
26
|
-
export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, LayerId, ChannelValue, };
|
|
29
|
+
export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, NrrdState, GuiState, IGuiMeta, ToolMode, IAnnotationCallbacks, LayerId, ChannelValue, };
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { MeshNodeTool } from "./Utils/MeshNodeTool";
|
|
|
20
20
|
import { removeGuiFolderChilden } from "./Utils/segmentation/coreTools/gui";
|
|
21
21
|
import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
|
|
22
22
|
import "./css/style.css";
|
|
23
|
-
export const REVISION = "v3.0.
|
|
23
|
+
export const REVISION = "v3.0.2-beta";
|
|
24
24
|
console.log(`%cCopper3D Visualisation %cBeta:${REVISION}`, "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
|
|
25
25
|
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, CHANNEL_COLORS, CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, };
|
|
26
26
|
//# 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,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,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,iDAAiD;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;
|
|
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,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,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,iDAAiD;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAiB5E,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG3G,OAAO,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC;AAEtC,OAAO,CAAC,GAAG,CACT,mCAAmC,QAAQ,EAAE,EAC7C,8CAA8C,EAC9C,8CAA8C,CAC/C,CAAC;AAEF,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,SAAS,EACT,OAAO,EACP,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAS,GACV,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { IProtected,
|
|
1
|
+
import { IProtected, ICursorPage, IConvertObjType, INewMaskData, IKeyBoardSettings, IAnnotationCallbacks } from "./coreTools/coreType";
|
|
2
|
+
import { NrrdState } from "./coreTools/NrrdState";
|
|
3
|
+
import { GuiState } from "./coreTools/GuiState";
|
|
2
4
|
import { MaskVolume } from "./core/index";
|
|
3
5
|
export declare class CommToolsData {
|
|
4
6
|
baseCanvasesSize: number;
|
|
5
7
|
private _reusableSliceBuffer;
|
|
6
8
|
private _reusableBufferWidth;
|
|
7
9
|
private _reusableBufferHeight;
|
|
10
|
+
/** External annotation callbacks — set via draw() options */
|
|
11
|
+
protected annotationCallbacks: IAnnotationCallbacks;
|
|
8
12
|
/** Whether the keyboard-config dialog is open (suppresses all shortcuts). */
|
|
9
13
|
protected _configKeyBoard: boolean;
|
|
10
14
|
/** Active keyboard shortcut bindings. */
|
|
11
15
|
protected _keyboardSettings: IKeyBoardSettings;
|
|
12
|
-
nrrd_states:
|
|
13
|
-
cursorPage: ICursorPage;
|
|
14
|
-
gui_states:
|
|
15
|
-
protectedData: IProtected;
|
|
16
|
+
protected nrrd_states: NrrdState;
|
|
17
|
+
protected cursorPage: ICursorPage;
|
|
18
|
+
protected gui_states: GuiState;
|
|
19
|
+
protected protectedData: IProtected;
|
|
16
20
|
constructor(container: HTMLElement, mainAreaContainer: HTMLElement, options?: {
|
|
17
21
|
layers?: string[];
|
|
18
22
|
});
|
|
@@ -56,9 +60,9 @@ export declare class CommToolsData {
|
|
|
56
60
|
private generateSystemCanvases;
|
|
57
61
|
private generateLayerTargets;
|
|
58
62
|
/**
|
|
59
|
-
* Rewrite this {
|
|
63
|
+
* Rewrite this {clearActiveSlice} function under DrawToolCore
|
|
60
64
|
*/
|
|
61
|
-
|
|
65
|
+
clearActiveSlice(): void;
|
|
62
66
|
/**
|
|
63
67
|
* Rewrite this {undoLastPainting} function under DrawToolCore
|
|
64
68
|
*/
|
|
@@ -68,13 +72,9 @@ export declare class CommToolsData {
|
|
|
68
72
|
*/
|
|
69
73
|
redoLastPainting(): void;
|
|
70
74
|
/**
|
|
71
|
-
* Rewrite this {
|
|
75
|
+
* Rewrite this {clearActiveLayer} function under NrrdTools
|
|
72
76
|
*/
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Rewrite this {createEmptyPaintImage} function under NrrdTools
|
|
76
|
-
*/
|
|
77
|
-
createEmptyPaintImage(dimensions: Array<number>, paintImages: IPaintImages): void;
|
|
77
|
+
clearActiveLayer(): void;
|
|
78
78
|
/**
|
|
79
79
|
* Rewrite this {resizePaintArea} function under NrrdTools
|
|
80
80
|
*/
|
|
@@ -107,6 +107,17 @@ export declare class CommToolsData {
|
|
|
107
107
|
* Rewrite this {resetLayerCanvas} function under NrrdTools
|
|
108
108
|
*/
|
|
109
109
|
resetLayerCanvas(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Enter sphere mode: clear all layer canvases (not MaskVolume),
|
|
112
|
+
* hide all mask data so sphere overlay is the only visible annotation.
|
|
113
|
+
* Rewrite this under NrrdTools.
|
|
114
|
+
*/
|
|
115
|
+
enterSphereMode(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Exit sphere mode: clear sphere canvas overlay, reload all layer
|
|
118
|
+
* MaskVolume data back onto canvases. Rewrite this under NrrdTools.
|
|
119
|
+
*/
|
|
120
|
+
exitSphereMode(): void;
|
|
110
121
|
/**
|
|
111
122
|
* Rewrite this {setSyncsliceNum} function under NrrdTools
|
|
112
123
|
*/
|
|
@@ -116,15 +127,18 @@ export declare class CommToolsData {
|
|
|
116
127
|
*/
|
|
117
128
|
redrawDisplayCanvas(): void;
|
|
118
129
|
/**
|
|
119
|
-
* Get a painted mask image
|
|
130
|
+
* Get a painted mask image based on current axis and input slice index.
|
|
120
131
|
*
|
|
121
|
-
* Phase 3: Reads directly from MaskVolume
|
|
132
|
+
* Phase 3: Reads directly from MaskVolume.
|
|
122
133
|
*
|
|
123
134
|
* @param axis "x" | "y" | "z"
|
|
124
135
|
* @param sliceIndex number
|
|
125
|
-
* @returns
|
|
136
|
+
* @returns Object with index and image, or undefined
|
|
126
137
|
*/
|
|
127
|
-
filterDrawedImage(axis: "x" | "y" | "z", sliceIndex: number):
|
|
138
|
+
filterDrawedImage(axis: "x" | "y" | "z", sliceIndex: number): {
|
|
139
|
+
index: number;
|
|
140
|
+
image: ImageData;
|
|
141
|
+
} | undefined;
|
|
128
142
|
/**
|
|
129
143
|
* Get or create a reusable ImageData buffer for the given axis.
|
|
130
144
|
*
|
|
@@ -139,7 +153,7 @@ export declare class CommToolsData {
|
|
|
139
153
|
/**
|
|
140
154
|
* Render a layer's slice into a reusable buffer and draw to the target canvas.
|
|
141
155
|
*
|
|
142
|
-
* Uses MaskVolume.
|
|
156
|
+
* Uses MaskVolume.renderLabelSliceInto() for zero-allocation rendering.
|
|
143
157
|
* The caller should obtain the buffer via getOrCreateSliceBuffer() and reuse
|
|
144
158
|
* it across multiple layer renders.
|
|
145
159
|
*
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { IDragOpts, IDrawingEvents, IProtected
|
|
1
|
+
import { IDragOpts, IDrawingEvents, IProtected } from "./coreTools/coreType";
|
|
2
|
+
import { NrrdState } from "./coreTools/NrrdState";
|
|
3
|
+
import { GuiState } from "./coreTools/GuiState";
|
|
2
4
|
import type { EventRouter } from "./eventRouter";
|
|
3
5
|
export declare class DragOperator {
|
|
4
6
|
container: HTMLElement;
|
|
@@ -16,10 +18,16 @@ export declare class DragOperator {
|
|
|
16
18
|
private setEmptyCanvasSize;
|
|
17
19
|
private getOrCreateSliceBuffer;
|
|
18
20
|
private renderSliceToCanvas;
|
|
21
|
+
private refreshSphereOverlayCb;
|
|
19
22
|
private eventRouter;
|
|
20
|
-
constructor(container: HTMLElement, nrrd_sates:
|
|
23
|
+
constructor(container: HTMLElement, nrrd_sates: NrrdState, gui_states: GuiState, protectedData: IProtected, drawingPrameters: IDrawingEvents, setSyncsliceNum: () => void, setIsDrawFalse: (target: number) => void, flipDisplayImageByAxis: () => void, setEmptyCanvasSize: (axis?: "x" | "y" | "z") => void, getOrCreateSliceBuffer: (axis: "x" | "y" | "z") => ImageData | null, renderSliceToCanvas: (layer: string, axis: "x" | "y" | "z", sliceIndex: number, buffer: ImageData, targetCtx: CanvasRenderingContext2D, scaledWidth: number, scaledHeight: number) => void);
|
|
21
24
|
private init;
|
|
22
25
|
setShowDragNumberDiv(sliceIndexContainer: HTMLDivElement): void;
|
|
26
|
+
/**
|
|
27
|
+
* Set the sphere overlay refresh callback.
|
|
28
|
+
* Called by NrrdTools after DrawToolCore is initialized.
|
|
29
|
+
*/
|
|
30
|
+
setRefreshSphereOverlay(cb: () => void): void;
|
|
23
31
|
/**
|
|
24
32
|
* Set the EventRouter reference for centralized event handling.
|
|
25
33
|
* Called by NrrdTools/DrawToolCore after EventRouter is initialized.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConvertObjType, IDrawingEvents, IContrastEvents, IDrawOpts
|
|
1
|
+
import { IConvertObjType, IDrawingEvents, IContrastEvents, IDrawOpts } from "./coreTools/coreType";
|
|
2
2
|
import { CommToolsData } from "./CommToolsData";
|
|
3
3
|
import { EventRouter } from "./eventRouter";
|
|
4
4
|
import { SphereTool } from "./tools/SphereTool";
|
|
@@ -6,6 +6,8 @@ import { CrosshairTool } from "./tools/CrosshairTool";
|
|
|
6
6
|
import { ContrastTool } from "./tools/ContrastTool";
|
|
7
7
|
import { ZoomTool } from "./tools/ZoomTool";
|
|
8
8
|
import { EraserTool } from "./tools/EraserTool";
|
|
9
|
+
import { PanTool } from "./tools/PanTool";
|
|
10
|
+
import { DrawingTool } from "./tools/DrawingTool";
|
|
9
11
|
import { ImageStoreHelper } from "./tools/ImageStoreHelper";
|
|
10
12
|
import { UndoManager } from "./core";
|
|
11
13
|
export declare class DrawToolCore extends CommToolsData {
|
|
@@ -16,17 +18,17 @@ export declare class DrawToolCore extends CommToolsData {
|
|
|
16
18
|
eraserUrls: string[];
|
|
17
19
|
pencilUrls: string[];
|
|
18
20
|
undoManager: UndoManager;
|
|
19
|
-
/** Snapshot of the active layer's slice captured on mouse-down (before drawing). */
|
|
20
|
-
private preDrawSlice;
|
|
21
|
-
private preDrawAxis;
|
|
22
|
-
private preDrawSliceIndex;
|
|
23
21
|
protected eventRouter: EventRouter | null;
|
|
24
22
|
protected sphereTool: SphereTool;
|
|
25
23
|
protected crosshairTool: CrosshairTool;
|
|
26
24
|
protected contrastTool: ContrastTool;
|
|
27
25
|
protected zoomTool: ZoomTool;
|
|
28
26
|
protected eraserTool: EraserTool;
|
|
27
|
+
protected panTool: PanTool;
|
|
28
|
+
protected drawingTool: DrawingTool;
|
|
29
29
|
protected imageStoreHelper: ImageStoreHelper;
|
|
30
|
+
/** Slice index recorded when paintOnCanvas() starts, guards stale-click */
|
|
31
|
+
private paintSliceIndex;
|
|
30
32
|
start: () => void;
|
|
31
33
|
constructor(container: HTMLElement, options?: {
|
|
32
34
|
layers?: string[];
|
|
@@ -37,15 +39,13 @@ export declare class DrawToolCore extends CommToolsData {
|
|
|
37
39
|
setPencilIconUrls(urls: string[]): void;
|
|
38
40
|
private setCurrentLayer;
|
|
39
41
|
draw(opts?: IDrawOpts): void;
|
|
40
|
-
drawCalSphereDown(x: number, y: number, sliceIndex: number, cal_position: "tumour" | "skin" | "nipple" | "ribcage"): void;
|
|
41
|
-
drawCalSphereUp(): void;
|
|
42
42
|
private zoomActionAfterDrawSphere;
|
|
43
43
|
private clearSpherePrintStoreImages;
|
|
44
44
|
private paintOnCanvas;
|
|
45
|
+
/** Extracted from paintOnCanvas() — handles sphere placement on left-click */
|
|
46
|
+
private handleSphereClick;
|
|
45
47
|
/*************************************May consider to move outside *******************************************/
|
|
46
48
|
private drawLine;
|
|
47
|
-
private drawLinesOnLayer;
|
|
48
|
-
private paintOnCanvasLayer;
|
|
49
49
|
private initAllCanvas;
|
|
50
50
|
private useEraser;
|
|
51
51
|
configMouseZoomWheel(): (e: WheelEvent) => void;
|
|
@@ -58,6 +58,11 @@ export declare class DrawToolCore extends CommToolsData {
|
|
|
58
58
|
private configMouseSphereWheel;
|
|
59
59
|
drawCalculatorSphere(radius: number): void;
|
|
60
60
|
drawSphere(mouseX: number, mouseY: number, radius: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Refresh sphere canvas from sphereMaskVolume for the current slice/axis.
|
|
63
|
+
* Called after view changes (slice switch, zoom, contrast, axis switch).
|
|
64
|
+
*/
|
|
65
|
+
refreshSphereOverlay(): void;
|
|
61
66
|
/**
|
|
62
67
|
* Convert cursor point between axis views.
|
|
63
68
|
* Delegated to CrosshairTool.
|
|
@@ -68,13 +73,17 @@ export declare class DrawToolCore extends CommToolsData {
|
|
|
68
73
|
getRestLayer(): string[];
|
|
69
74
|
/**************************** Undo/Redo functions (Phase 6 — Delta-based) ****************************/
|
|
70
75
|
/**
|
|
71
|
-
* Clear mask on current slice canvas.
|
|
76
|
+
* Clear the mask on the current slice canvas for the active layer ONLY.
|
|
77
|
+
*
|
|
78
|
+
* This method only clears the active layer's MaskVolume slice data for the
|
|
79
|
+
* currently viewed slice index. Other slices in the same layer remain intact.
|
|
80
|
+
* Other background layers are also left untouched.
|
|
81
|
+
* After clearing, all layer canvases are re-rendered from the `MaskVolume`
|
|
82
|
+
* to keep the visuals in sync.
|
|
72
83
|
*
|
|
73
|
-
*
|
|
74
|
-
* re-stores, and notifies external via getMask callback with clearFlag=true.
|
|
75
|
-
* Phase 6: Also records a MaskDelta for undo support.
|
|
84
|
+
* The operation is recorded to the UndoManager to allow for user rollback.
|
|
76
85
|
*/
|
|
77
|
-
|
|
86
|
+
clearActiveSlice(): void;
|
|
78
87
|
/**
|
|
79
88
|
* Undo the last drawing operation on the active layer.
|
|
80
89
|
* Restores the MaskVolume slice to its pre-draw state, re-renders
|
|
@@ -93,10 +102,7 @@ export declare class DrawToolCore extends CommToolsData {
|
|
|
93
102
|
*/
|
|
94
103
|
private applyUndoRedoToCanvas;
|
|
95
104
|
/****************************Store images (delegated to ImageStoreHelper)****************************************************/
|
|
96
|
-
|
|
97
|
-
storeAllImages(index: number, layer: string): void;
|
|
98
|
-
storeImageToLayer(index: number, canvas: HTMLCanvasElement, paintedImages: IPaintImages): ImageData;
|
|
99
|
-
storeEachLayerImage(index: number, layer: string): void;
|
|
105
|
+
syncLayerSliceData(index: number, layer: string): void;
|
|
100
106
|
/******************************** Utils gui related functions (delegated to ContrastTool) ***************************************/
|
|
101
107
|
setupConrastEvents(callback: (step: number, towards: "horizental" | "vertical") => void): void;
|
|
102
108
|
configContrastDragMode: () => void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { nrrdSliceType, storeExportPaintImageType, loadingBarType } from "../../types/types";
|
|
2
2
|
import { GUI } from "dat.gui";
|
|
3
|
-
import { IMaskData, IDragOpts,
|
|
3
|
+
import { IMaskData, IDragOpts, IKeyBoardSettings, ToolMode, IGuiMeta } from "./coreTools/coreType";
|
|
4
4
|
import { DragOperator } from "./DragOperator";
|
|
5
5
|
import { DrawToolCore } from "./DrawToolCore";
|
|
6
6
|
import type { ChannelValue, RGBAColor, ChannelColorMap } from "./core";
|
|
7
|
+
import type { SphereType } from "./tools/SphereTool";
|
|
7
8
|
/**
|
|
8
9
|
* Core NRRD annotation tool for medical image segmentation.
|
|
9
10
|
*
|
|
@@ -25,6 +26,10 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
25
26
|
private guiParameterSettings;
|
|
26
27
|
private _sliceRAFId;
|
|
27
28
|
private _pendingSliceStep;
|
|
29
|
+
/** Whether calculator mode is active (not part of gui_states interface) */
|
|
30
|
+
private _calculatorActive;
|
|
31
|
+
/** Stored closure callbacks from gui.ts setupGui() */
|
|
32
|
+
private guiCallbacks;
|
|
28
33
|
constructor(container: HTMLDivElement, options?: {
|
|
29
34
|
layers?: string[];
|
|
30
35
|
});
|
|
@@ -49,10 +54,11 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
49
54
|
* @param gui GUI
|
|
50
55
|
*/
|
|
51
56
|
setupGUI(gui: GUI): void;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Sync guiParameterSettings with current volume metadata.
|
|
59
|
+
* Called internally when slices are loaded or switched.
|
|
60
|
+
*/
|
|
61
|
+
private syncGuiParameterSettings;
|
|
56
62
|
/**
|
|
57
63
|
* Set the active layer and update fillColor/brushColor to match the active channel.
|
|
58
64
|
*/
|
|
@@ -61,6 +67,97 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
61
67
|
* Set the active channel (1-8) and update fillColor/brushColor.
|
|
62
68
|
*/
|
|
63
69
|
setActiveChannel(channel: ChannelValue): void;
|
|
70
|
+
/**
|
|
71
|
+
* Set the active sphere type for the SphereTool.
|
|
72
|
+
* Replaces direct mutation of `gui_states.activeSphereType`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* nrrdTools.setActiveSphereType('nipple');
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
setActiveSphereType(type: SphereType): void;
|
|
80
|
+
/**
|
|
81
|
+
* Get the currently active sphere type.
|
|
82
|
+
*/
|
|
83
|
+
getActiveSphereType(): SphereType;
|
|
84
|
+
/**
|
|
85
|
+
* Set the current tool mode. Handles deactivation of the previous mode
|
|
86
|
+
* and activation of the new mode, including all gui.ts side-effects.
|
|
87
|
+
*
|
|
88
|
+
* Replaces direct mutation of `guiSettings.value.guiState["pencil"]` etc.
|
|
89
|
+
* from Vue components.
|
|
90
|
+
*/
|
|
91
|
+
setMode(mode: ToolMode): void;
|
|
92
|
+
/**
|
|
93
|
+
* Get the current tool mode based on gui_states flags.
|
|
94
|
+
*/
|
|
95
|
+
getMode(): ToolMode;
|
|
96
|
+
/**
|
|
97
|
+
* Check if calculator mode is active.
|
|
98
|
+
*/
|
|
99
|
+
isCalculatorActive(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Set mask overlay opacity.
|
|
102
|
+
* @param value Opacity value [0.1, 1]
|
|
103
|
+
*/
|
|
104
|
+
setOpacity(value: number): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get the current mask overlay opacity.
|
|
107
|
+
*/
|
|
108
|
+
getOpacity(): number;
|
|
109
|
+
/**
|
|
110
|
+
* Set brush and eraser size, and trigger cursor update.
|
|
111
|
+
* @param size Brush size [5, 50]
|
|
112
|
+
*/
|
|
113
|
+
setBrushSize(size: number): void;
|
|
114
|
+
/**
|
|
115
|
+
* Get the current brush/eraser size.
|
|
116
|
+
*/
|
|
117
|
+
getBrushSize(): number;
|
|
118
|
+
/**
|
|
119
|
+
* Set window high (image contrast) value.
|
|
120
|
+
* Call finishWindowAdjustment() when the user finishes dragging.
|
|
121
|
+
*/
|
|
122
|
+
setWindowHigh(value: number): void;
|
|
123
|
+
/**
|
|
124
|
+
* Set window low (image center) value.
|
|
125
|
+
* Call finishWindowAdjustment() when the user finishes dragging.
|
|
126
|
+
*/
|
|
127
|
+
setWindowLow(value: number): void;
|
|
128
|
+
/**
|
|
129
|
+
* Finish a window/contrast adjustment (repaint all contrast slices).
|
|
130
|
+
*/
|
|
131
|
+
finishWindowAdjustment(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Adjust contrast by delta, used for drag-based contrast adjustment.
|
|
134
|
+
* @param type "windowHigh" or "windowLow"
|
|
135
|
+
* @param delta Delta amount to adjust
|
|
136
|
+
*/
|
|
137
|
+
adjustContrast(type: "windowHigh" | "windowLow", delta: number): void;
|
|
138
|
+
/**
|
|
139
|
+
* Get slider metadata for UI configuration.
|
|
140
|
+
* @param key Slider key: "globalAlpha", "brushAndEraserSize", "windowHigh", "windowLow"
|
|
141
|
+
* @returns IGuiMeta with min, max, step, and current value
|
|
142
|
+
*/
|
|
143
|
+
getSliderMeta(key: string): IGuiMeta | null;
|
|
144
|
+
/**
|
|
145
|
+
* Set the pencil stroke color.
|
|
146
|
+
*/
|
|
147
|
+
setPencilColor(hex: string): void;
|
|
148
|
+
/**
|
|
149
|
+
* Get the current pencil stroke color.
|
|
150
|
+
*/
|
|
151
|
+
getPencilColor(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Execute a named UI action.
|
|
154
|
+
* @param action Action name
|
|
155
|
+
*
|
|
156
|
+
* Renamed from original gui_states methods:
|
|
157
|
+
* - "clearActiveSliceMask" (was "clear") — clear annotations on current slice
|
|
158
|
+
* - "clearActiveLayerMask" (was "clearAll") — clear annotations on all slices for active layer
|
|
159
|
+
*/
|
|
160
|
+
executeAction(action: "undo" | "redo" | "clearActiveSliceMask" | "clearActiveLayerMask" | "resetZoom" | "downloadCurrentMask"): void;
|
|
64
161
|
/**
|
|
65
162
|
* Sync brush/fill color from the active layer's volume color map.
|
|
66
163
|
* Falls back to global CHANNEL_HEX_COLORS if volume not available.
|
|
@@ -331,6 +428,17 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
331
428
|
getVoxelSpacing(): number[];
|
|
332
429
|
getSpaceOrigin(): number[];
|
|
333
430
|
getMaskData(): IMaskData;
|
|
431
|
+
/**
|
|
432
|
+
* Programmatically place a calculator sphere at the given position.
|
|
433
|
+
*
|
|
434
|
+
* Replicates the full mouse-down → mouse-up flow (handleSphereClick + pointerup)
|
|
435
|
+
* so that backend-supplied sphere data is stored identically to a manual click.
|
|
436
|
+
*
|
|
437
|
+
* @param x - X coordinate in unscaled (original) image space
|
|
438
|
+
* @param y - Y coordinate in unscaled (original) image space
|
|
439
|
+
* @param sliceIndex - Target slice index (z-axis)
|
|
440
|
+
* @param cal_position - Sphere type to place
|
|
441
|
+
*/
|
|
334
442
|
setCalculateDistanceSphere(x: number, y: number, sliceIndex: number, cal_position: "tumour" | "skin" | "nipple" | "ribcage"): void;
|
|
335
443
|
/**
|
|
336
444
|
* Switch all contrast slices' orientation
|
|
@@ -339,15 +447,22 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
339
447
|
setSliceOrientation(axisTo: "x" | "y" | "z"): void;
|
|
340
448
|
addSkip(index: number): void;
|
|
341
449
|
removeSkip(index: number): void;
|
|
342
|
-
|
|
450
|
+
/**
|
|
451
|
+
* Reset the entire NrrdTools instance comprehensively.
|
|
452
|
+
* This clears ALL data across ALL layers globally, resets the Canvas visuals,
|
|
453
|
+
* undo/redo history, volume models, index parameters, and sphere overlays.
|
|
454
|
+
* Primarily used when switching cases/datasets or when a completely fresh state is needed.
|
|
455
|
+
* It is heavier than `clearActiveLayer` or `clearActiveSlice`.
|
|
456
|
+
*/
|
|
457
|
+
reset(): void;
|
|
343
458
|
setSliceMoving(step: number): void;
|
|
344
459
|
setMainAreaSize(factor: number): void;
|
|
345
460
|
getContainer(): HTMLElement;
|
|
346
461
|
getDrawingCanvas(): HTMLCanvasElement;
|
|
347
|
-
getNrrdToolsSettings(): import("./coreTools/
|
|
462
|
+
getNrrdToolsSettings(): import("./coreTools/NrrdState").NrrdState;
|
|
348
463
|
getMaxSliceNum(): number[];
|
|
349
464
|
getCurrentSlicesNumAndContrastNum(): {
|
|
350
|
-
|
|
465
|
+
currentSliceIndex: number;
|
|
351
466
|
contrastIndex: number;
|
|
352
467
|
};
|
|
353
468
|
getCurrentSliceIndex(): number;
|
|
@@ -370,7 +485,7 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
370
485
|
private updateMaxIndex;
|
|
371
486
|
/**
|
|
372
487
|
* Update the original canvas size, allow set to threejs load one (pixel distance not the mm).
|
|
373
|
-
* Then update the changedWidth and changedHeight based on the
|
|
488
|
+
* Then update the changedWidth and changedHeight based on the sizeFactor.
|
|
374
489
|
*/
|
|
375
490
|
updateOriginAndChangedWH(): void;
|
|
376
491
|
/**
|
|
@@ -379,7 +494,14 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
379
494
|
*/
|
|
380
495
|
setSyncsliceNum(): void;
|
|
381
496
|
appendLoadingbar(loadingbar: HTMLDivElement): void;
|
|
382
|
-
|
|
497
|
+
/**
|
|
498
|
+
* Clear all annotations on the currently active layer across its entire 3D volume.
|
|
499
|
+
* This resets all voxels globally for the active layer's `MaskVolume` (depth, width, height)
|
|
500
|
+
* and triggers the `onClearLayerVolume` event to sync the wiped volume to the backend.
|
|
501
|
+
* It also clears the undo/redo stack for the active layer ONLY.
|
|
502
|
+
* Other background layers are not impacted by this operation.
|
|
503
|
+
*/
|
|
504
|
+
clearActiveLayer(): void;
|
|
383
505
|
/**
|
|
384
506
|
* Reset the draw and display canvases layout after mouse pan.
|
|
385
507
|
* If no params in, then center the draw and display canvases.
|
|
@@ -391,6 +513,26 @@ export declare class NrrdTools extends DrawToolCore {
|
|
|
391
513
|
* Clear masks on drawingCanvas layers.
|
|
392
514
|
*/
|
|
393
515
|
resetLayerCanvas(): void;
|
|
516
|
+
/**
|
|
517
|
+
* Enter sphere mode.
|
|
518
|
+
*
|
|
519
|
+
* Clears all layer canvases and the master composite canvas so that
|
|
520
|
+
* only the sphere overlay is visible. Does NOT touch MaskVolume data.
|
|
521
|
+
* Also disables drag mode to prevent slice dragging conflicts.
|
|
522
|
+
*
|
|
523
|
+
* Called when sphere mode is toggled on (keyboard shortcut or GUI).
|
|
524
|
+
*/
|
|
525
|
+
enterSphereMode(): void;
|
|
526
|
+
/**
|
|
527
|
+
* Exit sphere mode.
|
|
528
|
+
*
|
|
529
|
+
* Clears sphere overlay, restores all layer MaskVolume data onto
|
|
530
|
+
* their canvases by temporarily lifting the sphere guard in
|
|
531
|
+
* reloadMasksFromVolume and calling it.
|
|
532
|
+
*
|
|
533
|
+
* Called when sphere mode is toggled off (keyboard shortcut or GUI).
|
|
534
|
+
*/
|
|
535
|
+
exitSphereMode(): void;
|
|
394
536
|
redrawMianPreOnDisplayCanvas(): void;
|
|
395
537
|
/**
|
|
396
538
|
* Resize the draw and display canvas size based on the input size factor number.
|
|
@@ -197,39 +197,6 @@ export declare class MaskVolume {
|
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
199
|
setSliceFromImageData(sliceIndex: number, imageData: ImageData, axis?: 'x' | 'y' | 'z', channel?: number): void;
|
|
200
|
-
/**
|
|
201
|
-
* Extract a 2D slice as raw RGBA ImageData (lossless round-trip).
|
|
202
|
-
*
|
|
203
|
-
* Requires the volume to have **≥ 4 channels** (ch0=R, ch1=G, ch2=B, ch3=A).
|
|
204
|
-
* Returns the exact pixel data that was stored via `setSliceFromImageData`,
|
|
205
|
-
* bypassing all render modes.
|
|
206
|
-
*
|
|
207
|
-
* @param sliceIndex Index along the specified axis.
|
|
208
|
-
* @param axis `'x'`, `'y'`, or `'z'` (default `'z'`).
|
|
209
|
-
* @returns ImageData with the stored RGBA values.
|
|
210
|
-
*
|
|
211
|
-
* @throws {RangeError} If sliceIndex is out of bounds.
|
|
212
|
-
* @throws {Error} If the volume has fewer than 4 channels.
|
|
213
|
-
*/
|
|
214
|
-
getSliceRawImageData(sliceIndex: number, axis?: 'x' | 'y' | 'z'): ImageData;
|
|
215
|
-
/**
|
|
216
|
-
* Write slice data into an existing ImageData buffer (zero-allocation).
|
|
217
|
-
*
|
|
218
|
-
* Same semantics as {@link getSliceRawImageData} but avoids creating a new
|
|
219
|
-
* ImageData object on every call. The caller is responsible for providing
|
|
220
|
-
* a buffer whose dimensions match the expected slice size.
|
|
221
|
-
*
|
|
222
|
-
* All pixels are fully overwritten — no clearing is needed beforehand.
|
|
223
|
-
*
|
|
224
|
-
* @param sliceIndex Index along the specified axis.
|
|
225
|
-
* @param axis `'x'`, `'y'`, or `'z'` (default `'z'`).
|
|
226
|
-
* @param target Pre-allocated ImageData to write into.
|
|
227
|
-
*
|
|
228
|
-
* @throws {Error} If the volume has fewer than 4 channels.
|
|
229
|
-
* @throws {RangeError} If sliceIndex is out of bounds.
|
|
230
|
-
* @throws {Error} If target dimensions don't match the slice.
|
|
231
|
-
*/
|
|
232
|
-
getSliceRawImageDataInto(sliceIndex: number, axis: "z" | "y" | "x" | undefined, target: ImageData): void;
|
|
233
200
|
/**
|
|
234
201
|
/**
|
|
235
202
|
* Store label data from canvas RGBA ImageData into a 1-channel volume.
|
|
@@ -350,7 +317,7 @@ export declare class MaskVolume {
|
|
|
350
317
|
*
|
|
351
318
|
* @example
|
|
352
319
|
* ```ts
|
|
353
|
-
* vol.
|
|
320
|
+
* vol.reset();
|
|
354
321
|
* vol.getVoxel(256, 256, 50); // 0
|
|
355
322
|
* ```
|
|
356
323
|
*/
|
|
@@ -40,7 +40,7 @@ export declare class UndoManager {
|
|
|
40
40
|
redo(): MaskDelta | undefined;
|
|
41
41
|
canUndo(): boolean;
|
|
42
42
|
canRedo(): boolean;
|
|
43
|
-
/** Clear undo and redo stacks for a specific layer (called on
|
|
43
|
+
/** Clear undo and redo stacks for a specific layer (called on clearActiveLayer). */
|
|
44
44
|
clearLayer(layer: string): void;
|
|
45
45
|
/** Clear all stacks for all layers (called on full dataset reload). */
|
|
46
46
|
clearAll(): void;
|
|
@@ -70,7 +70,5 @@
|
|
|
70
70
|
export type { Dimensions, RGBAColor, ChannelColorMap, SliceRenderOptions, LayerId, ChannelValue, } from './types';
|
|
71
71
|
export { RenderMode, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLORS, CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss, } from './types';
|
|
72
72
|
export { MaskVolume } from './MaskVolume';
|
|
73
|
-
export type { IPaintImage, IPaintImages } from './MigrationUtils';
|
|
74
|
-
export { convertIPaintImagesToVolume, convertVolumeToIPaintImages, } from './MigrationUtils';
|
|
75
73
|
export type { MaskDelta } from './UndoManager';
|
|
76
74
|
export { UndoManager } from './UndoManager';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GuiState — Grouped state management for GUI configuration.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the flat IGUIStates object with 4 semantic sub-groups:
|
|
5
|
+
* - mode: Tool mode flags (pencil/eraser/sphere)
|
|
6
|
+
* - drawing: Brush/pencil appearance and behavior
|
|
7
|
+
* - viewConfig: UI layout and interaction parameters
|
|
8
|
+
* - layerChannel: Active layer, channel, and visibility
|
|
9
|
+
*/
|
|
10
|
+
import type { IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState } from "./coreType";
|
|
11
|
+
export declare class GuiState {
|
|
12
|
+
readonly mode: IToolModeState;
|
|
13
|
+
readonly drawing: IDrawingConfig;
|
|
14
|
+
readonly viewConfig: IViewConfig;
|
|
15
|
+
readonly layerChannel: ILayerChannelState;
|
|
16
|
+
constructor(options?: {
|
|
17
|
+
defaultPaintCursor?: string;
|
|
18
|
+
defaultFillColor?: string;
|
|
19
|
+
defaultBrushColor?: string;
|
|
20
|
+
layers?: string[];
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NrrdState — Grouped state management for NRRD annotation data.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the flat INrrdStates object with 5 semantic sub-groups:
|
|
5
|
+
* - image: Read-mostly metadata set during NRRD loading
|
|
6
|
+
* - view: Runtime display/navigation state
|
|
7
|
+
* - interaction: Mouse/cursor tracking
|
|
8
|
+
* - sphere: SphereTool-specific data
|
|
9
|
+
* - flags: Internal operational flags
|
|
10
|
+
*
|
|
11
|
+
* Phase 4 of the State Management Refactor.
|
|
12
|
+
*/
|
|
13
|
+
import type { IImageMetadata, IViewState, IInteractionState, ISphereState, IInternalFlags } from "./coreType";
|
|
14
|
+
export declare class NrrdState {
|
|
15
|
+
readonly image: IImageMetadata;
|
|
16
|
+
readonly view: IViewState;
|
|
17
|
+
readonly interaction: IInteractionState;
|
|
18
|
+
readonly sphere: ISphereState;
|
|
19
|
+
readonly flags: IInternalFlags;
|
|
20
|
+
constructor(baseCanvasesSize?: number, layers?: string[]);
|
|
21
|
+
/** Set zoom factor with clamping [1, 8] */
|
|
22
|
+
setZoomFactor(factor: number): void;
|
|
23
|
+
/** Reset all sphere state to defaults */
|
|
24
|
+
resetSphereState(): void;
|
|
25
|
+
}
|