copper3d 2.2.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1056 -5
- package/dist/Scene/copperScene.d.ts +3 -0
- package/dist/Scene/copperScene.js +13 -0
- package/dist/Scene/copperScene.js.map +1 -1
- package/dist/Utils/segmentation/CommToolsData.d.ts +109 -6
- package/dist/Utils/segmentation/CommToolsData.js +314 -50
- package/dist/Utils/segmentation/CommToolsData.js.map +1 -1
- package/dist/Utils/segmentation/DragOperator.d.ts +13 -7
- package/dist/Utils/segmentation/DragOperator.js +51 -165
- package/dist/Utils/segmentation/DragOperator.js.map +1 -1
- package/dist/Utils/segmentation/DrawToolCore.d.ts +57 -76
- package/dist/Utils/segmentation/DrawToolCore.js +368 -878
- package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +277 -15
- package/dist/Utils/segmentation/NrrdTools.js +594 -232
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/core/MaskVolume.d.ts +477 -0
- package/dist/Utils/segmentation/core/MaskVolume.js +1238 -0
- package/dist/Utils/segmentation/core/MaskVolume.js.map +1 -0
- package/dist/Utils/segmentation/core/MigrationUtils.d.ts +97 -0
- package/dist/Utils/segmentation/core/MigrationUtils.js +163 -0
- package/dist/Utils/segmentation/core/MigrationUtils.js.map +1 -0
- package/dist/Utils/segmentation/core/UndoManager.d.ts +47 -0
- package/dist/Utils/segmentation/core/UndoManager.js +86 -0
- package/dist/Utils/segmentation/core/UndoManager.js.map +1 -0
- package/dist/Utils/segmentation/core/index.d.ts +76 -0
- package/dist/Utils/segmentation/core/index.js +75 -0
- package/dist/Utils/segmentation/core/index.js.map +1 -0
- package/dist/Utils/segmentation/core/types.d.ts +106 -0
- package/dist/Utils/segmentation/core/types.js +98 -0
- package/dist/Utils/segmentation/core/types.js.map +1 -0
- package/dist/Utils/segmentation/coreTools/coreType.d.ts +55 -36
- package/dist/Utils/segmentation/coreTools/coreType.js.map +1 -1
- package/dist/Utils/segmentation/coreTools/gui.d.ts +6 -16
- package/dist/Utils/segmentation/coreTools/gui.js +23 -27
- package/dist/Utils/segmentation/coreTools/gui.js.map +1 -1
- package/dist/Utils/segmentation/eventRouter/EventRouter.d.ts +144 -0
- package/dist/Utils/segmentation/eventRouter/EventRouter.js +369 -0
- package/dist/Utils/segmentation/eventRouter/EventRouter.js.map +1 -0
- package/dist/Utils/segmentation/eventRouter/index.d.ts +7 -0
- package/dist/Utils/segmentation/eventRouter/index.js +7 -0
- package/dist/Utils/segmentation/eventRouter/index.js.map +1 -0
- package/dist/Utils/segmentation/eventRouter/types.d.ts +70 -0
- package/dist/Utils/segmentation/eventRouter/types.js +7 -0
- package/dist/Utils/segmentation/eventRouter/types.js.map +1 -0
- package/dist/Utils/segmentation/tools/BaseTool.d.ts +25 -0
- package/dist/Utils/segmentation/tools/BaseTool.js +18 -0
- package/dist/Utils/segmentation/tools/BaseTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/ContrastTool.d.ts +26 -0
- package/dist/Utils/segmentation/tools/ContrastTool.js +118 -0
- package/dist/Utils/segmentation/tools/ContrastTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/CrosshairTool.d.ts +30 -0
- package/dist/Utils/segmentation/tools/CrosshairTool.js +157 -0
- package/dist/Utils/segmentation/tools/CrosshairTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/DragSliceTool.d.ts +44 -0
- package/dist/Utils/segmentation/tools/DragSliceTool.js +170 -0
- package/dist/Utils/segmentation/tools/DragSliceTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/EraserTool.d.ts +16 -0
- package/dist/Utils/segmentation/tools/EraserTool.js +92 -0
- package/dist/Utils/segmentation/tools/EraserTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/ImageStoreHelper.d.ts +65 -0
- package/dist/Utils/segmentation/tools/ImageStoreHelper.js +174 -0
- package/dist/Utils/segmentation/tools/ImageStoreHelper.js.map +1 -0
- package/dist/Utils/segmentation/tools/SphereTool.d.ts +38 -0
- package/dist/Utils/segmentation/tools/SphereTool.js +193 -0
- package/dist/Utils/segmentation/tools/SphereTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/ZoomTool.d.ts +20 -0
- package/dist/Utils/segmentation/tools/ZoomTool.js +59 -0
- package/dist/Utils/segmentation/tools/ZoomTool.js.map +1 -0
- package/dist/Utils/segmentation/tools/index.d.ts +22 -0
- package/dist/Utils/segmentation/tools/index.js +23 -0
- package/dist/Utils/segmentation/tools/index.js.map +1 -0
- package/dist/bundle.esm.js +4740 -1979
- package/dist/bundle.umd.js +4743 -1978
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/types/Renderer/copperRenderer.d.ts +1 -1
- package/dist/types/Renderer/copperRendererOnDemond.d.ts +1 -1
- package/dist/types/Scene/copperScene.d.ts +3 -0
- package/dist/types/Utils/segmentation/CommToolsData.d.ts +109 -6
- package/dist/types/Utils/segmentation/DragOperator.d.ts +13 -7
- package/dist/types/Utils/segmentation/DrawToolCore.d.ts +57 -76
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +277 -15
- package/dist/types/Utils/segmentation/core/MaskVolume.d.ts +477 -0
- package/dist/types/Utils/segmentation/core/MigrationUtils.d.ts +97 -0
- package/dist/types/Utils/segmentation/core/UndoManager.d.ts +47 -0
- package/dist/types/Utils/segmentation/core/index.d.ts +76 -0
- package/dist/types/Utils/segmentation/core/types.d.ts +106 -0
- package/dist/types/Utils/segmentation/coreTools/coreType.d.ts +55 -36
- package/dist/types/Utils/segmentation/coreTools/gui.d.ts +6 -16
- package/dist/types/Utils/segmentation/eventRouter/EventRouter.d.ts +144 -0
- package/dist/types/Utils/segmentation/eventRouter/index.d.ts +7 -0
- package/dist/types/Utils/segmentation/eventRouter/types.d.ts +70 -0
- package/dist/types/Utils/segmentation/tools/BaseTool.d.ts +25 -0
- package/dist/types/Utils/segmentation/tools/ContrastTool.d.ts +26 -0
- package/dist/types/Utils/segmentation/tools/CrosshairTool.d.ts +30 -0
- package/dist/types/Utils/segmentation/tools/DragSliceTool.d.ts +44 -0
- package/dist/types/Utils/segmentation/tools/EraserTool.d.ts +16 -0
- package/dist/types/Utils/segmentation/tools/ImageStoreHelper.d.ts +65 -0
- package/dist/types/Utils/segmentation/tools/SphereTool.d.ts +38 -0
- package/dist/types/Utils/segmentation/tools/ZoomTool.d.ts +20 -0
- package/dist/types/Utils/segmentation/tools/index.d.ts +22 -0
- package/dist/types/index.d.ts +5 -3
- package/dist/types/types/types.d.ts +3 -3
- package/dist/types/types.d.ts +3 -3
- package/package.json +1 -1
- package/dist/Utils/segmentation/coreTools/archive.d.ts +0 -1
- package/dist/Utils/segmentation/coreTools/archive.js +0 -23
- package/dist/Utils/segmentation/coreTools/archive.js.map +0 -1
- package/dist/types/Utils/segmentation/coreTools/archive.d.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ 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
20
|
import { IPaintImage, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates } from "./Utils/segmentation/coreTools/coreType";
|
|
21
|
+
import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
|
|
22
|
+
import type { LayerId, ChannelValue } from "./Utils/segmentation/core/index";
|
|
21
23
|
import "./css/style.css";
|
|
22
|
-
export declare const REVISION = "
|
|
23
|
-
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, };
|
|
24
|
-
export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates };
|
|
24
|
+
export declare const REVISION = "v3.0.0-beta";
|
|
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
|
+
export type { positionType, screenPosType, optsType, nrrdMeshesType, nrrdSliceType, SensorDecodedValue_kiwrious, SensorReadResult_kiwrious, HeartRateResult_kiwrious, loadingBarType, IPaintImage, exportPaintImageType, IOptVTKLoader, ICommXYZ, IGUIStates, IGuiParameterSettings, INrrdStates, LayerId, ChannelValue, };
|
package/dist/index.js
CHANGED
|
@@ -14,11 +14,13 @@ import { createTexture2D_NRRD } from "./Utils/texture2d";
|
|
|
14
14
|
import { configKiwriousHeart } from "./Utils/kiwrious/configKiwrious";
|
|
15
15
|
import kiwrious from "./Utils/kiwrious/configKiwrious";
|
|
16
16
|
import { NrrdTools } from "./Utils/segmentation/NrrdTools";
|
|
17
|
+
// Phase 7: Segmentation Module - Unified exports
|
|
17
18
|
import { Copper3dTrackballControls } from "./Controls/Copper3dTrackballControls";
|
|
18
19
|
import { MeshNodeTool } from "./Utils/MeshNodeTool";
|
|
19
20
|
import { removeGuiFolderChilden } from "./Utils/segmentation/coreTools/gui";
|
|
21
|
+
import { CHANNEL_COLORS, CHANNEL_HEX_COLORS, rgbaToHex, rgbaToCss } from "./Utils/segmentation/core/index";
|
|
20
22
|
import "./css/style.css";
|
|
21
|
-
export const REVISION = "
|
|
23
|
+
export const REVISION = "v3.0.0-beta";
|
|
22
24
|
console.log(`%cCopper3D Visualisation %cBeta:${REVISION}`, "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
|
|
23
|
-
export { copperRenderer, copperRendererOnDemond, copperMSceneRenderer, setHDRFilePath, addLabelToScene, convert3DPostoScreenPos, convertScreenPosto3DPos, addBoxHelper, fullScreenListenner, configKiwriousHeart, copperScene, copperSceneOnDemond, copperMScene, CameraViewPoint, kiwrious, NrrdTools, loading, Copper3dTrackballControls, createTexture2D_NRRD, MeshNodeTool, throttle, removeGuiFolderChilden, };
|
|
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, };
|
|
24
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;
|
|
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;AAc5E,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"}
|
|
@@ -9,7 +9,7 @@ export declare class copperRenderer extends baseRenderer {
|
|
|
9
9
|
private interval;
|
|
10
10
|
preRenderCallbackFunctions: Array<Function>;
|
|
11
11
|
constructor(container: HTMLDivElement, options?: ICopperRenderOpt);
|
|
12
|
-
getSceneByName(name: string): copperScene | import("../Scene/baseScene").baseScene | import("
|
|
12
|
+
getSceneByName(name: string): copperScene | import("../Scene/baseScene").baseScene | import("..").copperMScene;
|
|
13
13
|
setFPS(fps: number): void;
|
|
14
14
|
setCurrentScene(sceneIn: copperScene): void;
|
|
15
15
|
createScene(name: string): copperScene | undefined;
|
|
@@ -4,7 +4,7 @@ import { copperSceneOnDemond } from "../Scene/copperSceneOnDemond";
|
|
|
4
4
|
export declare class copperRendererOnDemond extends baseRenderer {
|
|
5
5
|
private sceneMap;
|
|
6
6
|
constructor(container: HTMLDivElement, options?: ICopperRenderOpt);
|
|
7
|
-
getSceneByName(name: string): import("
|
|
7
|
+
getSceneByName(name: string): import("..").copperScene | import("../Scene/baseScene").baseScene | import("..").copperMScene;
|
|
8
8
|
setCurrentScene(sceneIn: copperSceneOnDemond): void;
|
|
9
9
|
createScene(name: string): copperSceneOnDemond | undefined;
|
|
10
10
|
animate: () => void;
|
|
@@ -16,6 +16,9 @@ export declare class copperScene extends baseScene {
|
|
|
16
16
|
private texture2dMesh;
|
|
17
17
|
constructor(container: HTMLDivElement, renderer: THREE.WebGLRenderer, opt?: ICopperSceneOpts);
|
|
18
18
|
loadGltf(url: string, callback?: (content: THREE.Group) => void): void;
|
|
19
|
+
loadPureGLB(url: string, callback?: (mesh: THREE.Group) => void, opts?: {
|
|
20
|
+
color: string;
|
|
21
|
+
}): void;
|
|
19
22
|
loadVtk(url: string): void;
|
|
20
23
|
loadVtks(models: Array<vtkModels>): void;
|
|
21
24
|
texture2d(url: string): void;
|
|
@@ -1,12 +1,60 @@
|
|
|
1
|
-
import { IProtected, IGUIStates, INrrdStates, ICursorPage, IPaintImages, IConvertObjType } from "./coreTools/coreType";
|
|
1
|
+
import { IProtected, IGUIStates, INrrdStates, ICursorPage, IPaintImage, IPaintImages, IConvertObjType, INewMaskData, IKeyBoardSettings } from "./coreTools/coreType";
|
|
2
|
+
import { MaskVolume } from "./core/index";
|
|
2
3
|
export declare class CommToolsData {
|
|
3
4
|
baseCanvasesSize: number;
|
|
5
|
+
private _reusableSliceBuffer;
|
|
6
|
+
private _reusableBufferWidth;
|
|
7
|
+
private _reusableBufferHeight;
|
|
8
|
+
/** Whether the keyboard-config dialog is open (suppresses all shortcuts). */
|
|
9
|
+
protected _configKeyBoard: boolean;
|
|
10
|
+
/** Active keyboard shortcut bindings. */
|
|
11
|
+
protected _keyboardSettings: IKeyBoardSettings;
|
|
4
12
|
nrrd_states: INrrdStates;
|
|
5
13
|
cursorPage: ICursorPage;
|
|
6
14
|
gui_states: IGUIStates;
|
|
7
15
|
protectedData: IProtected;
|
|
8
|
-
constructor(container: HTMLElement, mainAreaContainer: HTMLElement
|
|
9
|
-
|
|
16
|
+
constructor(container: HTMLElement, mainAreaContainer: HTMLElement, options?: {
|
|
17
|
+
layers?: string[];
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Get MaskVolume for a specific layer
|
|
21
|
+
*
|
|
22
|
+
* @param layer - Layer name: "layer1", "layer2", or "layer3"
|
|
23
|
+
* @returns MaskVolume instance for the specified layer
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const volume = this.getVolumeForLayer("layer1");
|
|
28
|
+
* volume.setVoxel(x, y, z, 255);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
getVolumeForLayer(layer: string): MaskVolume;
|
|
32
|
+
/**
|
|
33
|
+
* Get MaskVolume for the currently active layer
|
|
34
|
+
*
|
|
35
|
+
* @returns MaskVolume instance for the current layer
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const volume = this.getCurrentVolume();
|
|
40
|
+
* const slice = volume.getSliceImageData(50, 'z');
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
getCurrentVolume(): MaskVolume;
|
|
44
|
+
/**
|
|
45
|
+
* Get all three MaskVolume instances
|
|
46
|
+
*
|
|
47
|
+
* @returns Object containing all three layer volumes
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const { layer1, layer2, layer3 } = this.getAllVolumes();
|
|
52
|
+
* layer1.clear();
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
getAllVolumes(): INewMaskData;
|
|
56
|
+
private generateSystemCanvases;
|
|
57
|
+
private generateLayerTargets;
|
|
10
58
|
/**
|
|
11
59
|
* Rewrite this {clearPaint} function under DrawToolCore
|
|
12
60
|
*/
|
|
@@ -15,6 +63,10 @@ export declare class CommToolsData {
|
|
|
15
63
|
* Rewrite this {undoLastPainting} function under DrawToolCore
|
|
16
64
|
*/
|
|
17
65
|
undoLastPainting(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Rewrite this {redoLastPainting} function under DrawToolCore
|
|
68
|
+
*/
|
|
69
|
+
redoLastPainting(): void;
|
|
18
70
|
/**
|
|
19
71
|
* Rewrite this {clearStoreImages} function under NrrdTools
|
|
20
72
|
*/
|
|
@@ -66,10 +118,61 @@ export declare class CommToolsData {
|
|
|
66
118
|
/**
|
|
67
119
|
* Get a painted mask image (IPaintImage) based on current axis and input slice index.
|
|
68
120
|
*
|
|
121
|
+
* Phase 3: Reads directly from MaskVolume (no caching needed — reads are fast).
|
|
122
|
+
*
|
|
69
123
|
* @param axis "x" | "y" | "z"
|
|
70
124
|
* @param sliceIndex number
|
|
71
|
-
* @
|
|
72
|
-
|
|
125
|
+
* @returns IPaintImage with the mask for the given slice, or undefined if not found
|
|
126
|
+
*/
|
|
127
|
+
filterDrawedImage(axis: "x" | "y" | "z", sliceIndex: number): IPaintImage | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Get or create a reusable ImageData buffer for the given axis.
|
|
130
|
+
*
|
|
131
|
+
* Reuses the same buffer across multiple slice renders to avoid
|
|
132
|
+
* allocating a new ImageData per layer per slice switch.
|
|
133
|
+
* The buffer is only reallocated when slice dimensions change (axis switch).
|
|
134
|
+
*
|
|
135
|
+
* @param axis - Axis: "x", "y", or "z"
|
|
136
|
+
* @returns Reusable ImageData buffer with correct dimensions
|
|
137
|
+
*/
|
|
138
|
+
getOrCreateSliceBuffer(axis: "x" | "y" | "z"): ImageData | null;
|
|
139
|
+
/**
|
|
140
|
+
* Render a layer's slice into a reusable buffer and draw to the target canvas.
|
|
141
|
+
*
|
|
142
|
+
* Uses MaskVolume.getSliceRawImageDataInto() for zero-allocation rendering.
|
|
143
|
+
* The caller should obtain the buffer via getOrCreateSliceBuffer() and reuse
|
|
144
|
+
* it across multiple layer renders.
|
|
145
|
+
*
|
|
146
|
+
* @param layer - Layer name: "layer1", "layer2", or "layer3"
|
|
147
|
+
* @param axis - Axis: "x", "y", or "z"
|
|
148
|
+
* @param sliceIndex - Slice index
|
|
149
|
+
* @param buffer - Reusable ImageData buffer (from getOrCreateSliceBuffer)
|
|
150
|
+
* @param targetCtx - Canvas context to draw the result onto
|
|
151
|
+
* @param scaledWidth - Target display width
|
|
152
|
+
* @param scaledHeight - Target display height
|
|
153
|
+
*/
|
|
154
|
+
renderSliceToCanvas(layer: string, axis: "x" | "y" | "z", sliceIndex: number, buffer: ImageData, targetCtx: CanvasRenderingContext2D, scaledWidth: number, scaledHeight: number): void;
|
|
155
|
+
/**
|
|
156
|
+
* Invalidate the reusable buffer (e.g. when switching datasets).
|
|
157
|
+
* The buffer will be lazily recreated on next use.
|
|
158
|
+
*/
|
|
159
|
+
invalidateSliceBuffer(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Apply the same flip transform used by flipDisplayImageByAxis() to any
|
|
162
|
+
* canvas context. This ensures mask overlays align with the flipped CT image.
|
|
163
|
+
*
|
|
164
|
+
* The flip is its own inverse (applying twice = identity), so it works for
|
|
165
|
+
* both directions: volume→display (rendering) and display→volume (storing).
|
|
166
|
+
*
|
|
167
|
+
* @param ctx Target 2D context (must be wrapped in save/restore by caller).
|
|
168
|
+
* @param width Canvas width in pixels.
|
|
169
|
+
* @param height Canvas height in pixels.
|
|
170
|
+
* @param axis Current viewing axis.
|
|
171
|
+
*/
|
|
172
|
+
applyMaskFlipForAxis(ctx: CanvasRenderingContext2D, width: number, height: number, axis: "x" | "y" | "z"): void;
|
|
173
|
+
/**
|
|
174
|
+
* Composite all layer canvases to the master display canvas.
|
|
175
|
+
* Only draws layers whose visibility is enabled.
|
|
73
176
|
*/
|
|
74
|
-
|
|
177
|
+
compositeAllLayers(): void;
|
|
75
178
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IDragOpts, IDrawingEvents, IProtected, IGUIStates, INrrdStates
|
|
1
|
+
import { IDragOpts, IDrawingEvents, IProtected, IGUIStates, INrrdStates } from "./coreTools/coreType";
|
|
2
|
+
import type { EventRouter } from "./eventRouter";
|
|
2
3
|
export declare class DragOperator {
|
|
3
4
|
container: HTMLElement;
|
|
4
5
|
private dragPrameters;
|
|
@@ -8,20 +9,25 @@ export declare class DragOperator {
|
|
|
8
9
|
private nrrd_states;
|
|
9
10
|
private gui_states;
|
|
10
11
|
private protectedData;
|
|
11
|
-
private
|
|
12
|
+
private dragSliceTool;
|
|
12
13
|
private setSyncsliceNum;
|
|
13
14
|
private setIsDrawFalse;
|
|
14
15
|
private flipDisplayImageByAxis;
|
|
15
16
|
private setEmptyCanvasSize;
|
|
16
|
-
private
|
|
17
|
-
|
|
17
|
+
private getOrCreateSliceBuffer;
|
|
18
|
+
private renderSliceToCanvas;
|
|
19
|
+
private eventRouter;
|
|
20
|
+
constructor(container: HTMLElement, nrrd_sates: INrrdStates, gui_states: IGUIStates, 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);
|
|
18
21
|
private init;
|
|
19
22
|
setShowDragNumberDiv(sliceIndexContainer: HTMLDivElement): void;
|
|
23
|
+
/**
|
|
24
|
+
* Set the EventRouter reference for centralized event handling.
|
|
25
|
+
* Called by NrrdTools/DrawToolCore after EventRouter is initialized.
|
|
26
|
+
* Subscribes to mode changes to control drag mode.
|
|
27
|
+
*/
|
|
28
|
+
setEventRouter(eventRouter: EventRouter): void;
|
|
20
29
|
drag(opts?: IDragOpts): void;
|
|
21
30
|
updateIndex(move: number): void;
|
|
22
|
-
private drawDragSlice;
|
|
23
|
-
private drawMaskToLabelCtx;
|
|
24
|
-
private cleanCanvases;
|
|
25
31
|
updateShowNumDiv(contrastNum: number): void;
|
|
26
32
|
updateCurrentContrastSlice(): any;
|
|
27
33
|
configDragMode: () => void;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { IDrawingEvents, IContrastEvents, IDrawOpts,
|
|
1
|
+
import { IConvertObjType, IDrawingEvents, IContrastEvents, IDrawOpts, IPaintImages } from "./coreTools/coreType";
|
|
2
2
|
import { CommToolsData } from "./CommToolsData";
|
|
3
|
+
import { EventRouter } from "./eventRouter";
|
|
4
|
+
import { SphereTool } from "./tools/SphereTool";
|
|
5
|
+
import { CrosshairTool } from "./tools/CrosshairTool";
|
|
6
|
+
import { ContrastTool } from "./tools/ContrastTool";
|
|
7
|
+
import { ZoomTool } from "./tools/ZoomTool";
|
|
8
|
+
import { EraserTool } from "./tools/EraserTool";
|
|
9
|
+
import { ImageStoreHelper } from "./tools/ImageStoreHelper";
|
|
10
|
+
import { UndoManager } from "./core";
|
|
3
11
|
export declare class DrawToolCore extends CommToolsData {
|
|
4
12
|
container: HTMLElement;
|
|
5
13
|
mainAreaContainer: HTMLDivElement;
|
|
@@ -7,9 +15,23 @@ export declare class DrawToolCore extends CommToolsData {
|
|
|
7
15
|
contrastEventPrameters: IContrastEvents;
|
|
8
16
|
eraserUrls: string[];
|
|
9
17
|
pencilUrls: string[];
|
|
10
|
-
|
|
18
|
+
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
|
+
protected eventRouter: EventRouter | null;
|
|
24
|
+
protected sphereTool: SphereTool;
|
|
25
|
+
protected crosshairTool: CrosshairTool;
|
|
26
|
+
protected contrastTool: ContrastTool;
|
|
27
|
+
protected zoomTool: ZoomTool;
|
|
28
|
+
protected eraserTool: EraserTool;
|
|
29
|
+
protected imageStoreHelper: ImageStoreHelper;
|
|
11
30
|
start: () => void;
|
|
12
|
-
constructor(container: HTMLElement
|
|
31
|
+
constructor(container: HTMLElement, options?: {
|
|
32
|
+
layers?: string[];
|
|
33
|
+
});
|
|
34
|
+
private initTools;
|
|
13
35
|
private initDrawToolCore;
|
|
14
36
|
setEraserUrls(urls: string[]): void;
|
|
15
37
|
setPencilIconUrls(urls: string[]): void;
|
|
@@ -30,96 +52,55 @@ export declare class DrawToolCore extends CommToolsData {
|
|
|
30
52
|
configMouseSliceWheel(): void;
|
|
31
53
|
private enableCrosshair;
|
|
32
54
|
drawImageOnEmptyImage(canvas: HTMLCanvasElement): void;
|
|
33
|
-
/****************************Sphere
|
|
34
|
-
private getSpherePosition;
|
|
55
|
+
/****************************Sphere functions (delegated to SphereTool)****************************************************/
|
|
35
56
|
drawCalculatorSphereOnEachViews(axis: "x" | "y" | "z"): void;
|
|
36
|
-
/****************************Sphere functions****************************************************/
|
|
37
|
-
private storeSphereImages;
|
|
38
57
|
private drawSphereOnEachViews;
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @param ctx draw sphere canvas ctx
|
|
42
|
-
* @param x width must be match the origin size, size factor 1, ignore the size factor
|
|
43
|
-
* @param y height must be match the origin size, size factor 1, ignore the size factor
|
|
44
|
-
* @param radius radius must be match the origin size, size factor 1, ignore the size factor
|
|
45
|
-
* @param color sphere color
|
|
46
|
-
*/
|
|
47
|
-
private drawSphereCore;
|
|
48
|
-
private setSphereCanvasSize;
|
|
49
58
|
private configMouseSphereWheel;
|
|
50
59
|
drawCalculatorSphere(radius: number): void;
|
|
51
60
|
drawSphere(mouseX: number, mouseY: number, radius: number): void;
|
|
52
|
-
private clearSphereCanvas;
|
|
53
61
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
* Then as for the crosshair (Cursor Inspector), we also need to convert the cursor point (x, y, z) to other views' (x, y, z).
|
|
60
|
-
*
|
|
61
|
-
* @param from "x" | "y" | "z", current view axis, "x: sagittle, y: coronal, z: axial".
|
|
62
|
-
* @param to "x" | "y" | "z", target view axis (where you want jump to), "x: sagittle, y: coronal, z: axial".
|
|
63
|
-
* @param cursorNumX number, cursor point x on current axis's slice. (pixel distance)
|
|
64
|
-
* @param cursorNumY number, cursor point y on current axis's slice. (pixel distance)
|
|
65
|
-
* @param currentSliceIndex number, current axis's slice's index/depth. (mm distance)
|
|
66
|
-
* @returns
|
|
67
|
-
*/
|
|
68
|
-
convertCursorPoint(from: "x" | "y" | "z", to: "x" | "y" | "z", cursorNumX: number, cursorNumY: number, currentSliceIndex: number): {
|
|
69
|
-
currentIndex: number;
|
|
70
|
-
oldIndex: number;
|
|
71
|
-
convertCursorNumX: number;
|
|
72
|
-
convertCursorNumY: number;
|
|
73
|
-
} | undefined;
|
|
62
|
+
* Convert cursor point between axis views.
|
|
63
|
+
* Delegated to CrosshairTool.
|
|
64
|
+
*/
|
|
65
|
+
convertCursorPoint(from: "x" | "y" | "z", to: "x" | "y" | "z", cursorNumX: number, cursorNumY: number, currentSliceIndex: number): IConvertObjType | undefined;
|
|
74
66
|
private setUpSphereOrigins;
|
|
75
|
-
/****************************
|
|
76
|
-
|
|
77
|
-
/**************************** Undo
|
|
78
|
-
private getCurrentUndo;
|
|
67
|
+
/****************************layer div controls****************************************************/
|
|
68
|
+
getRestLayer(): string[];
|
|
69
|
+
/**************************** Undo/Redo functions (Phase 6 — Delta-based) ****************************/
|
|
79
70
|
/**
|
|
80
|
-
* Clear mask on current slice canvas
|
|
71
|
+
* Clear mask on current slice canvas.
|
|
72
|
+
*
|
|
73
|
+
* Phase 2: Clears the MaskVolume slice for all three layers,
|
|
74
|
+
* re-stores, and notifies external via getMask callback with clearFlag=true.
|
|
75
|
+
* Phase 6: Also records a MaskDelta for undo support.
|
|
81
76
|
*/
|
|
82
77
|
clearPaint(): void;
|
|
83
|
-
undoLastPainting(): void;
|
|
84
|
-
/****************************Store images****************************************************/
|
|
85
|
-
storeImageToAxis(index: number, paintedImages: IPaintImages, imageData: ImageData, axis?: "x" | "y" | "z"): void;
|
|
86
|
-
storeAllImages(index: number, label: string): void;
|
|
87
|
-
storeImageToLabel(index: number, canvas: HTMLCanvasElement, paintedImages: IPaintImages): ImageData;
|
|
88
|
-
storeEachLayerImage(index: number, label: string): void;
|
|
89
|
-
sliceArrayH(arr: Uint8ClampedArray, row: number, col: number): Uint8ClampedArray[];
|
|
90
|
-
sliceArrayV(arr: Uint8ClampedArray, row: number, col: number): number[][];
|
|
91
78
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* @param ratio : the target slice image's width/height ratio of its dimention length
|
|
96
|
-
* @param markedArr : current painted image's vertical 2d Array
|
|
97
|
-
* @param targetWidth : the target image width
|
|
98
|
-
* @param convertIndex : Mapping current image's index to target slice image's width/height pixel start point
|
|
79
|
+
* Undo the last drawing operation on the active layer.
|
|
80
|
+
* Restores the MaskVolume slice to its pre-draw state, re-renders
|
|
81
|
+
* the canvas, and notifies the backend.
|
|
99
82
|
*/
|
|
100
|
-
|
|
83
|
+
undoLastPainting(): void;
|
|
101
84
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @param ratio : the target slice image's width/height ratio of its dimention length
|
|
106
|
-
* @param markedArr : current painted image's horizontal 2d Array
|
|
107
|
-
* @param targetWidth : the target image width
|
|
108
|
-
* @param convertIndex : Mapping current image's index to target slice image's width/height pixel start point
|
|
85
|
+
* Redo the last undone operation on the active layer.
|
|
86
|
+
* Reapplies the MaskVolume slice to its post-draw state, re-renders
|
|
87
|
+
* the canvas, and notifies the backend.
|
|
109
88
|
*/
|
|
110
|
-
|
|
111
|
-
/****************************** Utils for store image and itksnap core **************************************/
|
|
112
|
-
checkSharedPlaceSlice(width: number, height: number, imageData: ImageData): Uint8ClampedArray;
|
|
113
|
-
replaceArray(mainArr: number[] | Uint8ClampedArray, replaceArr: number[] | Uint8ClampedArray): void;
|
|
114
|
-
findSliceInSharedPlace(): ImageData[];
|
|
115
|
-
/******************************** Utils gui related functions ***************************************/
|
|
89
|
+
redoLastPainting(): void;
|
|
116
90
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
91
|
+
* Re-render a layer canvas from MaskVolume and composite to master.
|
|
92
|
+
* Called after writing oldSlice/newSlice back to the volume during undo/redo.
|
|
119
93
|
*/
|
|
94
|
+
private applyUndoRedoToCanvas;
|
|
95
|
+
/****************************Store images (delegated to ImageStoreHelper)****************************************************/
|
|
96
|
+
storeImageToAxis(index: number, paintedImages: IPaintImages, imageData: ImageData, axis?: "x" | "y" | "z"): void;
|
|
97
|
+
storeAllImages(index: number, layer: string): void;
|
|
98
|
+
storeImageToLayer(index: number, canvas: HTMLCanvasElement, paintedImages: IPaintImages): ImageData;
|
|
99
|
+
storeEachLayerImage(index: number, layer: string): void;
|
|
100
|
+
/******************************** Utils gui related functions (delegated to ContrastTool) ***************************************/
|
|
120
101
|
setupConrastEvents(callback: (step: number, towards: "horizental" | "vertical") => void): void;
|
|
121
102
|
configContrastDragMode: () => void;
|
|
122
103
|
removeContrastDragMode: () => void;
|
|
123
|
-
updateSlicesContrast(value: number, flag: string)
|
|
124
|
-
repraintCurrentContrastSlice()
|
|
104
|
+
updateSlicesContrast: (value: number, flag: string) => void;
|
|
105
|
+
repraintCurrentContrastSlice: () => void;
|
|
125
106
|
}
|