copper3d 3.3.2 → 3.4.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/dist/Utils/segmentation/DrawToolCore.js +20 -3
- package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
- package/dist/Utils/segmentation/NrrdTools.d.ts +19 -0
- package/dist/Utils/segmentation/NrrdTools.js +40 -0
- package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
- package/dist/Utils/segmentation/RenderingUtils.d.ts +9 -3
- package/dist/Utils/segmentation/RenderingUtils.js +35 -15
- package/dist/Utils/segmentation/RenderingUtils.js.map +1 -1
- package/dist/Utils/segmentation/core/MarchingSquares.d.ts +72 -0
- package/dist/Utils/segmentation/core/MarchingSquares.js +169 -0
- package/dist/Utils/segmentation/core/MarchingSquares.js.map +1 -0
- package/dist/Utils/segmentation/core/index.d.ts +2 -0
- package/dist/Utils/segmentation/core/index.js +1 -0
- package/dist/Utils/segmentation/core/index.js.map +1 -1
- package/dist/Utils/segmentation/eventRouter/EventRouter.js +14 -7
- package/dist/Utils/segmentation/eventRouter/EventRouter.js.map +1 -1
- package/dist/Utils/segmentation/tools/DrawingTool.d.ts +35 -10
- package/dist/Utils/segmentation/tools/DrawingTool.js +247 -36
- package/dist/Utils/segmentation/tools/DrawingTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/SphereBrushTool.d.ts +83 -6
- package/dist/Utils/segmentation/tools/SphereBrushTool.js +283 -68
- package/dist/Utils/segmentation/tools/SphereBrushTool.js.map +1 -1
- package/dist/Utils/segmentation/tools/ToolHost.d.ts +1 -1
- package/dist/bundle.esm.js +808 -130
- package/dist/bundle.umd.js +808 -130
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types/Utils/segmentation/NrrdTools.d.ts +19 -0
- package/dist/types/Utils/segmentation/RenderingUtils.d.ts +9 -3
- package/dist/types/Utils/segmentation/core/MarchingSquares.d.ts +72 -0
- package/dist/types/Utils/segmentation/core/index.d.ts +2 -0
- package/dist/types/Utils/segmentation/tools/DrawingTool.d.ts +35 -10
- package/dist/types/Utils/segmentation/tools/SphereBrushTool.d.ts +83 -6
- package/dist/types/Utils/segmentation/tools/ToolHost.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarchingSquares — Extract vector contours from a 2D voxel label grid.
|
|
3
|
+
*
|
|
4
|
+
* For each label, produces a `Path2D` whose subpaths are small per-cell
|
|
5
|
+
* polygons. The polygons tile the region occupied by the target label; the
|
|
6
|
+
* union (via `ctx.fill(path, 'nonzero')`) is the label's silhouette on the
|
|
7
|
+
* voxel grid.
|
|
8
|
+
*
|
|
9
|
+
* Coordinate convention:
|
|
10
|
+
* - Voxel (i, j) occupies the unit square [i, i+1] × [j, j+1] in render
|
|
11
|
+
* space, with its center at (i+0.5, j+0.5). This matches ITK-SNAP /
|
|
12
|
+
* standard imaging viewers and the existing `renderSliceToCanvas`
|
|
13
|
+
* `scale(scaledW / W, scaledH / H)` mapping.
|
|
14
|
+
* - Marching squares treats voxels as point samples at their centers:
|
|
15
|
+
* cell (i, j) has corners at voxel centers (i+0.5, j+0.5),
|
|
16
|
+
* (i+1.5, j+0.5), (i+1.5, j+1.5), (i+0.5, j+1.5).
|
|
17
|
+
* - This produces 45°-cut contours (diamonds for isolated voxels, rounded
|
|
18
|
+
* corners for connected regions) that stay within the voxel-square
|
|
19
|
+
* bounds, so the rendered silhouette is a slightly-inset version of the
|
|
20
|
+
* ITK-SNAP silhouette with smooth diagonals.
|
|
21
|
+
*
|
|
22
|
+
* Saddle cases (5 and 10) use a fixed convention: the two in-corners are
|
|
23
|
+
* treated as disconnected within the cell (4-connectivity interpretation).
|
|
24
|
+
*/
|
|
25
|
+
export interface ContourBBox {
|
|
26
|
+
/** Inclusive left voxel (0 ≤ x0 ≤ width). */
|
|
27
|
+
x0: number;
|
|
28
|
+
/** Inclusive top voxel (0 ≤ y0 ≤ height). */
|
|
29
|
+
y0: number;
|
|
30
|
+
/** Exclusive right voxel (x1 > x0). */
|
|
31
|
+
x1: number;
|
|
32
|
+
/** Exclusive bottom voxel (y1 > y0). */
|
|
33
|
+
y1: number;
|
|
34
|
+
}
|
|
35
|
+
/** A single polygon's vertices in voxel-space coordinates. */
|
|
36
|
+
export type ContourPolygon = ReadonlyArray<readonly [number, number]>;
|
|
37
|
+
/**
|
|
38
|
+
* Emit all per-cell polygons covering the voxels where `labels === targetLabel`.
|
|
39
|
+
* Pure geometry function — no Canvas dependency. Consumers can build a Path2D
|
|
40
|
+
* (see {@link extractLabelContours}) or walk the vertex arrays directly
|
|
41
|
+
* (tests, export, stroke rendering).
|
|
42
|
+
*/
|
|
43
|
+
export declare function extractLabelPolygons(labels: Uint8Array, width: number, height: number, targetLabel: number, stride?: number, channelOffset?: number, bbox?: ContourBBox): ContourPolygon[];
|
|
44
|
+
/**
|
|
45
|
+
* Extract a `Path2D` covering all voxels equal to `targetLabel`.
|
|
46
|
+
*
|
|
47
|
+
* @param labels Flat label array. Addressed as
|
|
48
|
+
* `labels[(y * width + x) * stride + channelOffset]`.
|
|
49
|
+
* @param width Grid width in voxels.
|
|
50
|
+
* @param height Grid height in voxels.
|
|
51
|
+
* @param targetLabel Label value to extract (1..255; 0 is background).
|
|
52
|
+
* @param stride Bytes per voxel (default 1). Use MaskVolume.numChannels
|
|
53
|
+
* when reading interleaved slices.
|
|
54
|
+
* @param channelOffset Offset within each voxel's channels to sample.
|
|
55
|
+
* Default 0 (first channel = label id).
|
|
56
|
+
* @param bbox Optional voxel-space bbox to limit extraction.
|
|
57
|
+
* Cells in a 1-voxel halo around the bbox are still
|
|
58
|
+
* visited so the contour closes correctly at the bbox edges.
|
|
59
|
+
*/
|
|
60
|
+
export declare function extractLabelContours(labels: Uint8Array, width: number, height: number, targetLabel: number, stride?: number, channelOffset?: number, bbox?: ContourBBox): Path2D;
|
|
61
|
+
/**
|
|
62
|
+
* Detect the distinct non-zero labels present in a slice region.
|
|
63
|
+
*
|
|
64
|
+
* @param labels Flat label array (see {@link extractLabelContours}).
|
|
65
|
+
* @param width Grid width.
|
|
66
|
+
* @param height Grid height.
|
|
67
|
+
* @param stride Bytes per voxel.
|
|
68
|
+
* @param channelOffset Offset within each voxel.
|
|
69
|
+
* @param bbox Optional region to scan (defaults to full grid).
|
|
70
|
+
* @returns Sorted array of distinct label values (0 omitted).
|
|
71
|
+
*/
|
|
72
|
+
export declare function findLabelsInSlice(labels: Uint8Array, width: number, height: number, stride?: number, channelOffset?: number, bbox?: ContourBBox): number[];
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarchingSquares — Extract vector contours from a 2D voxel label grid.
|
|
3
|
+
*
|
|
4
|
+
* For each label, produces a `Path2D` whose subpaths are small per-cell
|
|
5
|
+
* polygons. The polygons tile the region occupied by the target label; the
|
|
6
|
+
* union (via `ctx.fill(path, 'nonzero')`) is the label's silhouette on the
|
|
7
|
+
* voxel grid.
|
|
8
|
+
*
|
|
9
|
+
* Coordinate convention:
|
|
10
|
+
* - Voxel (i, j) occupies the unit square [i, i+1] × [j, j+1] in render
|
|
11
|
+
* space, with its center at (i+0.5, j+0.5). This matches ITK-SNAP /
|
|
12
|
+
* standard imaging viewers and the existing `renderSliceToCanvas`
|
|
13
|
+
* `scale(scaledW / W, scaledH / H)` mapping.
|
|
14
|
+
* - Marching squares treats voxels as point samples at their centers:
|
|
15
|
+
* cell (i, j) has corners at voxel centers (i+0.5, j+0.5),
|
|
16
|
+
* (i+1.5, j+0.5), (i+1.5, j+1.5), (i+0.5, j+1.5).
|
|
17
|
+
* - This produces 45°-cut contours (diamonds for isolated voxels, rounded
|
|
18
|
+
* corners for connected regions) that stay within the voxel-square
|
|
19
|
+
* bounds, so the rendered silhouette is a slightly-inset version of the
|
|
20
|
+
* ITK-SNAP silhouette with smooth diagonals.
|
|
21
|
+
*
|
|
22
|
+
* Saddle cases (5 and 10) use a fixed convention: the two in-corners are
|
|
23
|
+
* treated as disconnected within the cell (4-connectivity interpretation).
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Per-cell polygon lookup for the 16 marching-squares cases.
|
|
27
|
+
*
|
|
28
|
+
* Corner bit layout: TL=8, TR=4, BR=2, BL=1
|
|
29
|
+
*
|
|
30
|
+
* Coordinates are within the unit cell, 0 ≤ x ≤ 1, 0 ≤ y ≤ 1,
|
|
31
|
+
* where (0, 0) is the TL corner of the cell. Add (i, j) to get absolute.
|
|
32
|
+
*
|
|
33
|
+
* Each case may emit 0, 1, or 2 polygons (saddles → 2).
|
|
34
|
+
* Polygon vertices are listed in a CCW order in screen space (y-down),
|
|
35
|
+
* which corresponds to CW in math coords. Path2D `fill(nonzero)` handles
|
|
36
|
+
* this consistently.
|
|
37
|
+
*/
|
|
38
|
+
const CELL_POLYGONS = [
|
|
39
|
+
/* 0 (empty) */ [],
|
|
40
|
+
/* 1 (BL) */ [[[0, 0.5], [0.5, 1], [0, 1]]],
|
|
41
|
+
/* 2 (BR) */ [[[0.5, 1], [1, 0.5], [1, 1]]],
|
|
42
|
+
/* 3 (BR+BL) */ [[[0, 0.5], [1, 0.5], [1, 1], [0, 1]]],
|
|
43
|
+
/* 4 (TR) */ [[[0.5, 0], [1, 0], [1, 0.5]]],
|
|
44
|
+
/* 5 (TR+BL saddle) */ [
|
|
45
|
+
[[0.5, 0], [1, 0], [1, 0.5]],
|
|
46
|
+
[[0, 0.5], [0.5, 1], [0, 1]],
|
|
47
|
+
],
|
|
48
|
+
/* 6 (TR+BR) */ [[[0.5, 0], [1, 0], [1, 1], [0.5, 1]]],
|
|
49
|
+
/* 7 (TR+BR+BL, !TL) */ [[[0.5, 0], [1, 0], [1, 1], [0, 1], [0, 0.5]]],
|
|
50
|
+
/* 8 (TL) */ [[[0, 0], [0.5, 0], [0, 0.5]]],
|
|
51
|
+
/* 9 (TL+BL) */ [[[0, 0], [0.5, 0], [0.5, 1], [0, 1]]],
|
|
52
|
+
/* 10 (TL+BR saddle) */ [
|
|
53
|
+
[[0, 0], [0.5, 0], [0, 0.5]],
|
|
54
|
+
[[0.5, 1], [1, 0.5], [1, 1]],
|
|
55
|
+
],
|
|
56
|
+
/* 11 (TL+BR+BL, !TR) */ [[[0, 0], [0.5, 0], [1, 0.5], [1, 1], [0, 1]]],
|
|
57
|
+
/* 12 (TL+TR) */ [[[0, 0], [1, 0], [1, 0.5], [0, 0.5]]],
|
|
58
|
+
/* 13 (TL+TR+BL, !BR) */ [[[0, 0], [1, 0], [1, 0.5], [0.5, 1], [0, 1]]],
|
|
59
|
+
/* 14 (TL+TR+BR, !BL) */ [[[0, 0], [1, 0], [1, 1], [0.5, 1], [0, 0.5]]],
|
|
60
|
+
/* 15 (full) */ [[[0, 0], [1, 0], [1, 1], [0, 1]]],
|
|
61
|
+
];
|
|
62
|
+
/**
|
|
63
|
+
* Emit all per-cell polygons covering the voxels where `labels === targetLabel`.
|
|
64
|
+
* Pure geometry function — no Canvas dependency. Consumers can build a Path2D
|
|
65
|
+
* (see {@link extractLabelContours}) or walk the vertex arrays directly
|
|
66
|
+
* (tests, export, stroke rendering).
|
|
67
|
+
*/
|
|
68
|
+
export function extractLabelPolygons(labels, width, height, targetLabel, stride = 1, channelOffset = 0, bbox) {
|
|
69
|
+
var _a, _b, _c, _d;
|
|
70
|
+
const out = [];
|
|
71
|
+
const cx0 = ((_a = bbox === null || bbox === void 0 ? void 0 : bbox.x0) !== null && _a !== void 0 ? _a : 0) - 1;
|
|
72
|
+
const cy0 = ((_b = bbox === null || bbox === void 0 ? void 0 : bbox.y0) !== null && _b !== void 0 ? _b : 0) - 1;
|
|
73
|
+
const cx1 = (_c = bbox === null || bbox === void 0 ? void 0 : bbox.x1) !== null && _c !== void 0 ? _c : width;
|
|
74
|
+
const cy1 = (_d = bbox === null || bbox === void 0 ? void 0 : bbox.y1) !== null && _d !== void 0 ? _d : height;
|
|
75
|
+
const i0 = Math.max(-1, cx0);
|
|
76
|
+
const j0 = Math.max(-1, cy0);
|
|
77
|
+
const i1 = Math.min(width, cx1);
|
|
78
|
+
const j1 = Math.min(height, cy1);
|
|
79
|
+
const sample = (x, y) => {
|
|
80
|
+
if (x < 0 || x >= width || y < 0 || y >= height)
|
|
81
|
+
return false;
|
|
82
|
+
return labels[(y * width + x) * stride + channelOffset] === targetLabel;
|
|
83
|
+
};
|
|
84
|
+
// Shift output by +0.5 so that marching-squares samples (voxel positions)
|
|
85
|
+
// map to voxel-square CENTERS in render space. Voxel (i, j) occupies
|
|
86
|
+
// render square [i, i+1] × [j, j+1]; its center is (i+0.5, j+0.5).
|
|
87
|
+
const SHIFT = 0.5;
|
|
88
|
+
for (let j = j0; j < j1; j++) {
|
|
89
|
+
for (let i = i0; i < i1; i++) {
|
|
90
|
+
const tl = sample(i, j);
|
|
91
|
+
const tr = sample(i + 1, j);
|
|
92
|
+
const br = sample(i + 1, j + 1);
|
|
93
|
+
const bl = sample(i, j + 1);
|
|
94
|
+
const code = (tl ? 8 : 0) |
|
|
95
|
+
(tr ? 4 : 0) |
|
|
96
|
+
(br ? 2 : 0) |
|
|
97
|
+
(bl ? 1 : 0);
|
|
98
|
+
if (code === 0)
|
|
99
|
+
continue;
|
|
100
|
+
const polygons = CELL_POLYGONS[code];
|
|
101
|
+
for (let p = 0; p < polygons.length; p++) {
|
|
102
|
+
const poly = polygons[p];
|
|
103
|
+
const abs = new Array(poly.length);
|
|
104
|
+
for (let k = 0; k < poly.length; k++) {
|
|
105
|
+
abs[k] = [i + poly[k][0] + SHIFT, j + poly[k][1] + SHIFT];
|
|
106
|
+
}
|
|
107
|
+
out.push(abs);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Extract a `Path2D` covering all voxels equal to `targetLabel`.
|
|
115
|
+
*
|
|
116
|
+
* @param labels Flat label array. Addressed as
|
|
117
|
+
* `labels[(y * width + x) * stride + channelOffset]`.
|
|
118
|
+
* @param width Grid width in voxels.
|
|
119
|
+
* @param height Grid height in voxels.
|
|
120
|
+
* @param targetLabel Label value to extract (1..255; 0 is background).
|
|
121
|
+
* @param stride Bytes per voxel (default 1). Use MaskVolume.numChannels
|
|
122
|
+
* when reading interleaved slices.
|
|
123
|
+
* @param channelOffset Offset within each voxel's channels to sample.
|
|
124
|
+
* Default 0 (first channel = label id).
|
|
125
|
+
* @param bbox Optional voxel-space bbox to limit extraction.
|
|
126
|
+
* Cells in a 1-voxel halo around the bbox are still
|
|
127
|
+
* visited so the contour closes correctly at the bbox edges.
|
|
128
|
+
*/
|
|
129
|
+
export function extractLabelContours(labels, width, height, targetLabel, stride = 1, channelOffset = 0, bbox) {
|
|
130
|
+
const polygons = extractLabelPolygons(labels, width, height, targetLabel, stride, channelOffset, bbox);
|
|
131
|
+
const path = new Path2D();
|
|
132
|
+
for (let p = 0; p < polygons.length; p++) {
|
|
133
|
+
const poly = polygons[p];
|
|
134
|
+
path.moveTo(poly[0][0], poly[0][1]);
|
|
135
|
+
for (let k = 1; k < poly.length; k++) {
|
|
136
|
+
path.lineTo(poly[k][0], poly[k][1]);
|
|
137
|
+
}
|
|
138
|
+
path.closePath();
|
|
139
|
+
}
|
|
140
|
+
return path;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Detect the distinct non-zero labels present in a slice region.
|
|
144
|
+
*
|
|
145
|
+
* @param labels Flat label array (see {@link extractLabelContours}).
|
|
146
|
+
* @param width Grid width.
|
|
147
|
+
* @param height Grid height.
|
|
148
|
+
* @param stride Bytes per voxel.
|
|
149
|
+
* @param channelOffset Offset within each voxel.
|
|
150
|
+
* @param bbox Optional region to scan (defaults to full grid).
|
|
151
|
+
* @returns Sorted array of distinct label values (0 omitted).
|
|
152
|
+
*/
|
|
153
|
+
export function findLabelsInSlice(labels, width, height, stride = 1, channelOffset = 0, bbox) {
|
|
154
|
+
var _a, _b, _c, _d;
|
|
155
|
+
const x0 = (_a = bbox === null || bbox === void 0 ? void 0 : bbox.x0) !== null && _a !== void 0 ? _a : 0;
|
|
156
|
+
const y0 = (_b = bbox === null || bbox === void 0 ? void 0 : bbox.y0) !== null && _b !== void 0 ? _b : 0;
|
|
157
|
+
const x1 = (_c = bbox === null || bbox === void 0 ? void 0 : bbox.x1) !== null && _c !== void 0 ? _c : width;
|
|
158
|
+
const y1 = (_d = bbox === null || bbox === void 0 ? void 0 : bbox.y1) !== null && _d !== void 0 ? _d : height;
|
|
159
|
+
const seen = new Set();
|
|
160
|
+
for (let y = y0; y < y1; y++) {
|
|
161
|
+
for (let x = x0; x < x1; x++) {
|
|
162
|
+
const v = labels[(y * width + x) * stride + channelOffset];
|
|
163
|
+
if (v !== 0)
|
|
164
|
+
seen.add(v);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return Array.from(seen).sort((a, b) => a - b);
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=MarchingSquares.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarchingSquares.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/MarchingSquares.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH;;;;;;;;;;;;GAYG;AACH,MAAM,aAAa,GAAqC;IACtD,gBAAgB,CAAc,EAAE;IAChC,gBAAgB,CAAc,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5D,gBAAgB,CAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5D,gBAAgB,CAAc,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,C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E,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -72,3 +72,5 @@ export { RenderMode, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLOR
|
|
|
72
72
|
export { MaskVolume } from './MaskVolume';
|
|
73
73
|
export type { MaskDelta, UndoEntry } from './UndoManager';
|
|
74
74
|
export { UndoManager } from './UndoManager';
|
|
75
|
+
export type { ContourBBox, ContourPolygon } from './MarchingSquares';
|
|
76
|
+
export { extractLabelContours, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
|
|
@@ -71,4 +71,5 @@ export { RenderMode, MASK_CHANNEL_COLORS, MASK_CHANNEL_CSS_COLORS, CHANNEL_COLOR
|
|
|
71
71
|
// ── Core volume ────────────────────────────────────────────────────────────
|
|
72
72
|
export { MaskVolume } from './MaskVolume';
|
|
73
73
|
export { UndoManager } from './UndoManager';
|
|
74
|
+
export { extractLabelContours, extractLabelPolygons, findLabelsInSlice, } from './MarchingSquares';
|
|
74
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AA8CH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,8EAA8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AA8CH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,8EAA8E;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
|
|
@@ -26,6 +26,11 @@ const DEFAULT_KEYBOARD_SETTINGS = {
|
|
|
26
26
|
* Drawing tools that can be used with Shift+drag
|
|
27
27
|
*/
|
|
28
28
|
const DRAWING_TOOLS = new Set(['pencil', 'brush', 'eraser']);
|
|
29
|
+
/**
|
|
30
|
+
* Sphere-family tools (single-placement sphere + brush/eraser variants).
|
|
31
|
+
* All three participate in the same crosshair / contrast mutual-exclusion rules.
|
|
32
|
+
*/
|
|
33
|
+
const SPHERE_TOOLS = new Set(['sphere', 'sphereBrush', 'sphereEraser']);
|
|
29
34
|
export class EventRouter {
|
|
30
35
|
constructor(config) {
|
|
31
36
|
// === State ===
|
|
@@ -156,8 +161,8 @@ export class EventRouter {
|
|
|
156
161
|
*/
|
|
157
162
|
setGuiTool(tool) {
|
|
158
163
|
this.guiTool = tool;
|
|
159
|
-
// When entering sphere
|
|
160
|
-
if (tool
|
|
164
|
+
// When entering any sphere-family tool, keep crosshair if active, otherwise idle
|
|
165
|
+
if (SPHERE_TOOLS.has(tool)) {
|
|
161
166
|
if (!this.state.crosshairEnabled) {
|
|
162
167
|
this.setMode('idle');
|
|
163
168
|
}
|
|
@@ -169,10 +174,12 @@ export class EventRouter {
|
|
|
169
174
|
* Blocked when draw or contrast mode is active, or left button is held (mutual exclusion).
|
|
170
175
|
*/
|
|
171
176
|
toggleCrosshair() {
|
|
172
|
-
// Allow crosshair in drawing tools and sphere
|
|
173
|
-
if (!DRAWING_TOOLS.has(this.guiTool) && this.guiTool
|
|
177
|
+
// Allow crosshair in drawing tools and all sphere-family tools (sphere / sphereBrush / sphereEraser)
|
|
178
|
+
if (!DRAWING_TOOLS.has(this.guiTool) && !SPHERE_TOOLS.has(this.guiTool))
|
|
174
179
|
return;
|
|
175
|
-
// Block crosshair activation during draw, contrast, or while left button held
|
|
180
|
+
// Block crosshair activation during draw, contrast, or while left button held.
|
|
181
|
+
// The leftButtonDown guard also enforces "once a sphere preview is on screen,
|
|
182
|
+
// S is ignored until mouseup" for sphereBrush/sphereEraser.
|
|
176
183
|
if (this.state.shiftHeld || this.state.leftButtonDown || this.mode === 'draw' || this.mode === 'contrast')
|
|
177
184
|
return;
|
|
178
185
|
this.state.crosshairEnabled = !this.state.crosshairEnabled;
|
|
@@ -299,9 +306,9 @@ export class EventRouter {
|
|
|
299
306
|
}
|
|
300
307
|
}
|
|
301
308
|
if (this.contrastEnabled && this.keyboardSettings.contrast.includes(ev.key)) {
|
|
302
|
-
// Block contrast state when crosshair, draw, or sphere is active (mutual exclusion)
|
|
309
|
+
// Block contrast state when crosshair, draw, or any sphere-family tool is active (mutual exclusion)
|
|
303
310
|
if (!this.state.crosshairEnabled && this.mode !== 'draw'
|
|
304
|
-
&& this.guiTool
|
|
311
|
+
&& !SPHERE_TOOLS.has(this.guiTool)) {
|
|
305
312
|
this.state.ctrlHeld = true;
|
|
306
313
|
}
|
|
307
314
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventRouter.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/eventRouter/EventRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAcH;;GAEG;AACH,MAAM,yBAAyB,GAAqB;IAChD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;IAC7B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,mBAAmB,EAAE;YAC1B,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;SAChC;IACL,CAAC;IAEO,WAAW,CAAC,EAAc;QAC9B,4BAA4B;QAC5B,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;SACzB;IACL,CAAC;CACJ"}
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* Extracted from DrawToolCore.paintOnCanvas() closure (Phase 3).
|
|
5
5
|
* Handles left-click drawing operations: pencil stroke + fill, brush strokes,
|
|
6
6
|
* eraser, and undo snapshot capture/push.
|
|
7
|
+
*
|
|
8
|
+
* Phase B: Brush mode now writes voxels directly during mousemove and
|
|
9
|
+
* re-renders via marching squares, eliminating the visual "snap" between
|
|
10
|
+
* the smooth canvas stroke and the voxel-based post-release render.
|
|
7
11
|
*/
|
|
8
12
|
import { BaseTool } from "./BaseTool";
|
|
9
13
|
import type { ToolContext } from "./BaseTool";
|
|
@@ -21,6 +25,8 @@ export declare class DrawingTool extends BaseTool {
|
|
|
21
25
|
private preDrawSlice;
|
|
22
26
|
private preDrawAxis;
|
|
23
27
|
private preDrawSliceIndex;
|
|
28
|
+
/** Previous voxel-space position for Bresenham interpolation (brush mode) */
|
|
29
|
+
private prevVoxel;
|
|
24
30
|
private callbacks;
|
|
25
31
|
constructor(ctx: ToolContext, callbacks: DrawingHostDeps);
|
|
26
32
|
/** Whether a draw operation is currently active */
|
|
@@ -56,30 +62,49 @@ export declare class DrawingTool extends BaseTool {
|
|
|
56
62
|
/**
|
|
57
63
|
* Create a self-managing mouseover/mouseout/mousemove handler
|
|
58
64
|
* 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
|
*/
|
|
65
66
|
createBrushTrackingHandler(): (e: MouseEvent) => void;
|
|
66
67
|
/**
|
|
67
68
|
* 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
69
|
*/
|
|
71
70
|
renderBrushPreview(ctx: CanvasRenderingContext2D, width: number, height: number): void;
|
|
71
|
+
/**
|
|
72
|
+
* Convert display (zoomed) coordinates to 3D voxel coordinates.
|
|
73
|
+
* Same logic as SphereBrushTool.canvasToVoxelCenter.
|
|
74
|
+
*/
|
|
75
|
+
private canvasToVoxel3D;
|
|
76
|
+
/**
|
|
77
|
+
* Get voxel-space brush radius for visible axes.
|
|
78
|
+
* Converts display-pixel brush size to voxel units.
|
|
79
|
+
*/
|
|
80
|
+
private getVoxelBrushRadius;
|
|
81
|
+
/**
|
|
82
|
+
* Paint a 2D ellipse of voxels on the current slice.
|
|
83
|
+
* Only the two visible axes are iterated; the slice-direction axis is fixed.
|
|
84
|
+
*/
|
|
85
|
+
private paintVoxelEllipse;
|
|
86
|
+
/**
|
|
87
|
+
* Brush mode mousemove: write voxels along stroke segment, then re-render.
|
|
88
|
+
* Uses linear interpolation between prev and current positions to ensure
|
|
89
|
+
* no gaps when the mouse moves fast.
|
|
90
|
+
*/
|
|
91
|
+
private paintBrushVoxelMove;
|
|
92
|
+
/**
|
|
93
|
+
* Re-render the active layer's canvas from MaskVolume via marching squares,
|
|
94
|
+
* then composite all layers to master.
|
|
95
|
+
*/
|
|
96
|
+
private refreshLayerFromVolume;
|
|
72
97
|
/** Capture pre-draw slice snapshot for undo */
|
|
73
98
|
private capturePreDrawSnapshot;
|
|
74
99
|
/** Push delta to UndoManager after drawing completes */
|
|
75
100
|
private pushUndoDelta;
|
|
76
101
|
/**
|
|
77
102
|
* Redraws persisted layer data onto ctx before new pencil fill.
|
|
78
|
-
*
|
|
103
|
+
* Delegates to the host's vector renderSliceToCanvas for consistency.
|
|
79
104
|
*/
|
|
80
105
|
private redrawPreviousImageToLayerCtx;
|
|
81
|
-
/** Draw a line segment on a layer canvas */
|
|
106
|
+
/** Draw a line segment on a layer canvas (pencil mode only) */
|
|
82
107
|
private drawLinesOnLayer;
|
|
83
|
-
/** Paint a segment on the current layer canvas and composite to master */
|
|
108
|
+
/** Paint a segment on the current layer canvas and composite to master (pencil mode) */
|
|
84
109
|
private paintOnCanvasLayer;
|
|
85
110
|
}
|