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
|
@@ -37,28 +37,28 @@ export var RenderMode;
|
|
|
37
37
|
*/
|
|
38
38
|
export const MASK_CHANNEL_COLORS = {
|
|
39
39
|
0: { r: 0, g: 0, b: 0, a: 0 },
|
|
40
|
-
1: { r:
|
|
41
|
-
2: { r:
|
|
42
|
-
3: { r:
|
|
43
|
-
4: { r:
|
|
44
|
-
5: { r:
|
|
45
|
-
6: { r:
|
|
46
|
-
7: { r:
|
|
47
|
-
8: { r:
|
|
40
|
+
1: { r: 16, g: 185, b: 129, a: 255 },
|
|
41
|
+
2: { r: 244, g: 63, b: 94, a: 255 },
|
|
42
|
+
3: { r: 59, g: 130, b: 246, a: 255 },
|
|
43
|
+
4: { r: 251, g: 191, b: 36, a: 255 },
|
|
44
|
+
5: { r: 217, g: 70, b: 239, a: 255 },
|
|
45
|
+
6: { r: 6, g: 182, b: 212, a: 255 },
|
|
46
|
+
7: { r: 249, g: 115, b: 22, a: 255 },
|
|
47
|
+
8: { r: 139, g: 92, b: 246, a: 255 }, // Violet / Purple — Extended
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
50
|
* CSS color strings for the default channel palette (for reference / UI).
|
|
51
51
|
*/
|
|
52
52
|
export const MASK_CHANNEL_CSS_COLORS = {
|
|
53
53
|
0: 'rgba(0,0,0,0)',
|
|
54
|
-
1: 'rgba(
|
|
55
|
-
2: 'rgba(
|
|
56
|
-
3: 'rgba(
|
|
57
|
-
4: 'rgba(
|
|
58
|
-
5: 'rgba(
|
|
59
|
-
6: 'rgba(
|
|
60
|
-
7: 'rgba(
|
|
61
|
-
8: 'rgba(
|
|
54
|
+
1: 'rgba(16,185,129,1)',
|
|
55
|
+
2: 'rgba(244,63,94,1)',
|
|
56
|
+
3: 'rgba(59,130,246,1)',
|
|
57
|
+
4: 'rgba(251,191,36,1)',
|
|
58
|
+
5: 'rgba(217,70,239,1)',
|
|
59
|
+
6: 'rgba(6,182,212,1)',
|
|
60
|
+
7: 'rgba(249,115,22,1)',
|
|
61
|
+
8: 'rgba(139,92,246,1)', // Violet
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
64
|
* Convenience alias for MASK_CHANNEL_CSS_COLORS.
|
|
@@ -70,14 +70,14 @@ export const CHANNEL_COLORS = MASK_CHANNEL_CSS_COLORS;
|
|
|
70
70
|
*/
|
|
71
71
|
export const CHANNEL_HEX_COLORS = {
|
|
72
72
|
0: '#000000',
|
|
73
|
-
1: '#
|
|
74
|
-
2: '#
|
|
75
|
-
3: '#
|
|
76
|
-
4: '#
|
|
77
|
-
5: '#
|
|
78
|
-
6: '#
|
|
79
|
-
7: '#
|
|
80
|
-
8: '#
|
|
73
|
+
1: '#10b981',
|
|
74
|
+
2: '#f43f5e',
|
|
75
|
+
3: '#3b82f6',
|
|
76
|
+
4: '#fbbf24',
|
|
77
|
+
5: '#d946ef',
|
|
78
|
+
6: '#06b6d4',
|
|
79
|
+
7: '#f97316',
|
|
80
|
+
8: '#8b5cf6', // Violet
|
|
81
81
|
};
|
|
82
82
|
// ── Color Conversion Utilities ──────────────────────────────────────────
|
|
83
83
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiCH;;GAEG;AACH,MAAM,CAAN,IAAY,UAYX;AAZD,WAAY,UAAU;IACpB,uDAAuD;IACvD,qCAAuB,CAAA;IAEvB,4CAA4C;IAC5C,+CAAiC,CAAA;IAEjC,wEAAwE;IACxE,6CAA+B,CAAA;IAE/B,uCAAuC;IACvC,iCAAmB,CAAA;AACrB,CAAC,EAZW,UAAU,KAAV,UAAU,QAYrB;AAsBD,2EAA2E;AAE3E;;;;;;;;;;;;;;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AAM,UAAU,SAAS,CAAC,KAAgB;IACxC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACxC,OAAO,QAAQ,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAChF,CAAC"}
|
|
@@ -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,48 @@
|
|
|
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
|
+
export class GuiState {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
const opts = options !== null && options !== void 0 ? options : {};
|
|
14
|
+
const layers = (_a = opts.layers) !== null && _a !== void 0 ? _a : ["layer1", "layer2", "layer3"];
|
|
15
|
+
this.mode = {
|
|
16
|
+
pencil: true,
|
|
17
|
+
eraser: false,
|
|
18
|
+
sphere: false,
|
|
19
|
+
activeSphereType: "tumour",
|
|
20
|
+
};
|
|
21
|
+
this.drawing = {
|
|
22
|
+
globalAlpha: 0.6,
|
|
23
|
+
lineWidth: 2,
|
|
24
|
+
color: "#f50a33",
|
|
25
|
+
fillColor: (_b = opts.defaultFillColor) !== null && _b !== void 0 ? _b : "#f50a33",
|
|
26
|
+
brushColor: (_c = opts.defaultBrushColor) !== null && _c !== void 0 ? _c : "#f50a33",
|
|
27
|
+
brushAndEraserSize: 10,
|
|
28
|
+
};
|
|
29
|
+
this.viewConfig = {
|
|
30
|
+
mainAreaSize: 3,
|
|
31
|
+
dragSensitivity: 75,
|
|
32
|
+
cursor: "dot",
|
|
33
|
+
defaultPaintCursor: (_d = opts.defaultPaintCursor) !== null && _d !== void 0 ? _d : "",
|
|
34
|
+
max_sensitive: 100,
|
|
35
|
+
readyToUpdate: true,
|
|
36
|
+
};
|
|
37
|
+
this.layerChannel = {
|
|
38
|
+
layer: "layer1",
|
|
39
|
+
activeChannel: 1,
|
|
40
|
+
layerVisibility: Object.fromEntries(layers.map((l) => [l, true])),
|
|
41
|
+
channelVisibility: Object.fromEntries(layers.map((l) => [
|
|
42
|
+
l,
|
|
43
|
+
{ 1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true },
|
|
44
|
+
])),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=GuiState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuiState.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/coreTools/GuiState.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,MAAM,OAAO,QAAQ;IAMnB,YAAY,OAKX;;QACC,MAAM,IAAI,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAE7D,IAAI,CAAC,IAAI,GAAG;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,KAAK;YACb,gBAAgB,EAAE,QAAQ;SAC3B,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG;YACb,WAAW,EAAE,GAAG;YAChB,SAAS,EAAE,CAAC;YACZ,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,MAAA,IAAI,CAAC,gBAAgB,mCAAI,SAAS;YAC7C,UAAU,EAAE,MAAA,IAAI,CAAC,iBAAiB,mCAAI,SAAS;YAC/C,kBAAkB,EAAE,EAAE;SACvB,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG;YAChB,YAAY,EAAE,CAAC;YACf,eAAe,EAAE,EAAE;YACnB,MAAM,EAAE,KAAK;YACb,kBAAkB,EAAE,MAAA,IAAI,CAAC,kBAAkB,mCAAI,EAAE;YACjD,aAAa,EAAE,GAAG;YAClB,aAAa,EAAE,IAAI;SACpB,CAAC;QAEF,IAAI,CAAC,YAAY,GAAG;YAClB,KAAK,EAAE,QAAQ;YACf,aAAa,EAAE,CAAC;YAChB,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;YACjE,iBAAiB,EAAE,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;gBAChB,CAAC;gBACD,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE;aAC3E,CAAC,CACH;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
export class NrrdState {
|
|
14
|
+
constructor(baseCanvasesSize = 1, layers = ["layer1", "layer2", "layer3"]) {
|
|
15
|
+
this.image = {
|
|
16
|
+
originWidth: 0,
|
|
17
|
+
originHeight: 0,
|
|
18
|
+
nrrd_x_mm: 0,
|
|
19
|
+
nrrd_y_mm: 0,
|
|
20
|
+
nrrd_z_mm: 0,
|
|
21
|
+
nrrd_x_pixel: 0,
|
|
22
|
+
nrrd_y_pixel: 0,
|
|
23
|
+
nrrd_z_pixel: 0,
|
|
24
|
+
dimensions: [],
|
|
25
|
+
voxelSpacing: [],
|
|
26
|
+
spaceOrigin: [],
|
|
27
|
+
RSARatio: 0,
|
|
28
|
+
ratios: { x: 1, y: 1, z: 1 },
|
|
29
|
+
layers,
|
|
30
|
+
};
|
|
31
|
+
this.view = {
|
|
32
|
+
changedWidth: 0,
|
|
33
|
+
changedHeight: 0,
|
|
34
|
+
currentSliceIndex: 0,
|
|
35
|
+
preSliceIndex: 0,
|
|
36
|
+
maxIndex: 0,
|
|
37
|
+
minIndex: 0,
|
|
38
|
+
contrastNum: 0,
|
|
39
|
+
sizeFactor: baseCanvasesSize,
|
|
40
|
+
showContrast: false,
|
|
41
|
+
switchSliceFlag: false,
|
|
42
|
+
previousPanelL: -99999,
|
|
43
|
+
previousPanelT: -99999,
|
|
44
|
+
};
|
|
45
|
+
this.interaction = {
|
|
46
|
+
mouseOverX: 0,
|
|
47
|
+
mouseOverY: 0,
|
|
48
|
+
mouseOver: false,
|
|
49
|
+
cursorPageX: 0,
|
|
50
|
+
cursorPageY: 0,
|
|
51
|
+
isCursorSelect: false,
|
|
52
|
+
drawStartPos: { x: 1, y: 1 },
|
|
53
|
+
};
|
|
54
|
+
this.sphere = {
|
|
55
|
+
sphereOrigin: { x: [0, 0, 0], y: [0, 0, 0], z: [0, 0, 0] },
|
|
56
|
+
tumourSphereOrigin: null,
|
|
57
|
+
skinSphereOrigin: null,
|
|
58
|
+
ribSphereOrigin: null,
|
|
59
|
+
nippleSphereOrigin: null,
|
|
60
|
+
sphereMaskVolume: null,
|
|
61
|
+
sphereRadius: 5,
|
|
62
|
+
};
|
|
63
|
+
this.flags = {
|
|
64
|
+
stepClear: 1,
|
|
65
|
+
clearAllFlag: false,
|
|
66
|
+
loadingMaskData: false,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
// ── Validated Setters ────────────────────────────────────────────────────
|
|
70
|
+
/** Set zoom factor with clamping [1, 8] */
|
|
71
|
+
setZoomFactor(factor) {
|
|
72
|
+
this.view.sizeFactor = Math.max(1, Math.min(8, factor));
|
|
73
|
+
}
|
|
74
|
+
/** Reset all sphere state to defaults */
|
|
75
|
+
resetSphereState() {
|
|
76
|
+
this.sphere.sphereOrigin = { x: [0, 0, 0], y: [0, 0, 0], z: [0, 0, 0] };
|
|
77
|
+
this.sphere.tumourSphereOrigin = null;
|
|
78
|
+
this.sphere.skinSphereOrigin = null;
|
|
79
|
+
this.sphere.ribSphereOrigin = null;
|
|
80
|
+
this.sphere.nippleSphereOrigin = null;
|
|
81
|
+
this.sphere.sphereMaskVolume = null;
|
|
82
|
+
this.sphere.sphereRadius = 5;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=NrrdState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NrrdState.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/coreTools/NrrdState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,MAAM,OAAO,SAAS;IAOpB,YAAY,mBAA2B,CAAC,EAAE,SAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;QACzF,IAAI,CAAC,KAAK,GAAG;YACX,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;YACf,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,CAAC;YACZ,YAAY,EAAE,CAAC;YACf,YAAY,EAAE,CAAC;YACf,YAAY,EAAE,CAAC;YACf,UAAU,EAAE,EAAE;YACd,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;YAC5B,MAAM;SACP,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG;YACV,YAAY,EAAE,CAAC;YACf,aAAa,EAAE,CAAC;YAChB,iBAAiB,EAAE,CAAC;YACpB,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,gBAAgB;YAC5B,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,CAAC,KAAK;YACtB,cAAc,EAAE,CAAC,KAAK;SACvB,CAAC;QAE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C,EAAE,CAAC;QACxE,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/** Tool mode types for segmentation tools */
|
|
2
|
+
type ToolMode = "pencil" | "brush" | "eraser" | "sphere" | "calculator";
|
|
3
|
+
/** Metadata for a GUI slider/control — used by Vue components to configure slider UI */
|
|
4
|
+
interface IGuiMeta {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
step: number;
|
|
8
|
+
value: number;
|
|
9
|
+
}
|
|
10
|
+
/** Callbacks for external notification of annotation data changes */
|
|
11
|
+
interface IAnnotationCallbacks {
|
|
12
|
+
onMaskChanged(sliceData: Uint8Array, layerId: string, channelId: number, sliceIndex: number, axis: "x" | "y" | "z", width: number, height: number, clearFlag: boolean): void;
|
|
13
|
+
onSphereChanged(sphereOrigin: number[], sphereRadius: number): void;
|
|
14
|
+
onCalculatorPositionsChanged(tumour: ICommXYZ | null, skin: ICommXYZ | null, rib: ICommXYZ | null, nipple: ICommXYZ | null, axis: "x" | "y" | "z"): void;
|
|
15
|
+
onLayerVolumeCleared(layerId: string): void;
|
|
16
|
+
onChannelColorChanged(layerId: string, channel: number, color: {
|
|
17
|
+
r: number;
|
|
18
|
+
g: number;
|
|
19
|
+
b: number;
|
|
20
|
+
a: number;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
1
23
|
interface ICommXYZ {
|
|
2
24
|
x: any;
|
|
3
25
|
y: any;
|
|
@@ -12,14 +34,14 @@ interface ISkipSlicesDictType {
|
|
|
12
34
|
}
|
|
13
35
|
interface IDownloadImageConfig {
|
|
14
36
|
axis: "x" | "y" | "z";
|
|
15
|
-
|
|
37
|
+
currentSliceIndex: number;
|
|
16
38
|
drawingCanvas: HTMLCanvasElement;
|
|
17
39
|
originWidth: number;
|
|
18
40
|
originHeight: number;
|
|
19
41
|
}
|
|
20
42
|
interface IConvertObjType {
|
|
21
|
-
|
|
22
|
-
|
|
43
|
+
currentNewSliceIndex: number;
|
|
44
|
+
preSliceIndex: number;
|
|
23
45
|
convertCursorNumX: number;
|
|
24
46
|
convertCursorNumY: number;
|
|
25
47
|
}
|
|
@@ -99,12 +121,9 @@ interface IProtected {
|
|
|
99
121
|
skipSlicesDic: ISkipSlicesDictType;
|
|
100
122
|
currentShowingSlice: any;
|
|
101
123
|
mainPreSlices: any;
|
|
102
|
-
|
|
103
|
-
Is_Ctrl_Pressed: boolean;
|
|
104
|
-
Is_Draw: boolean;
|
|
124
|
+
isDrawing: boolean;
|
|
105
125
|
axis: "x" | "y" | "z";
|
|
106
126
|
maskData: IMaskData;
|
|
107
|
-
previousDrawingImage?: ImageData;
|
|
108
127
|
/** Dynamic per-layer canvas+ctx pairs. Replaces hardcoded LayerOne/Two/Three fields. */
|
|
109
128
|
layerTargets: Map<string, ILayerRenderTarget>;
|
|
110
129
|
canvases: {
|
|
@@ -123,31 +142,34 @@ interface IProtected {
|
|
|
123
142
|
drawingLayerMasterCtx: CanvasRenderingContext2D;
|
|
124
143
|
};
|
|
125
144
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
145
|
+
/** Tool mode flags — which tool is currently active */
|
|
146
|
+
interface IToolModeState {
|
|
147
|
+
pencil: boolean;
|
|
148
|
+
eraser: boolean;
|
|
149
|
+
sphere: boolean;
|
|
150
|
+
activeSphereType: "tumour" | "skin" | "nipple" | "ribcage";
|
|
151
|
+
}
|
|
152
|
+
/** Drawing configuration — brush/pencil appearance and behavior */
|
|
153
|
+
interface IDrawingConfig {
|
|
130
154
|
globalAlpha: number;
|
|
131
155
|
lineWidth: number;
|
|
132
156
|
color: string;
|
|
133
|
-
pencil: boolean;
|
|
134
157
|
fillColor: string;
|
|
135
158
|
brushColor: string;
|
|
136
159
|
brushAndEraserSize: number;
|
|
160
|
+
}
|
|
161
|
+
/** View configuration — UI layout and interaction parameters */
|
|
162
|
+
interface IViewConfig {
|
|
163
|
+
mainAreaSize: number;
|
|
164
|
+
dragSensitivity: number;
|
|
137
165
|
cursor: string;
|
|
138
|
-
layer: string;
|
|
139
|
-
cal_distance: "tumour" | "skin" | "nipple" | "ribcage";
|
|
140
|
-
sphere: boolean;
|
|
141
|
-
calculator: boolean;
|
|
142
|
-
readyToUpdate: boolean;
|
|
143
166
|
defaultPaintCursor: string;
|
|
144
167
|
max_sensitive: number;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
resetZoom: () => void;
|
|
168
|
+
readyToUpdate: boolean;
|
|
169
|
+
}
|
|
170
|
+
/** Layer/channel state — active layer, channel, and visibility */
|
|
171
|
+
interface ILayerChannelState {
|
|
172
|
+
layer: string;
|
|
151
173
|
/** Currently active channel (1-8). Channel 0 is transparent/erased. */
|
|
152
174
|
activeChannel: number;
|
|
153
175
|
/** Layer visibility state: { layer1: true, layer2: true, layer3: true } */
|
|
@@ -155,15 +177,19 @@ interface IGUIStates {
|
|
|
155
177
|
/** Per-layer channel visibility: { layer1: { 1: true, ..., 8: true }, ... } */
|
|
156
178
|
channelVisibility: Record<string, Record<number, boolean>>;
|
|
157
179
|
}
|
|
180
|
+
interface IGUIStates extends IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState {
|
|
181
|
+
}
|
|
158
182
|
interface IKeyBoardSettings {
|
|
159
183
|
draw: string;
|
|
160
184
|
undo: string;
|
|
161
185
|
redo: string;
|
|
162
186
|
contrast: string[];
|
|
163
187
|
crosshair: string;
|
|
188
|
+
sphere: string;
|
|
164
189
|
mouseWheel: "Scroll:Zoom" | "Scroll:Slice";
|
|
165
190
|
}
|
|
166
|
-
|
|
191
|
+
/** Image metadata — set once during NRRD loading, read-only at runtime */
|
|
192
|
+
interface IImageMetadata {
|
|
167
193
|
originWidth: number;
|
|
168
194
|
originHeight: number;
|
|
169
195
|
nrrd_x_mm: number;
|
|
@@ -172,56 +198,57 @@ interface INrrdStates {
|
|
|
172
198
|
nrrd_x_pixel: number;
|
|
173
199
|
nrrd_y_pixel: number;
|
|
174
200
|
nrrd_z_pixel: number;
|
|
201
|
+
dimensions: number[];
|
|
202
|
+
voxelSpacing: number[];
|
|
203
|
+
spaceOrigin: number[];
|
|
204
|
+
RSARatio: number;
|
|
205
|
+
ratios: ICommXYZ;
|
|
206
|
+
layers: string[];
|
|
207
|
+
}
|
|
208
|
+
/** View state — runtime display/navigation state */
|
|
209
|
+
interface IViewState {
|
|
175
210
|
changedWidth: number;
|
|
176
211
|
changedHeight: number;
|
|
177
|
-
|
|
178
|
-
|
|
212
|
+
currentSliceIndex: number;
|
|
213
|
+
preSliceIndex: number;
|
|
179
214
|
maxIndex: number;
|
|
180
215
|
minIndex: number;
|
|
181
|
-
RSARatio: number;
|
|
182
|
-
voxelSpacing: number[];
|
|
183
|
-
spaceOrigin: number[];
|
|
184
|
-
dimensions: number[];
|
|
185
|
-
loadMaskJson: boolean;
|
|
186
|
-
ratios: ICommXYZ;
|
|
187
216
|
contrastNum: number;
|
|
217
|
+
sizeFactor: number;
|
|
188
218
|
showContrast: boolean;
|
|
189
|
-
|
|
190
|
-
|
|
219
|
+
switchSliceFlag: boolean;
|
|
220
|
+
previousPanelL: number;
|
|
221
|
+
previousPanelT: number;
|
|
222
|
+
}
|
|
223
|
+
/** Interaction state — mouse/cursor tracking */
|
|
224
|
+
interface IInteractionState {
|
|
225
|
+
mouseOverX: number;
|
|
226
|
+
mouseOverY: number;
|
|
227
|
+
mouseOver: boolean;
|
|
191
228
|
cursorPageX: number;
|
|
192
229
|
cursorPageY: number;
|
|
230
|
+
isCursorSelect: boolean;
|
|
231
|
+
drawStartPos: ICommXY;
|
|
232
|
+
}
|
|
233
|
+
/** Sphere state — SphereTool-specific data */
|
|
234
|
+
interface ISphereState {
|
|
193
235
|
sphereOrigin: ICommXYZ;
|
|
194
236
|
tumourSphereOrigin: ICommXYZ | null;
|
|
195
237
|
skinSphereOrigin: ICommXYZ | null;
|
|
196
238
|
ribSphereOrigin: ICommXYZ | null;
|
|
197
239
|
nippleSphereOrigin: ICommXYZ | null;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
ribcageColor: "#2196F3";
|
|
201
|
-
nippleColor: "#E91E63";
|
|
202
|
-
spherePlanB: boolean;
|
|
240
|
+
/** Dedicated MaskVolume for SphereTool 3D sphere data. Type is `any` to avoid circular deps. */
|
|
241
|
+
sphereMaskVolume: any;
|
|
203
242
|
sphereRadius: number;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
243
|
+
}
|
|
244
|
+
/** Internal flags — transient operational flags */
|
|
245
|
+
interface IInternalFlags {
|
|
207
246
|
stepClear: number;
|
|
208
|
-
sizeFoctor: number;
|
|
209
247
|
clearAllFlag: boolean;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
getMask: (sliceData: Uint8Array, layerId: string, channelId: number, sliceIndex: number, axis: "x" | "y" | "z", width: number, height: number, clearFlag: boolean) => void;
|
|
215
|
-
onClearLayerVolume: (layerId: string) => void;
|
|
216
|
-
onChannelColorChanged: (layerId: string, channel: number, color: {
|
|
217
|
-
r: number;
|
|
218
|
-
g: number;
|
|
219
|
-
b: number;
|
|
220
|
-
a: number;
|
|
221
|
-
}) => void;
|
|
222
|
-
getSphere: (sphereOrigin: number[], sphereRadius: number) => void;
|
|
223
|
-
getCalculateSpherePositions: (tumourSphereOrigin: ICommXYZ | null, skinSphereOrigin: ICommXYZ | null, ribSphereOrigin: ICommXYZ | null, nippleSphereOrigin: ICommXYZ | null, aixs: "x" | "y" | "z") => void;
|
|
224
|
-
drawStartPos: ICommXY;
|
|
248
|
+
loadingMaskData: boolean;
|
|
249
|
+
}
|
|
250
|
+
/** Legacy flat interface — kept for backward compatibility during migration */
|
|
251
|
+
interface INrrdStates extends IImageMetadata, IViewState, IInteractionState, ISphereState, IInternalFlags {
|
|
225
252
|
}
|
|
226
253
|
interface IDragOpts {
|
|
227
254
|
showNumber?: boolean;
|
|
@@ -275,15 +302,11 @@ interface IGuiParameterSettings {
|
|
|
275
302
|
step: number;
|
|
276
303
|
onChange: () => void;
|
|
277
304
|
};
|
|
278
|
-
|
|
305
|
+
eraser: {
|
|
279
306
|
name: "Eraser";
|
|
280
307
|
onChange: () => void;
|
|
281
308
|
};
|
|
282
|
-
|
|
283
|
-
name: "Calculator";
|
|
284
|
-
onChange: () => void;
|
|
285
|
-
};
|
|
286
|
-
cal_distance: {
|
|
309
|
+
activeSphereType: {
|
|
287
310
|
name: "CalculatorDistance";
|
|
288
311
|
onChange: (val: "tumour" | "skin" | "ribcage" | "nipple") => void;
|
|
289
312
|
};
|
|
@@ -363,4 +386,4 @@ interface IGuiParameterSettings {
|
|
|
363
386
|
};
|
|
364
387
|
};
|
|
365
388
|
}
|
|
366
|
-
export { ICommXYZ, ICommXY, IDownloadImageConfig, IConvertObjType, IDragPrameters, IDrawingEvents, IContrastEvents, IProtected, IGUIStates, IDragOpts, IDrawOpts, INrrdStates, IPaintImage, IPaintImages, ISkipSlicesDictType, IMaskData, INewMaskData, ILayerRenderTarget, ICursorPage, IGuiParameterSettings, IKeyBoardSettings };
|
|
389
|
+
export { ToolMode, IGuiMeta, IAnnotationCallbacks, ICommXYZ, ICommXY, IDownloadImageConfig, IConvertObjType, IDragPrameters, IDrawingEvents, IContrastEvents, IProtected, IGUIStates, IToolModeState, IDrawingConfig, IViewConfig, ILayerChannelState, IDragOpts, IDrawOpts, INrrdStates, IImageMetadata, IViewState, IInteractionState, ISphereState, IInternalFlags, IPaintImage, IPaintImages, ISkipSlicesDictType, IMaskData, INewMaskData, ILayerRenderTarget, ICursorPage, IGuiParameterSettings, IKeyBoardSettings };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreType.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/coreTools/coreType.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coreType.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/coreTools/coreType.ts"],"names":[],"mappings":"AA2aC,CAAC"}
|
|
@@ -33,7 +33,7 @@ function enableDownload(config) {
|
|
|
33
33
|
let downloadImage = document.createElement("a");
|
|
34
34
|
downloadImage.href = "";
|
|
35
35
|
downloadImage.target = "_blank";
|
|
36
|
-
downloadImage.download = `slice_${config.axis}_#${config.
|
|
36
|
+
downloadImage.download = `slice_${config.axis}_#${config.currentSliceIndex}`;
|
|
37
37
|
const downloadCtx = downloadCanvas.getContext("2d");
|
|
38
38
|
downloadCanvas.width = config.originWidth;
|
|
39
39
|
downloadCanvas.height = config.originHeight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divControlTools.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/coreTools/divControlTools.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,SAAS,wBAAwB;IAC/B,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACrD,cAAc,CAAC,SAAS,GAAG,sBAAsB,CAAC;IAClD,cAAc,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;IAC3C,cAAc,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;IACpC,cAAc,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC;IAClC,cAAc,CAAC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;IAEpC,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY,CAAC,SAAyB;IAC7C,SAAS,CAAC,Q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C;IACpB,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,MAA4B;IAClD,IAAI,cAAc,GAChB,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,aAAa,GAA6B,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC1E,aAAa,CAAC,IAAI,GAAG,EAAE,CAAC;IACxB,aAAa,CAAC,MAAM,GAAG,QAAQ,CAAC;IAChC,aAAa,CAAC,QAAQ,GAAG,SAAS,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAC7E,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,CAC3C,IAAI,CACuB,CAAC;IAC9B,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;IAC1C,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;IAE5C,WAAW,CAAC,SAAS,CACnB,MAAM,CAAC,aAAa,EACpB,CAAC,EACD,CAAC,EACD,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,YAAY,CACpB,CAAC;IACF,aAAa,CAAC,IAAI,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;IAChD,aAAa,CAAC,KAAK,EAAE,CAAC;IAEtB,qCAAqC;IACrC,cAAc,GAAG,IAAI,CAAC;IACtB,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { GUI } from "dat.gui";
|
|
2
|
-
import { IDrawingEvents,
|
|
2
|
+
import { IDrawingEvents, IProtected, IGuiParameterSettings } from "./coreType";
|
|
3
|
+
import type { GuiState } from "./GuiState";
|
|
4
|
+
import { NrrdState } from "./NrrdState";
|
|
3
5
|
import { DragOperator } from "../DragOperator";
|
|
4
6
|
interface IConfigGUI {
|
|
5
7
|
modeFolder: GUI;
|
|
6
8
|
dragOperator: DragOperator;
|
|
7
|
-
nrrd_states:
|
|
8
|
-
gui_states:
|
|
9
|
+
nrrd_states: NrrdState;
|
|
10
|
+
gui_states: GuiState;
|
|
9
11
|
drawingCanvas: HTMLCanvasElement;
|
|
10
12
|
drawingPrameters: IDrawingEvents;
|
|
11
13
|
protectedData: IProtected;
|
|
@@ -15,8 +17,8 @@ interface IConfigGUI {
|
|
|
15
17
|
mainPreSlices: any;
|
|
16
18
|
removeDragMode: () => void;
|
|
17
19
|
configDragMode: () => void;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
clearActiveSlice: () => void;
|
|
21
|
+
clearActiveLayer: () => void;
|
|
20
22
|
updateSlicesContrast: (value: number, flag: string) => void;
|
|
21
23
|
setMainAreaSize: (factor: number) => void;
|
|
22
24
|
resetPaintAreaUIPosition: () => void;
|
|
@@ -26,14 +28,15 @@ interface IConfigGUI {
|
|
|
26
28
|
resetLayerCanvas: () => void;
|
|
27
29
|
redrawDisplayCanvas: () => void;
|
|
28
30
|
flipDisplayImageByAxis: () => void;
|
|
29
|
-
filterDrawedImage: (axis: "x" | "y" | "z", sliceIndex: number) => IPaintImage | undefined;
|
|
30
31
|
setEmptyCanvasSize: (axis?: "x" | "y" | "z") => void;
|
|
31
|
-
|
|
32
|
+
syncLayerSliceData: (index: number, layer: string) => void;
|
|
32
33
|
drawImageOnEmptyImage: (canvas: HTMLCanvasElement) => void;
|
|
33
|
-
storeEachLayerImage: (index: number, layer: string) => void;
|
|
34
|
-
storeImageToLayer: (index: number, canvas: HTMLCanvasElement, paintedImages: IPaintImages) => ImageData;
|
|
35
34
|
getRestLayer: () => string[];
|
|
36
35
|
setIsDrawFalse: (target: number) => void;
|
|
36
|
+
undoLastPainting: () => void;
|
|
37
|
+
redoLastPainting: () => void;
|
|
38
|
+
resetZoom: () => void;
|
|
39
|
+
downloadCurrentMask: () => void;
|
|
37
40
|
}
|
|
38
41
|
declare function setupGui(configs: IConfigGUI): IGuiParameterSettings;
|
|
39
42
|
declare function removeGuiFolderChilden(modeFolder: GUI): void;
|