copper3d 3.0.1 → 3.1.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 +197 -875
- package/dist/Utils/segmentation/CanvasState.d.ts +31 -0
- package/dist/Utils/segmentation/CanvasState.js +167 -0
- package/dist/Utils/segmentation/CanvasState.js.map +1 -0
- package/dist/Utils/segmentation/DragOperator.d.ts +10 -2
- package/dist/Utils/segmentation/DragOperator.js +16 -8
- package/dist/Utils/segmentation/DragOperator.js.map +1 -1
- package/dist/Utils/segmentation/DrawToolCore.d.ts +64 -35
- package/dist/Utils/segmentation/DrawToolCore.js +332 -584
- package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +117 -353
- package/dist/Utils/segmentation/NrrdTools.js +622 -1081
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/RenderingUtils.d.ts +73 -0
- package/dist/Utils/segmentation/RenderingUtils.js +180 -0
- package/dist/Utils/segmentation/RenderingUtils.js.map +1 -0
- package/dist/Utils/segmentation/core/MaskVolume.js +23 -2
- 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 +1 -3
- 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.d.ts +384 -0
- package/dist/Utils/segmentation/core/types.js +25 -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/divControlTools.d.ts +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 -12
- 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 -1
- package/dist/Utils/segmentation/eventRouter/EventRouter.js +15 -10
- 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 +8 -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/ContrastTool.d.ts +3 -6
- package/dist/Utils/segmentation/tools/ContrastTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/CrosshairTool.d.ts +11 -1
- package/dist/Utils/segmentation/tools/CrosshairTool.js +50 -25
- package/dist/Utils/segmentation/tools/CrosshairTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/DataLoader.d.ts +33 -0
- package/dist/Utils/segmentation/tools/DataLoader.js +159 -0
- package/dist/Utils/segmentation/tools/DataLoader.js.map +1 -0
- package/dist/Utils/segmentation/tools/DragSliceTool.d.ts +3 -10
- 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 +85 -0
- package/dist/Utils/segmentation/tools/DrawingTool.js +270 -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 +13 -33
- package/dist/Utils/segmentation/tools/ImageStoreHelper.js +39 -82
- package/dist/Utils/segmentation/tools/ImageStoreHelper.js.map +1 -1
- package/dist/Utils/segmentation/tools/LayerChannelManager.d.ts +52 -0
- package/dist/Utils/segmentation/tools/LayerChannelManager.js +175 -0
- package/dist/Utils/segmentation/tools/LayerChannelManager.js.map +1 -0
- package/dist/Utils/segmentation/tools/PanTool.d.ts +47 -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/SliceRenderPipeline.d.ts +80 -0
- package/dist/Utils/segmentation/tools/SliceRenderPipeline.js +355 -0
- package/dist/Utils/segmentation/tools/SliceRenderPipeline.js.map +1 -0
- package/dist/Utils/segmentation/tools/SphereTool.d.ts +223 -10
- package/dist/Utils/segmentation/tools/SphereTool.js +512 -47
- package/dist/Utils/segmentation/tools/SphereTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/ToolHost.d.ts +74 -0
- package/dist/Utils/segmentation/tools/ToolHost.js +10 -0
- package/dist/Utils/segmentation/tools/ToolHost.js.map +1 -0
- package/dist/Utils/segmentation/tools/ZoomTool.d.ts +2 -6
- package/dist/Utils/segmentation/tools/ZoomTool.js +3 -3
- package/dist/Utils/segmentation/tools/ZoomTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/index.d.ts +8 -6
- package/dist/Utils/segmentation/tools/index.js +10 -1
- package/dist/Utils/segmentation/tools/index.js.map +1 -1
- package/dist/Utils/workers/reformatSaveDataWorker.d.ts +1 -1
- package/dist/bundle.esm.js +3729 -3017
- package/dist/bundle.umd.js +3729 -3017
- 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/CanvasState.d.ts +31 -0
- package/dist/types/Utils/segmentation/DragOperator.d.ts +10 -2
- package/dist/types/Utils/segmentation/DrawToolCore.d.ts +64 -35
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +117 -353
- package/dist/types/Utils/segmentation/RenderingUtils.d.ts +73 -0
- package/dist/types/Utils/segmentation/core/UndoManager.d.ts +1 -1
- package/dist/types/Utils/segmentation/core/index.d.ts +1 -3
- package/dist/types/Utils/segmentation/core/types.d.ts +384 -0
- 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/divControlTools.d.ts +1 -1
- package/dist/types/Utils/segmentation/coreTools/gui.d.ts +12 -12
- package/dist/types/Utils/segmentation/eventRouter/EventRouter.d.ts +2 -1
- package/dist/types/Utils/segmentation/eventRouter/types.d.ts +3 -3
- package/dist/types/Utils/segmentation/tools/BaseTool.d.ts +8 -5
- package/dist/types/Utils/segmentation/tools/ContrastTool.d.ts +3 -6
- package/dist/types/Utils/segmentation/tools/CrosshairTool.d.ts +11 -1
- package/dist/types/Utils/segmentation/tools/DataLoader.d.ts +33 -0
- package/dist/types/Utils/segmentation/tools/DragSliceTool.d.ts +3 -10
- package/dist/types/Utils/segmentation/tools/DrawingTool.d.ts +85 -0
- package/dist/types/Utils/segmentation/tools/ImageStoreHelper.d.ts +13 -33
- package/dist/types/Utils/segmentation/tools/LayerChannelManager.d.ts +52 -0
- package/dist/types/Utils/segmentation/tools/PanTool.d.ts +47 -0
- package/dist/types/Utils/segmentation/tools/SliceRenderPipeline.d.ts +80 -0
- package/dist/types/Utils/segmentation/tools/SphereTool.d.ts +223 -10
- package/dist/types/Utils/segmentation/tools/ToolHost.d.ts +74 -0
- package/dist/types/Utils/segmentation/tools/ZoomTool.d.ts +2 -6
- package/dist/types/Utils/segmentation/tools/index.d.ts +8 -6
- package/dist/types/Utils/workers/reformatSaveDataWorker.d.ts +1 -1
- package/dist/types/index.d.ts +6 -3
- package/package.json +1 -1
- package/dist/Utils/segmentation/CommToolsData.d.ts +0 -177
- package/dist/Utils/segmentation/CommToolsData.js +0 -548
- package/dist/Utils/segmentation/CommToolsData.js.map +0 -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/Utils/segmentation/coreTools/coreType.d.ts +0 -363
- package/dist/Utils/segmentation/coreTools/coreType.js +0 -3
- package/dist/Utils/segmentation/coreTools/coreType.js.map +0 -1
- package/dist/types/Utils/segmentation/CommToolsData.d.ts +0 -177
- package/dist/types/Utils/segmentation/core/MigrationUtils.d.ts +0 -97
- package/dist/types/Utils/segmentation/coreTools/coreType.d.ts +0 -363
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DrawingTool - Pencil/Brush/Eraser drawing on canvas layers
|
|
3
|
+
*
|
|
4
|
+
* Extracted from DrawToolCore.paintOnCanvas() closure (Phase 3).
|
|
5
|
+
* Handles left-click drawing operations: pencil stroke + fill, brush strokes,
|
|
6
|
+
* eraser, and undo snapshot capture/push.
|
|
7
|
+
*/
|
|
8
|
+
import { BaseTool } from "./BaseTool";
|
|
9
|
+
import type { ToolContext } from "./BaseTool";
|
|
10
|
+
import type { DrawingHostDeps } from "./ToolHost";
|
|
11
|
+
export declare class DrawingTool extends BaseTool {
|
|
12
|
+
/** Left mouse button currently held (draw mode) */
|
|
13
|
+
private leftClicked;
|
|
14
|
+
/** True while actively painting (between pointerdown and pointerup) */
|
|
15
|
+
private isPainting;
|
|
16
|
+
/** Accumulated pencil stroke points for fill-on-release */
|
|
17
|
+
private drawingLines;
|
|
18
|
+
/** Eraser arc function, assigned once per paintOnCanvas() call */
|
|
19
|
+
private clearArcFn;
|
|
20
|
+
/** Snapshot of the active layer's slice captured on mouse-down (before drawing) */
|
|
21
|
+
private preDrawSlice;
|
|
22
|
+
private preDrawAxis;
|
|
23
|
+
private preDrawSliceIndex;
|
|
24
|
+
private callbacks;
|
|
25
|
+
constructor(ctx: ToolContext, callbacks: DrawingHostDeps);
|
|
26
|
+
/** Whether a draw operation is currently active */
|
|
27
|
+
get isActive(): boolean;
|
|
28
|
+
/** Whether paint strokes are being recorded */
|
|
29
|
+
get painting(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Reset drawing state. Called at start of each paintOnCanvas() cycle.
|
|
32
|
+
* @param clearArcFn - Eraser function for this paint cycle
|
|
33
|
+
*/
|
|
34
|
+
reset(clearArcFn: (x: number, y: number, size: number) => void): void;
|
|
35
|
+
/**
|
|
36
|
+
* Called on left-click pointerdown in draw mode.
|
|
37
|
+
* Sets up drawing state, cursor, undo snapshot, and start position.
|
|
38
|
+
*/
|
|
39
|
+
onPointerDown(e: MouseEvent): void;
|
|
40
|
+
/**
|
|
41
|
+
* Called on pointermove during an active drawing operation.
|
|
42
|
+
* Handles eraser clearing or brush/pencil stroke accumulation.
|
|
43
|
+
*/
|
|
44
|
+
onPointerMove(e: MouseEvent): void;
|
|
45
|
+
/**
|
|
46
|
+
* Called on pointerup in draw mode.
|
|
47
|
+
* Completes stroke, fills pencil path, syncs volume, pushes undo delta.
|
|
48
|
+
*/
|
|
49
|
+
onPointerUp(_e: MouseEvent): void;
|
|
50
|
+
/**
|
|
51
|
+
* Called on pointerleave during drawing.
|
|
52
|
+
* Resets painting state and cleans up leftClicked.
|
|
53
|
+
* @returns true if drawing was in progress when leave occurred
|
|
54
|
+
*/
|
|
55
|
+
onPointerLeave(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Create a self-managing mouseover/mouseout/mousemove handler
|
|
58
|
+
* that tracks brush hover position for the preview circle.
|
|
59
|
+
*
|
|
60
|
+
* The returned function should be registered on drawingCanvas for
|
|
61
|
+
* "mouseover" and "mouseout" events. It adds/removes a "mousemove"
|
|
62
|
+
* listener on itself to keep mouseOverX/Y up-to-date while the
|
|
63
|
+
* cursor is inside the canvas.
|
|
64
|
+
*/
|
|
65
|
+
createBrushTrackingHandler(): (e: MouseEvent) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Render brush circle preview on the drawing context.
|
|
68
|
+
* Called from the start() render loop when in draw mode and not
|
|
69
|
+
* actively painting. Skipped in pencil/eraser mode.
|
|
70
|
+
*/
|
|
71
|
+
renderBrushPreview(ctx: CanvasRenderingContext2D, width: number, height: number): void;
|
|
72
|
+
/** Capture pre-draw slice snapshot for undo */
|
|
73
|
+
private capturePreDrawSnapshot;
|
|
74
|
+
/** Push delta to UndoManager after drawing completes */
|
|
75
|
+
private pushUndoDelta;
|
|
76
|
+
/**
|
|
77
|
+
* Redraws persisted layer data onto ctx before new pencil fill.
|
|
78
|
+
* Extracted from DrawToolCore.
|
|
79
|
+
*/
|
|
80
|
+
private redrawPreviousImageToLayerCtx;
|
|
81
|
+
/** Draw a line segment on a layer canvas */
|
|
82
|
+
private drawLinesOnLayer;
|
|
83
|
+
/** Paint a segment on the current layer canvas and composite to master */
|
|
84
|
+
private paintOnCanvasLayer;
|
|
85
|
+
}
|
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
* ImageStoreHelper - Cross-axis image storage
|
|
3
3
|
*
|
|
4
4
|
* Extracted from DrawToolCore.ts:
|
|
5
|
-
* -
|
|
5
|
+
* - syncLayerSliceData
|
|
6
6
|
*
|
|
7
7
|
* Phase 3: MaskVolume is the sole storage backend. All IPaintImages params removed.
|
|
8
8
|
*/
|
|
9
9
|
import { BaseTool } from "./BaseTool";
|
|
10
10
|
import type { ToolContext } from "./BaseTool";
|
|
11
|
-
|
|
12
|
-
setEmptyCanvasSize: (axis?: "x" | "y" | "z") => void;
|
|
13
|
-
drawImageOnEmptyImage: (canvas: HTMLCanvasElement) => void;
|
|
14
|
-
}
|
|
11
|
+
import type { ImageStoreHostDeps } from "./ToolHost";
|
|
15
12
|
export declare class ImageStoreHelper extends BaseTool {
|
|
16
13
|
private callbacks;
|
|
17
|
-
constructor(ctx: ToolContext, callbacks:
|
|
14
|
+
constructor(ctx: ToolContext, callbacks: ImageStoreHostDeps);
|
|
18
15
|
/**
|
|
19
16
|
* Get MaskVolume for a specific layer.
|
|
20
17
|
* Delegates to the volumes stored in protectedData.maskData.
|
|
@@ -23,40 +20,23 @@ export declare class ImageStoreHelper extends BaseTool {
|
|
|
23
20
|
* @returns MaskVolume for the given layer, or layer1 as fallback
|
|
24
21
|
*/
|
|
25
22
|
private getVolumeForLayer;
|
|
26
|
-
/**
|
|
27
|
-
* Get MaskVolume for the currently active layer.
|
|
28
|
-
*/
|
|
29
|
-
private getCurrentVolume;
|
|
30
23
|
/**
|
|
31
24
|
* Get the canvas element for a specific layer.
|
|
32
25
|
*/
|
|
33
26
|
private getCanvasForLayer;
|
|
34
27
|
/**
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
storeImageToAxis(_index: number, _imageData: ImageData, _axis?: "x" | "y" | "z"): void;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieve the drawn image for a given axis and slice.
|
|
28
|
+
* Vertically flip an ImageData buffer in-place (swap rows top↔bottom).
|
|
40
29
|
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Store all layer images for the current slice (cross-axis sync).
|
|
49
|
-
*
|
|
50
|
-
* Phase 2: Also writes into the current layer's MaskVolume.
|
|
51
|
-
*/
|
|
52
|
-
storeAllImages(index: number, layer: string): void;
|
|
53
|
-
/**
|
|
54
|
-
* Store a single layer's canvas data to its MaskVolume.
|
|
55
|
-
* Reads from the individual layer canvas (not master) and uses RGB→channel reverse lookup.
|
|
30
|
+
* Used to compensate for the Z-axis direction reversal between sagittal
|
|
31
|
+
* and coronal views. On coronal, Z runs along the canvas j-axis (vertical),
|
|
32
|
+
* and the display flip (scale(1,-1)) reverses Z relative to sagittal's
|
|
33
|
+
* horizontal Z mapping. This row-swap aligns the Z ordering so that
|
|
34
|
+
* MaskVolume stores data in a consistent coordinate system.
|
|
56
35
|
*/
|
|
57
|
-
|
|
36
|
+
private flipImageDataVertically;
|
|
58
37
|
/**
|
|
59
|
-
*
|
|
38
|
+
* Sync the current layer canvas to its MaskVolume slice and notify the parent
|
|
39
|
+
* via getMask. This is the primary write path after any draw/erase operation.
|
|
60
40
|
*/
|
|
61
|
-
|
|
41
|
+
syncLayerSliceData(index: number, layer: string): void;
|
|
62
42
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BaseTool } from "./BaseTool";
|
|
2
|
+
import type { ToolContext } from "./BaseTool";
|
|
3
|
+
import type { ChannelValue, RGBAColor, ChannelColorMap } from "../core";
|
|
4
|
+
import type { SphereType } from "./SphereTool";
|
|
5
|
+
import type { LayerChannelHostDeps } from "./ToolHost";
|
|
6
|
+
/**
|
|
7
|
+
* Manages layer/channel state: active selection, visibility, and channel colors.
|
|
8
|
+
*
|
|
9
|
+
* Extracted from NrrdTools.ts to reduce its size.
|
|
10
|
+
* Follows the same BaseTool + ToolContext + Callbacks pattern as other tools.
|
|
11
|
+
*/
|
|
12
|
+
export declare class LayerChannelManager extends BaseTool {
|
|
13
|
+
private callbacks;
|
|
14
|
+
constructor(ctx: ToolContext, callbacks: LayerChannelHostDeps);
|
|
15
|
+
/****************************Active Layer/Channel****************************************************/
|
|
16
|
+
setActiveLayer(layerId: string): void;
|
|
17
|
+
getActiveLayer(): string;
|
|
18
|
+
setActiveChannel(channel: ChannelValue): void;
|
|
19
|
+
getActiveChannel(): number;
|
|
20
|
+
/**
|
|
21
|
+
* Set the active sphere type and sync brush/fill color.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* nrrdTools.setActiveSphereType('nipple');
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
setActiveSphereType(type: SphereType): void;
|
|
29
|
+
getActiveSphereType(): SphereType;
|
|
30
|
+
/****************************Visibility****************************************************/
|
|
31
|
+
setLayerVisible(layerId: string, visible: boolean): void;
|
|
32
|
+
isLayerVisible(layerId: string): boolean;
|
|
33
|
+
setChannelVisible(layerId: string, channel: ChannelValue, visible: boolean): void;
|
|
34
|
+
isChannelVisible(layerId: string, channel: ChannelValue): boolean;
|
|
35
|
+
getLayerVisibility(): Record<string, boolean>;
|
|
36
|
+
getChannelVisibility(): Record<string, Record<number, boolean>>;
|
|
37
|
+
hasLayerData(layerId: string): boolean;
|
|
38
|
+
/****************************Channel Colors****************************************************/
|
|
39
|
+
setChannelColor(layerId: string, channel: number, color: RGBAColor): void;
|
|
40
|
+
getChannelColor(layerId: string, channel: number): RGBAColor;
|
|
41
|
+
getChannelHexColor(layerId: string, channel: number): string;
|
|
42
|
+
getChannelCssColor(layerId: string, channel: number): string;
|
|
43
|
+
setChannelColors(layerId: string, colorMap: Partial<ChannelColorMap>): void;
|
|
44
|
+
setAllLayersChannelColor(channel: number, color: RGBAColor): void;
|
|
45
|
+
resetChannelColors(layerId?: string, channel?: number): void;
|
|
46
|
+
/****************************Private Helpers****************************************************/
|
|
47
|
+
/**
|
|
48
|
+
* Sync brush/fill color from the active layer's volume channel color.
|
|
49
|
+
* Falls back to global CHANNEL_HEX_COLORS if volume not available.
|
|
50
|
+
*/
|
|
51
|
+
private syncBrushColor;
|
|
52
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PanTool - Right-click pan/drag navigation
|
|
3
|
+
*
|
|
4
|
+
* Extracted from DrawToolCore.paintOnCanvas() closure.
|
|
5
|
+
* Handles right-click drag to reposition the canvas view.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseTool } from "./BaseTool";
|
|
8
|
+
import type { ToolContext } from "./BaseTool";
|
|
9
|
+
import type { PanHostDeps } from "./ToolHost";
|
|
10
|
+
export declare class PanTool extends BaseTool {
|
|
11
|
+
/** Right mouse button currently held */
|
|
12
|
+
private rightClicked;
|
|
13
|
+
/** Pan drag offset X (clientX − canvas.offsetLeft at drag start) */
|
|
14
|
+
private panMoveInnerX;
|
|
15
|
+
/** Pan drag offset Y (clientY − canvas.offsetTop at drag start) */
|
|
16
|
+
private panMoveInnerY;
|
|
17
|
+
private callbacks;
|
|
18
|
+
/**
|
|
19
|
+
* Bound handler reference for pointermove so we can add/remove it.
|
|
20
|
+
* Arrow function preserves `this` binding.
|
|
21
|
+
*/
|
|
22
|
+
private readonly boundPointerMove;
|
|
23
|
+
constructor(ctx: ToolContext, callbacks: PanHostDeps);
|
|
24
|
+
/** Whether a pan drag is currently active */
|
|
25
|
+
get isActive(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Called on right-click pointerdown.
|
|
28
|
+
* Captures initial offsets and registers pointermove listener.
|
|
29
|
+
*/
|
|
30
|
+
onPointerDown(e: MouseEvent): void;
|
|
31
|
+
/**
|
|
32
|
+
* Called on pointerup (button === 2).
|
|
33
|
+
* Cleans up listeners and restores cursor.
|
|
34
|
+
*/
|
|
35
|
+
onPointerUp(e: MouseEvent, defaultCursor: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Called on pointerleave while pan is active.
|
|
38
|
+
* Resets state and removes listener.
|
|
39
|
+
*/
|
|
40
|
+
onPointerLeave(): void;
|
|
41
|
+
/** Reset pan state (called when paintOnCanvas re-initializes) */
|
|
42
|
+
reset(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Pointermove handler — updates canvas position during drag.
|
|
45
|
+
*/
|
|
46
|
+
private handlePointerMove;
|
|
47
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { BaseTool } from "./BaseTool";
|
|
2
|
+
import type { ToolContext } from "./BaseTool";
|
|
3
|
+
import type { SliceRenderHostDeps } from "./ToolHost";
|
|
4
|
+
/**
|
|
5
|
+
* Manages slice rendering pipeline: slice setup, canvas rendering, and view helpers.
|
|
6
|
+
*
|
|
7
|
+
* Extracted from NrrdTools.ts to reduce its size.
|
|
8
|
+
* Follows the same BaseTool + ToolContext + Callbacks pattern as other tools.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SliceRenderPipeline extends BaseTool {
|
|
11
|
+
private callbacks;
|
|
12
|
+
private initState;
|
|
13
|
+
constructor(ctx: ToolContext, callbacks: SliceRenderHostDeps);
|
|
14
|
+
/**
|
|
15
|
+
* Reset initState to true (called from NrrdTools.reset() when switching datasets).
|
|
16
|
+
*/
|
|
17
|
+
resetInitState(): void;
|
|
18
|
+
/****************************Slice Setup****************************************************/
|
|
19
|
+
setDisplaySlicesBaseOnAxis(): void;
|
|
20
|
+
private loadDisplaySlicesArray;
|
|
21
|
+
resetDisplaySlicesStatus(): void;
|
|
22
|
+
private setupConfigs;
|
|
23
|
+
private setMainPreSlice;
|
|
24
|
+
private setOriginCanvasAndPre;
|
|
25
|
+
afterLoadSlice(): void;
|
|
26
|
+
private updateMaxIndex;
|
|
27
|
+
/****************************Rendering****************************************************/
|
|
28
|
+
/**
|
|
29
|
+
* Phase 3: Reload all mask layers from MaskVolume using buffer reuse
|
|
30
|
+
* Replaces the old reloadMaskToLayer approach
|
|
31
|
+
*/
|
|
32
|
+
reloadMasksFromVolume(): void;
|
|
33
|
+
/******************************** redraw display canvas ***************************************/
|
|
34
|
+
/**
|
|
35
|
+
* Redraw current contrast image to display canvas.
|
|
36
|
+
* It is more related to change the contrast slice image's window width or center.
|
|
37
|
+
*/
|
|
38
|
+
redrawDisplayCanvas(): void;
|
|
39
|
+
redrawMianPreOnDisplayCanvas(): void;
|
|
40
|
+
/**
|
|
41
|
+
* flip the canvas to a correct position.
|
|
42
|
+
* This is because the slice canvas from threejs is not in a correct 2D postion.
|
|
43
|
+
* Thus, everytime when we redraw the display canvas, we need to flip to draw the origin canvas from threejs.
|
|
44
|
+
* Under different axis(sagittal, Axial, Coronal), the flip orientation is different.
|
|
45
|
+
*/
|
|
46
|
+
flipDisplayImageByAxis(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Set the empty canvas width and height based on the axis (pixel distance not the mm), to reduce duplicate codes.
|
|
49
|
+
*
|
|
50
|
+
* @param axis
|
|
51
|
+
*/
|
|
52
|
+
setEmptyCanvasSize(axis?: "x" | "y" | "z"): void;
|
|
53
|
+
/**
|
|
54
|
+
* Clear masks on drawingCanvas layers.
|
|
55
|
+
*/
|
|
56
|
+
resetLayerCanvas(): void;
|
|
57
|
+
/****************************View/Canvas Helpers****************************************************/
|
|
58
|
+
/**
|
|
59
|
+
* Resize the draw and display canvas size based on the input size factor number.
|
|
60
|
+
* @param factor number
|
|
61
|
+
*/
|
|
62
|
+
resizePaintArea(factor: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Reset the draw and display canvases layout after mouse pan.
|
|
65
|
+
* If no params in, then center the draw and display canvases.
|
|
66
|
+
* @param l number, Offset to the left
|
|
67
|
+
* @param t number, Offset to the top
|
|
68
|
+
*/
|
|
69
|
+
resetPaintAreaUIPosition(l?: number, t?: number): void;
|
|
70
|
+
/**
|
|
71
|
+
* Update the original canvas size, allow set to threejs load one (pixel distance not the mm).
|
|
72
|
+
* Then update the changedWidth and changedHeight based on the sizeFactor.
|
|
73
|
+
*/
|
|
74
|
+
updateOriginAndChangedWH(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Keep all contrast slice index to same.
|
|
77
|
+
* Synchronize the slice indexes of all the contrasts so that they are consistent with the main slice's index.
|
|
78
|
+
*/
|
|
79
|
+
setSyncsliceNum(): void;
|
|
80
|
+
}
|
|
@@ -1,36 +1,249 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SphereTool - Sphere drawing and calculator sphere operations
|
|
3
3
|
*
|
|
4
|
+
* Provides 3D sphere placement across multiple slice views.
|
|
5
|
+
* Supports 4 sphere types: tumour, skin, nipple, ribcage.
|
|
6
|
+
* Each type maps to a specific layer and channel for future MaskVolume integration.
|
|
7
|
+
*
|
|
8
|
+
* ## Interaction Flow
|
|
9
|
+
* 1. Sphere mode activated (gui_states.sphere = true)
|
|
10
|
+
* - Draw mode (Shift key) is disabled
|
|
11
|
+
* - Crosshair toggle is disabled
|
|
12
|
+
* 2. Left-click down: record sphere center (mouseX, mouseY, sliceIndex)
|
|
13
|
+
* - Remove zoom/slice wheel event
|
|
14
|
+
* - Bind sphere wheel event
|
|
15
|
+
* - Draw preview circle on sphereCanvas
|
|
16
|
+
* 3. While holding left-click, scroll wheel adjusts sphereRadius [1, 50]
|
|
17
|
+
* 4. Left-click up:
|
|
18
|
+
* - Fire getSphere / getCalculateSpherePositions callbacks
|
|
19
|
+
* - (Plan B) Draw 3D sphere across x/y/z axes into sphereMaskVolume
|
|
20
|
+
* - Remove sphere wheel event
|
|
21
|
+
* - Restore zoom/slice wheel event
|
|
22
|
+
*
|
|
23
|
+
* ## Channel Mapping
|
|
24
|
+
* Each sphere type defaults to layer1 with a specific channel:
|
|
25
|
+
* - tumour → layer1, channel 1
|
|
26
|
+
* - ribcage → layer1, channel 3
|
|
27
|
+
* - skin → layer1, channel 4
|
|
28
|
+
* - nipple → layer1, channel 5
|
|
29
|
+
*
|
|
30
|
+
* ## SphereMaskVolume
|
|
31
|
+
* Sphere 3D data is stored in a dedicated MaskVolume (nrrd_states.sphereMaskVolume)
|
|
32
|
+
* separate from the layer draw mask volumes, to avoid polluting layer1's draw data.
|
|
33
|
+
* This volume is created in setAllSlices() and cleared in reset().
|
|
34
|
+
*
|
|
35
|
+
* ## Future: Writing to Layer MaskVolume
|
|
36
|
+
* Currently sphere data does NOT write to layer1's MaskVolume.
|
|
37
|
+
* The channel mapping and interfaces are reserved for future integration.
|
|
38
|
+
* When enabled, use SPHERE_CHANNEL_MAP to determine the target layer & channel,
|
|
39
|
+
* then call volume.setVoxel() or similar to persist sphere data.
|
|
40
|
+
*
|
|
4
41
|
* Extracted from DrawToolCore.ts:
|
|
5
42
|
* - drawSphere / drawSphereCore / clearSphereCanvas
|
|
6
43
|
* - drawSphereOnEachViews / drawCalculatorSphereOnEachViews
|
|
7
44
|
* - storeSphereImages / setSphereCanvasSize
|
|
8
45
|
* - drawCalculatorSphere / configMouseSphereWheel
|
|
9
|
-
* - getSpherePosition
|
|
46
|
+
* - getSpherePosition
|
|
10
47
|
*/
|
|
11
48
|
import { BaseTool } from "./BaseTool";
|
|
12
49
|
import type { ToolContext } from "./BaseTool";
|
|
50
|
+
import type { SphereHostDeps } from "./ToolHost";
|
|
51
|
+
/** The 4 supported sphere marker types. */
|
|
52
|
+
export type SphereType = 'tumour' | 'skin' | 'nipple' | 'ribcage';
|
|
13
53
|
/**
|
|
14
|
-
*
|
|
54
|
+
* Default layer and channel for each sphere type.
|
|
55
|
+
*
|
|
56
|
+
* This mapping is used to:
|
|
57
|
+
* 1. Determine the color for sphere preview rendering
|
|
58
|
+
* 2. (Future) Write sphere data into the corresponding layer's MaskVolume channel
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const { layer, channel } = SPHERE_CHANNEL_MAP['tumour'];
|
|
63
|
+
* // layer = 'layer1', channel = 1
|
|
64
|
+
* ```
|
|
15
65
|
*/
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
66
|
+
export declare const SPHERE_CHANNEL_MAP: Record<SphereType, {
|
|
67
|
+
layer: string;
|
|
68
|
+
channel: number;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Label values for sphere types stored in sphereMaskVolume.
|
|
72
|
+
* Regular sphere mode uses SPHERE_LABEL (1).
|
|
73
|
+
* Calculator mode uses type-specific labels (1-4).
|
|
74
|
+
*/
|
|
75
|
+
export declare const SPHERE_LABELS: Record<SphereType | 'default', number>;
|
|
21
76
|
export declare class SphereTool extends BaseTool {
|
|
22
77
|
private callbacks;
|
|
23
|
-
constructor(ctx: ToolContext, callbacks:
|
|
24
|
-
setCallbacks(callbacks:
|
|
78
|
+
constructor(ctx: ToolContext, callbacks: SphereHostDeps);
|
|
79
|
+
setCallbacks(callbacks: SphereHostDeps): void;
|
|
80
|
+
/**
|
|
81
|
+
* Get the channel number for a sphere type.
|
|
82
|
+
*
|
|
83
|
+
* @param type - Sphere type ('tumour', 'skin', 'ribcage', 'nipple')
|
|
84
|
+
* @returns Channel number (1-8) mapped to this sphere type
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* sphereTool.getChannelForSphereType('tumour'); // → 1
|
|
89
|
+
* sphereTool.getChannelForSphereType('skin'); // → 4
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
getChannelForSphereType(type: SphereType): number;
|
|
93
|
+
/**
|
|
94
|
+
* Get the default layer for a sphere type.
|
|
95
|
+
*
|
|
96
|
+
* @param type - Sphere type
|
|
97
|
+
* @returns Layer ID (e.g. 'layer1')
|
|
98
|
+
*/
|
|
99
|
+
getLayerForSphereType(type: SphereType): string;
|
|
100
|
+
/**
|
|
101
|
+
* Get the preview color for a sphere type.
|
|
102
|
+
*
|
|
103
|
+
* If a volume is available for the target layer, uses the volume's
|
|
104
|
+
* custom color map (respects per-layer color customization).
|
|
105
|
+
* Otherwise falls back to SPHERE_COLORS (derived from CHANNEL_HEX_COLORS).
|
|
106
|
+
*
|
|
107
|
+
* @param type - Sphere type
|
|
108
|
+
* @returns CSS color string (hex)
|
|
109
|
+
*/
|
|
110
|
+
getColorForSphereType(type: SphereType): string;
|
|
25
111
|
setSphereCanvasSize(axis?: "x" | "y" | "z"): void;
|
|
112
|
+
/**
|
|
113
|
+
* Draw a filled circle on the given context.
|
|
114
|
+
*
|
|
115
|
+
* @param ctx - Canvas 2D context
|
|
116
|
+
* @param x - Center X coordinate
|
|
117
|
+
* @param y - Center Y coordinate
|
|
118
|
+
* @param radius - Circle radius in pixels
|
|
119
|
+
* @param color - Fill color (CSS string)
|
|
120
|
+
*/
|
|
26
121
|
drawSphereCore(ctx: CanvasRenderingContext2D, x: number, y: number, radius: number, color: string): void;
|
|
27
122
|
clearSphereCanvas(): [HTMLCanvasElement, CanvasRenderingContext2D];
|
|
123
|
+
/**
|
|
124
|
+
* Draw a sphere preview circle on the sphere canvas using the current
|
|
125
|
+
* gui_states.fillColor. Called during sphere mode pointer-down.
|
|
126
|
+
*
|
|
127
|
+
* NOTE: Does NOT composite to master canvas — the start() render loop
|
|
128
|
+
* draws the sphere canvas directly to drawingCtx for proper layering.
|
|
129
|
+
*/
|
|
28
130
|
drawSphere(mouseX: number, mouseY: number, radius: number): void;
|
|
131
|
+
/**
|
|
132
|
+
* Returns a wheel event handler that adjusts sphere radius while the user
|
|
133
|
+
* holds left-click in sphere mode.
|
|
134
|
+
*
|
|
135
|
+
* Radius is clamped to [1, 50].
|
|
136
|
+
*/
|
|
29
137
|
configMouseSphereWheel(): (e: WheelEvent) => void;
|
|
138
|
+
/**
|
|
139
|
+
* Store sphere slice image into SphereMaskVolume.
|
|
140
|
+
*
|
|
141
|
+
* Currently a no-op — sphere slice data is rendered as overlay only.
|
|
142
|
+
*
|
|
143
|
+
* TODO: Future — write sphere circle data into nrrd_states.sphereMaskVolume
|
|
144
|
+
* at the specified slice index and axis. Use SPHERE_CHANNEL_MAP to determine
|
|
145
|
+
* the target channel when integrating with layer MaskVolume.
|
|
146
|
+
*/
|
|
30
147
|
private storeSphereImages;
|
|
148
|
+
/**
|
|
149
|
+
* Draw a sphere cross-section at a given decay distance from center,
|
|
150
|
+
* for a specific axis view.
|
|
151
|
+
*
|
|
152
|
+
* Called for each decay value [0..sphereRadius] for all 3 axes,
|
|
153
|
+
* creating the 3D sphere effect.
|
|
154
|
+
*
|
|
155
|
+
* The sphere circle radius at each slice = sphereRadius - decay (linear decay).
|
|
156
|
+
*
|
|
157
|
+
* @param decay - Distance from sphere center slice
|
|
158
|
+
* @param axis - Axis to render on ('x', 'y', 'z')
|
|
159
|
+
*/
|
|
31
160
|
drawSphereOnEachViews(decay: number, axis: "x" | "y" | "z"): void;
|
|
32
161
|
private getSpherePosition;
|
|
162
|
+
/**
|
|
163
|
+
* Draw all 4 calculator sphere types on each view axis.
|
|
164
|
+
*
|
|
165
|
+
* Groups sphere positions by their slice index so that spheres on the
|
|
166
|
+
* same slice are drawn together before storing.
|
|
167
|
+
*
|
|
168
|
+
* Uses SPHERE_COLORS for each sphere type instead of nrrd_states.*Color.
|
|
169
|
+
*/
|
|
33
170
|
drawCalculatorSphereOnEachViews(axis: "x" | "y" | "z"): void;
|
|
171
|
+
/**
|
|
172
|
+
* Draw all placed calculator spheres on the current slice.
|
|
173
|
+
*
|
|
174
|
+
* Called every frame to show existing sphere markers on the current view.
|
|
175
|
+
* Uses SPHERE_COLORS for consistent type-based coloring.
|
|
176
|
+
*
|
|
177
|
+
* @param radius - Sphere radius to draw
|
|
178
|
+
*/
|
|
34
179
|
drawCalculatorSphere(radius: number): void;
|
|
35
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Handle left-click in sphere mode — record origin, draw preview.
|
|
182
|
+
*
|
|
183
|
+
* Performs all data operations for sphere placement:
|
|
184
|
+
* 1. Record sphere origin for current axis
|
|
185
|
+
* 2. Convert origin to all three axes via setUpSphereOrigins
|
|
186
|
+
* 3. Store origin for the active sphere type
|
|
187
|
+
* 4. Enable crosshair at click position
|
|
188
|
+
* 5. Draw calculator sphere preview
|
|
189
|
+
*
|
|
190
|
+
* Event binding (wheel, pointerup) stays in DrawToolCore as orchestration.
|
|
191
|
+
*/
|
|
192
|
+
onSphereClick(e: MouseEvent): void;
|
|
193
|
+
/**
|
|
194
|
+
* Handle pointer-up in sphere mode — write to volume, fire callbacks.
|
|
195
|
+
*
|
|
196
|
+
* Performs:
|
|
197
|
+
* 1. Write all placed calculator spheres to sphereMaskVolume
|
|
198
|
+
* 2. Refresh sphere canvas overlay from volume
|
|
199
|
+
* 3. Fire onSphereChanged and onCalculatorPositionsChanged callbacks
|
|
200
|
+
*
|
|
201
|
+
* Event cleanup (wheel, pointerup listener removal) stays in DrawToolCore.
|
|
202
|
+
*/
|
|
203
|
+
onSpherePointerUp(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Convert canvas (mm-space) coordinates to 3D voxel coordinates.
|
|
206
|
+
*
|
|
207
|
+
* @param canvasX - X position in canvas mm-space
|
|
208
|
+
* @param canvasY - Y position in canvas mm-space
|
|
209
|
+
* @param sliceIndex - Slice index along the viewing axis
|
|
210
|
+
* @param axis - Viewing axis where the sphere was placed
|
|
211
|
+
* @returns 3D voxel coordinates { x, y, z }
|
|
212
|
+
*/
|
|
213
|
+
canvasToVoxelCenter(canvasX: number, canvasY: number, sliceIndex: number, axis: "x" | "y" | "z"): {
|
|
214
|
+
x: number;
|
|
215
|
+
y: number;
|
|
216
|
+
z: number;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Write a 3D solid sphere to sphereMaskVolume.
|
|
220
|
+
*
|
|
221
|
+
* Converts the sphere center from canvas mm-space to voxel coordinates,
|
|
222
|
+
* then iterates over a bounding box and sets voxels within the sphere.
|
|
223
|
+
* The sphere is an ellipsoid in voxel space to appear circular in
|
|
224
|
+
* physical (mm) space on all axis views.
|
|
225
|
+
*
|
|
226
|
+
* @param label - Label value to write (1-4, default 1)
|
|
227
|
+
*/
|
|
228
|
+
write3DSphereToVolume(label?: number): void;
|
|
229
|
+
/**
|
|
230
|
+
* Write a calculator sphere type to sphereMaskVolume.
|
|
231
|
+
* Uses the stored origin for the specified sphere type.
|
|
232
|
+
*
|
|
233
|
+
* @param type - Sphere type ('tumour', 'skin', 'nipple', 'ribcage')
|
|
234
|
+
*/
|
|
235
|
+
writeCalculatorSphereToVolume(type: SphereType): void;
|
|
236
|
+
/**
|
|
237
|
+
* Write all placed calculator spheres to the volume.
|
|
238
|
+
* Clears the volume first, then writes each placed sphere type.
|
|
239
|
+
*/
|
|
240
|
+
writeAllCalculatorSpheresToVolume(): void;
|
|
241
|
+
/**
|
|
242
|
+
* Render the current slice of sphereMaskVolume to drawingSphereCanvas.
|
|
243
|
+
*
|
|
244
|
+
* Called after any operation that changes the view (slice, axis, zoom)
|
|
245
|
+
* to keep the sphere overlay visible. Uses the same render pipeline as
|
|
246
|
+
* layer masks (emptyCanvas → sphere canvas at display scale).
|
|
247
|
+
*/
|
|
248
|
+
refreshSphereCanvas(): void;
|
|
36
249
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolHost — Unified host interface for all tools.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the 10 individual *Callbacks interfaces with a single definition.
|
|
5
|
+
* Each tool picks only the methods it needs via `Pick<ToolHost, ...>`.
|
|
6
|
+
*
|
|
7
|
+
* @see issue3_unify_callbacks_plan.md
|
|
8
|
+
*/
|
|
9
|
+
import type { MaskVolume, MaskDelta } from "../core";
|
|
10
|
+
import type { RGBAColor } from "../core";
|
|
11
|
+
/**
|
|
12
|
+
* Unified host interface — all methods that tools may call back into.
|
|
13
|
+
*
|
|
14
|
+
* Each tool picks only the methods it needs via `Pick<ToolHost, ...>`.
|
|
15
|
+
*/
|
|
16
|
+
export interface ToolHost {
|
|
17
|
+
setEmptyCanvasSize(axis?: "x" | "y" | "z"): void;
|
|
18
|
+
drawImageOnEmptyImage(canvas: HTMLCanvasElement): void;
|
|
19
|
+
compositeAllLayers(): void;
|
|
20
|
+
renderSliceToCanvas(layer: string, axis: "x" | "y" | "z", sliceIndex: number, buffer: ImageData, targetCtx: CanvasRenderingContext2D, scaledWidth: number, scaledHeight: number): void;
|
|
21
|
+
getOrCreateSliceBuffer(axis: "x" | "y" | "z"): ImageData | null;
|
|
22
|
+
flipDisplayImageByAxis(): void;
|
|
23
|
+
redrawDisplayCanvas(): void;
|
|
24
|
+
refreshSphereOverlay(): void;
|
|
25
|
+
reloadMasksFromVolume(): void;
|
|
26
|
+
getVolumeForLayer(layer: string): MaskVolume;
|
|
27
|
+
setIsDrawFalse(target: number): void;
|
|
28
|
+
setSyncsliceNum(): void;
|
|
29
|
+
resetPaintAreaUIPosition(l?: number, t?: number): void;
|
|
30
|
+
resizePaintArea(moveDistance: number): void;
|
|
31
|
+
resetZoom(): void;
|
|
32
|
+
invalidateSliceBuffer(): void;
|
|
33
|
+
clearUndoHistory(): void;
|
|
34
|
+
setCurrentLayer(): {
|
|
35
|
+
ctx: CanvasRenderingContext2D;
|
|
36
|
+
canvas: HTMLCanvasElement;
|
|
37
|
+
};
|
|
38
|
+
syncLayerSliceData(index: number, layer: string): void;
|
|
39
|
+
filterDrawedImage(axis: "x" | "y" | "z", index: number): {
|
|
40
|
+
image: ImageData;
|
|
41
|
+
} | undefined;
|
|
42
|
+
pushUndoDelta(delta: MaskDelta): void;
|
|
43
|
+
getEraserUrls(): string[];
|
|
44
|
+
enableCrosshair(): void;
|
|
45
|
+
setUpSphereOrigins(mouseX: number, mouseY: number, sliceIndex: number): void;
|
|
46
|
+
zoomActionAfterDrawSphere(): void;
|
|
47
|
+
setDisplaySlicesBaseOnAxis(): void;
|
|
48
|
+
afterLoadSlice(): void;
|
|
49
|
+
syncGuiParameterSettings(): void;
|
|
50
|
+
repraintCurrentContrastSlice(): void;
|
|
51
|
+
updateShowNumDiv(contrastNum: number): void;
|
|
52
|
+
updateCurrentContrastSlice(): void;
|
|
53
|
+
onChannelColorChanged(layerId: string, channel: number, color: RGBAColor): void;
|
|
54
|
+
}
|
|
55
|
+
/** ImageStoreHelper host dependencies */
|
|
56
|
+
export type ImageStoreHostDeps = Pick<ToolHost, 'setEmptyCanvasSize' | 'drawImageOnEmptyImage'>;
|
|
57
|
+
/** PanTool host dependencies */
|
|
58
|
+
export type PanHostDeps = Pick<ToolHost, 'zoomActionAfterDrawSphere'>;
|
|
59
|
+
/** ContrastTool host dependencies */
|
|
60
|
+
export type ContrastHostDeps = Pick<ToolHost, 'setIsDrawFalse' | 'setSyncsliceNum'>;
|
|
61
|
+
/** ZoomTool host dependencies */
|
|
62
|
+
export type ZoomHostDeps = Pick<ToolHost, 'resetPaintAreaUIPosition' | 'resizePaintArea' | 'setIsDrawFalse'>;
|
|
63
|
+
/** SphereTool host dependencies */
|
|
64
|
+
export type SphereHostDeps = Pick<ToolHost, 'setEmptyCanvasSize' | 'drawImageOnEmptyImage' | 'enableCrosshair' | 'setUpSphereOrigins'>;
|
|
65
|
+
/** DrawingTool host dependencies */
|
|
66
|
+
export type DrawingHostDeps = Pick<ToolHost, 'setCurrentLayer' | 'compositeAllLayers' | 'syncLayerSliceData' | 'filterDrawedImage' | 'getVolumeForLayer' | 'pushUndoDelta' | 'getEraserUrls'>;
|
|
67
|
+
/** DragSliceTool host dependencies */
|
|
68
|
+
export type DragSliceHostDeps = Pick<ToolHost, 'setSyncsliceNum' | 'setIsDrawFalse' | 'flipDisplayImageByAxis' | 'setEmptyCanvasSize' | 'getOrCreateSliceBuffer' | 'renderSliceToCanvas' | 'refreshSphereOverlay'>;
|
|
69
|
+
/** LayerChannelManager host dependencies */
|
|
70
|
+
export type LayerChannelHostDeps = Pick<ToolHost, 'reloadMasksFromVolume' | 'getVolumeForLayer' | 'onChannelColorChanged'>;
|
|
71
|
+
/** SliceRenderPipeline host dependencies */
|
|
72
|
+
export type SliceRenderHostDeps = Pick<ToolHost, 'compositeAllLayers' | 'getOrCreateSliceBuffer' | 'renderSliceToCanvas' | 'getVolumeForLayer' | 'refreshSphereOverlay' | 'syncGuiParameterSettings' | 'repraintCurrentContrastSlice' | 'clearUndoHistory' | 'updateShowNumDiv' | 'updateCurrentContrastSlice'>;
|
|
73
|
+
/** DataLoader host dependencies */
|
|
74
|
+
export type DataLoaderHostDeps = Pick<ToolHost, 'invalidateSliceBuffer' | 'setDisplaySlicesBaseOnAxis' | 'afterLoadSlice' | 'setEmptyCanvasSize' | 'syncLayerSliceData' | 'reloadMasksFromVolume' | 'resetZoom'>;
|