copper3d 3.0.2 → 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.
Files changed (104) hide show
  1. package/README.md +183 -1028
  2. package/dist/Utils/segmentation/CanvasState.d.ts +31 -0
  3. package/dist/Utils/segmentation/CanvasState.js +167 -0
  4. package/dist/Utils/segmentation/CanvasState.js.map +1 -0
  5. package/dist/Utils/segmentation/DragOperator.d.ts +1 -1
  6. package/dist/Utils/segmentation/DragOperator.js +2 -4
  7. package/dist/Utils/segmentation/DragOperator.js.map +1 -1
  8. package/dist/Utils/segmentation/DrawToolCore.d.ts +49 -27
  9. package/dist/Utils/segmentation/DrawToolCore.js +275 -344
  10. package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
  11. package/dist/Utils/segmentation/NrrdTools.d.ts +89 -467
  12. package/dist/Utils/segmentation/NrrdTools.js +479 -1335
  13. package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
  14. package/dist/Utils/segmentation/RenderingUtils.d.ts +73 -0
  15. package/dist/Utils/segmentation/RenderingUtils.js +180 -0
  16. package/dist/Utils/segmentation/RenderingUtils.js.map +1 -0
  17. package/dist/Utils/segmentation/core/MaskVolume.d.ts +1 -1
  18. package/dist/Utils/segmentation/core/MaskVolume.js +1 -1
  19. package/dist/Utils/segmentation/core/index.d.ts +1 -1
  20. package/dist/Utils/segmentation/core/index.js.map +1 -1
  21. package/dist/Utils/segmentation/core/types.d.ts +384 -0
  22. package/dist/Utils/segmentation/core/types.js +1 -0
  23. package/dist/Utils/segmentation/core/types.js.map +1 -1
  24. package/dist/Utils/segmentation/coreTools/GuiState.d.ts +1 -1
  25. package/dist/Utils/segmentation/coreTools/NrrdState.d.ts +1 -1
  26. package/dist/Utils/segmentation/coreTools/divControlTools.d.ts +1 -1
  27. package/dist/Utils/segmentation/coreTools/gui.d.ts +1 -1
  28. package/dist/Utils/segmentation/tools/BaseTool.d.ts +1 -1
  29. package/dist/Utils/segmentation/tools/ContrastTool.d.ts +3 -6
  30. package/dist/Utils/segmentation/tools/ContrastTool.js.map +1 -1
  31. package/dist/Utils/segmentation/tools/CrosshairTool.d.ts +11 -1
  32. package/dist/Utils/segmentation/tools/CrosshairTool.js +25 -0
  33. package/dist/Utils/segmentation/tools/CrosshairTool.js.map +1 -1
  34. package/dist/Utils/segmentation/tools/DataLoader.d.ts +33 -0
  35. package/dist/Utils/segmentation/tools/DataLoader.js +159 -0
  36. package/dist/Utils/segmentation/tools/DataLoader.js.map +1 -0
  37. package/dist/Utils/segmentation/tools/DragSliceTool.d.ts +3 -12
  38. package/dist/Utils/segmentation/tools/DragSliceTool.js.map +1 -1
  39. package/dist/Utils/segmentation/tools/DrawingTool.d.ts +18 -26
  40. package/dist/Utils/segmentation/tools/DrawingTool.js +48 -0
  41. package/dist/Utils/segmentation/tools/DrawingTool.js.map +1 -1
  42. package/dist/Utils/segmentation/tools/ImageStoreHelper.d.ts +2 -5
  43. package/dist/Utils/segmentation/tools/ImageStoreHelper.js.map +1 -1
  44. package/dist/Utils/segmentation/tools/LayerChannelManager.d.ts +52 -0
  45. package/dist/Utils/segmentation/tools/LayerChannelManager.js +175 -0
  46. package/dist/Utils/segmentation/tools/LayerChannelManager.js.map +1 -0
  47. package/dist/Utils/segmentation/tools/PanTool.d.ts +2 -8
  48. package/dist/Utils/segmentation/tools/PanTool.js.map +1 -1
  49. package/dist/Utils/segmentation/tools/SliceRenderPipeline.d.ts +80 -0
  50. package/dist/Utils/segmentation/tools/SliceRenderPipeline.js +355 -0
  51. package/dist/Utils/segmentation/tools/SliceRenderPipeline.js.map +1 -0
  52. package/dist/Utils/segmentation/tools/SphereTool.d.ts +25 -19
  53. package/dist/Utils/segmentation/tools/SphereTool.js +61 -7
  54. package/dist/Utils/segmentation/tools/SphereTool.js.map +1 -1
  55. package/dist/Utils/segmentation/tools/ToolHost.d.ts +74 -0
  56. package/dist/Utils/segmentation/tools/ToolHost.js +10 -0
  57. package/dist/Utils/segmentation/tools/ToolHost.js.map +1 -0
  58. package/dist/Utils/segmentation/tools/ZoomTool.d.ts +2 -6
  59. package/dist/Utils/segmentation/tools/ZoomTool.js.map +1 -1
  60. package/dist/Utils/segmentation/tools/index.d.ts +5 -7
  61. package/dist/Utils/segmentation/tools/index.js +6 -0
  62. package/dist/Utils/segmentation/tools/index.js.map +1 -1
  63. package/dist/Utils/workers/reformatSaveDataWorker.d.ts +1 -1
  64. package/dist/bundle.esm.js +2109 -2357
  65. package/dist/bundle.umd.js +2109 -2357
  66. package/dist/index.d.ts +3 -3
  67. package/dist/index.js +1 -1
  68. package/dist/types/Utils/segmentation/CanvasState.d.ts +31 -0
  69. package/dist/types/Utils/segmentation/DragOperator.d.ts +1 -1
  70. package/dist/types/Utils/segmentation/DrawToolCore.d.ts +49 -27
  71. package/dist/types/Utils/segmentation/NrrdTools.d.ts +89 -467
  72. package/dist/types/Utils/segmentation/RenderingUtils.d.ts +73 -0
  73. package/dist/types/Utils/segmentation/core/MaskVolume.d.ts +1 -1
  74. package/dist/types/Utils/segmentation/core/index.d.ts +1 -1
  75. package/dist/types/Utils/segmentation/core/types.d.ts +384 -0
  76. package/dist/types/Utils/segmentation/coreTools/GuiState.d.ts +1 -1
  77. package/dist/types/Utils/segmentation/coreTools/NrrdState.d.ts +1 -1
  78. package/dist/types/Utils/segmentation/coreTools/divControlTools.d.ts +1 -1
  79. package/dist/types/Utils/segmentation/coreTools/gui.d.ts +1 -1
  80. package/dist/types/Utils/segmentation/tools/BaseTool.d.ts +1 -1
  81. package/dist/types/Utils/segmentation/tools/ContrastTool.d.ts +3 -6
  82. package/dist/types/Utils/segmentation/tools/CrosshairTool.d.ts +11 -1
  83. package/dist/types/Utils/segmentation/tools/DataLoader.d.ts +33 -0
  84. package/dist/types/Utils/segmentation/tools/DragSliceTool.d.ts +3 -12
  85. package/dist/types/Utils/segmentation/tools/DrawingTool.d.ts +18 -26
  86. package/dist/types/Utils/segmentation/tools/ImageStoreHelper.d.ts +2 -5
  87. package/dist/types/Utils/segmentation/tools/LayerChannelManager.d.ts +52 -0
  88. package/dist/types/Utils/segmentation/tools/PanTool.d.ts +2 -8
  89. package/dist/types/Utils/segmentation/tools/SliceRenderPipeline.d.ts +80 -0
  90. package/dist/types/Utils/segmentation/tools/SphereTool.d.ts +25 -19
  91. package/dist/types/Utils/segmentation/tools/ToolHost.d.ts +74 -0
  92. package/dist/types/Utils/segmentation/tools/ZoomTool.d.ts +2 -6
  93. package/dist/types/Utils/segmentation/tools/index.d.ts +5 -7
  94. package/dist/types/Utils/workers/reformatSaveDataWorker.d.ts +1 -1
  95. package/dist/types/index.d.ts +3 -3
  96. package/package.json +1 -1
  97. package/dist/Utils/segmentation/CommToolsData.d.ts +0 -192
  98. package/dist/Utils/segmentation/CommToolsData.js +0 -474
  99. package/dist/Utils/segmentation/CommToolsData.js.map +0 -1
  100. package/dist/Utils/segmentation/coreTools/coreType.d.ts +0 -389
  101. package/dist/Utils/segmentation/coreTools/coreType.js +0 -3
  102. package/dist/Utils/segmentation/coreTools/coreType.js.map +0 -1
  103. package/dist/types/Utils/segmentation/CommToolsData.d.ts +0 -192
  104. package/dist/types/Utils/segmentation/coreTools/coreType.d.ts +0 -389
@@ -1,474 +0,0 @@
1
- import { NrrdState } from "./coreTools/NrrdState";
2
- import { GuiState } from "./coreTools/GuiState";
3
- import { MaskVolume } from "./core/index";
4
- import { switchPencilIcon } from "../utils";
5
- import { CHANNEL_HEX_COLORS } from "./core/types";
6
- export class CommToolsData {
7
- constructor(container, mainAreaContainer, options) {
8
- var _a;
9
- this.baseCanvasesSize = 1;
10
- // Reusable ImageData buffer for zero-allocation slice rendering
11
- this._reusableSliceBuffer = null;
12
- this._reusableBufferWidth = 0;
13
- this._reusableBufferHeight = 0;
14
- /** External annotation callbacks — set via draw() options */
15
- this.annotationCallbacks = {
16
- onMaskChanged: () => { },
17
- onSphereChanged: () => { },
18
- onCalculatorPositionsChanged: () => { },
19
- onLayerVolumeCleared: () => { },
20
- onChannelColorChanged: () => { },
21
- };
22
- /** Whether the keyboard-config dialog is open (suppresses all shortcuts). */
23
- this._configKeyBoard = false;
24
- /** Active keyboard shortcut bindings. */
25
- this._keyboardSettings = {
26
- draw: "Shift",
27
- undo: "z",
28
- redo: "y",
29
- contrast: ["Control", "Meta"],
30
- crosshair: "s",
31
- sphere: "q",
32
- mouseWheel: "Scroll:Zoom",
33
- };
34
- this.nrrd_states = new NrrdState(this.baseCanvasesSize);
35
- this.cursorPage = {
36
- x: {
37
- cursorPageX: 0,
38
- cursorPageY: 0,
39
- index: 0,
40
- updated: false,
41
- },
42
- y: {
43
- cursorPageX: 0,
44
- cursorPageY: 0,
45
- index: 0,
46
- updated: false,
47
- },
48
- z: {
49
- cursorPageX: 0,
50
- cursorPageY: 0,
51
- index: 0,
52
- updated: false,
53
- },
54
- };
55
- this.gui_states = new GuiState({
56
- defaultPaintCursor: switchPencilIcon("dot"),
57
- defaultFillColor: CHANNEL_HEX_COLORS[1],
58
- defaultBrushColor: CHANNEL_HEX_COLORS[1],
59
- });
60
- const layers = (_a = options === null || options === void 0 ? void 0 : options.layers) !== null && _a !== void 0 ? _a : ["layer1", "layer2", "layer3"];
61
- if (layers.length > 10) {
62
- console.warn(`CommToolsData: ${layers.length} layers requested; recommended maximum is 10.`);
63
- }
64
- // Override the default states with the actual layer list
65
- this.nrrd_states.image.layers = layers;
66
- this.gui_states.layerChannel.layerVisibility = Object.fromEntries(layers.map((id) => [id, true]));
67
- this.gui_states.layerChannel.channelVisibility = Object.fromEntries(layers.map((id) => [
68
- id,
69
- { 1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true },
70
- ]));
71
- const systemCanvases = this.generateSystemCanvases();
72
- const layerTargets = this.generateLayerTargets(layers);
73
- // Get NRRD dimensions (will be set later when NRRD loads)
74
- // Default to 1x1x1 for now, will be re-initialized in NrrdTools when dimensions are known
75
- const dims = this.nrrd_states.image.dimensions;
76
- const [width, height, depth] = dims.length === 3 ? dims : [1, 1, 1];
77
- this.protectedData = {
78
- container,
79
- mainAreaContainer,
80
- allSlicesArray: [],
81
- displaySlices: [],
82
- backUpDisplaySlices: [],
83
- skipSlicesDic: {},
84
- currentShowingSlice: undefined,
85
- mainPreSlices: undefined,
86
- isDrawing: false,
87
- axis: "z",
88
- maskData: {
89
- // Volumetric storage (Phase 3 — only storage mechanism)
90
- volumes: layers.reduce((acc, id) => {
91
- acc[id] = new MaskVolume(width, height, depth, 1);
92
- return acc;
93
- }, {}),
94
- },
95
- layerTargets,
96
- canvases: {
97
- /**
98
- * Caches raw image data from the current slice.
99
- * Used as a source for zoom/pan operations to avoid repeated decoding.
100
- * Initialized as null, set in NrrdTools.ts.
101
- */
102
- originCanvas: null,
103
- /**
104
- * Top-most interaction layer.
105
- * Captures mouse/pen events and displays real-time drawing strokes
106
- * before they are committed to a specific layer.
107
- */
108
- drawingCanvas: systemCanvases.drawingCanvas,
109
- /**
110
- * Background layer displaying the actual medical image slice (CT/MRI).
111
- * This is the "base" image the user sees.
112
- */
113
- displayCanvas: systemCanvases.displayCanvas,
114
- /**
115
- * Composite display layer.
116
- * Merges all segmentation layers for unified visualization
117
- * on top of the medical image.
118
- */
119
- drawingCanvasLayerMaster: systemCanvases.drawingCanvasLayerMaster,
120
- /**
121
- * Dedicated layer for 3D Sphere tool visualization.
122
- * Kept separate to allow independent rendering of sphere UI elements.
123
- */
124
- drawingSphereCanvas: systemCanvases.drawingSphereCanvas,
125
- /**
126
- * Off-screen scratchpad canvas.
127
- * Used for internal image processing, scaling, and format conversion.
128
- */
129
- emptyCanvas: systemCanvases.emptyCanvas,
130
- },
131
- ctxes: {
132
- drawingCtx: systemCanvases.drawingCanvas.getContext("2d"),
133
- displayCtx: systemCanvases.displayCanvas.getContext("2d"),
134
- drawingLayerMasterCtx: systemCanvases.drawingCanvasLayerMaster.getContext("2d"),
135
- drawingSphereCtx: systemCanvases.drawingSphereCanvas.getContext("2d"),
136
- emptyCtx: systemCanvases.emptyCanvas.getContext("2d", {
137
- willReadFrequently: true,
138
- }),
139
- },
140
- };
141
- }
142
- // ── Volume Accessor Helpers (Phase 2) ──────────────────────────────────
143
- /**
144
- * Get MaskVolume for a specific layer
145
- *
146
- * @param layer - Layer name: "layer1", "layer2", or "layer3"
147
- * @returns MaskVolume instance for the specified layer
148
- *
149
- * @example
150
- * ```ts
151
- * const volume = this.getVolumeForLayer("layer1");
152
- * volume.setVoxel(x, y, z, 255);
153
- * ```
154
- */
155
- getVolumeForLayer(layer) {
156
- const { volumes } = this.protectedData.maskData;
157
- const vol = volumes[layer];
158
- if (vol)
159
- return vol;
160
- const firstLayerId = this.nrrd_states.image.layers[0];
161
- console.warn(`CommToolsData: unknown layer "${layer}", falling back to "${firstLayerId}"`);
162
- return volumes[firstLayerId];
163
- }
164
- /**
165
- * Get MaskVolume for the currently active layer
166
- *
167
- * @returns MaskVolume instance for the current layer
168
- *
169
- * @example
170
- * ```ts
171
- * const volume = this.getCurrentVolume();
172
- * const slice = volume.getSliceImageData(50, 'z');
173
- * ```
174
- */
175
- getCurrentVolume() {
176
- return this.getVolumeForLayer(this.gui_states.layerChannel.layer);
177
- }
178
- /**
179
- * Get all three MaskVolume instances
180
- *
181
- * @returns Object containing all three layer volumes
182
- *
183
- * @example
184
- * ```ts
185
- * const { layer1, layer2, layer3 } = this.getAllVolumes();
186
- * layer1.clear();
187
- * ```
188
- */
189
- getAllVolumes() {
190
- return this.protectedData.maskData.volumes;
191
- }
192
- // ───────────────────────────────────────────────────────────────────────
193
- generateSystemCanvases() {
194
- return {
195
- drawingCanvas: document.createElement("canvas"),
196
- displayCanvas: document.createElement("canvas"),
197
- drawingCanvasLayerMaster: document.createElement("canvas"),
198
- drawingSphereCanvas: document.createElement("canvas"),
199
- emptyCanvas: document.createElement("canvas"),
200
- };
201
- }
202
- generateLayerTargets(layerIds) {
203
- const map = new Map();
204
- for (const id of layerIds) {
205
- const canvas = document.createElement("canvas");
206
- const ctx = canvas.getContext("2d");
207
- map.set(id, { canvas, ctx });
208
- }
209
- return map;
210
- }
211
- /**
212
- * Rewrite this {clearActiveSlice} function under DrawToolCore
213
- */
214
- clearActiveSlice() {
215
- throw new Error("Child class must implement abstract clearActiveSlice, currently you can find it in DrawToolCore.");
216
- }
217
- /**
218
- * Rewrite this {undoLastPainting} function under DrawToolCore
219
- */
220
- undoLastPainting() {
221
- throw new Error("Child class must implement abstract undoLastPainting, currently you can find it in DrawToolCore.");
222
- }
223
- /**
224
- * Rewrite this {redoLastPainting} function under DrawToolCore
225
- */
226
- redoLastPainting() {
227
- throw new Error("Child class must implement abstract redoLastPainting, currently you can find it in DrawToolCore.");
228
- }
229
- /**
230
- * Rewrite this {clearActiveLayer} function under NrrdTools
231
- */
232
- clearActiveLayer() {
233
- throw new Error("Child class must implement abstract clearActiveLayer, currently you can find it in NrrdTools.");
234
- }
235
- /**
236
- * Rewrite this {resizePaintArea} function under NrrdTools
237
- */
238
- resizePaintArea(factor) {
239
- throw new Error("Child class must implement abstract resizePaintArea, currently you can find it in NrrdTools.");
240
- }
241
- /**
242
- * Rewrite this {setIsDrawFalse} function under NrrdTools
243
- */
244
- setIsDrawFalse(target) {
245
- throw new Error("Child class must implement abstract setIsDrawFalse, currently you can find it in NrrdTools.");
246
- }
247
- /**
248
- * Rewrite this {updateOriginAndChangedWH} function under NrrdTools
249
- */
250
- updateOriginAndChangedWH() {
251
- throw new Error("Child class must implement abstract updateOriginAndChangedWH, currently you can find it in NrrdTools.");
252
- }
253
- /**
254
- * Rewrite this {flipDisplayImageByAxis} function under NrrdTools
255
- */
256
- flipDisplayImageByAxis() {
257
- throw new Error("Child class must implement abstract flipDisplayImageByAxis, currently you can find it in NrrdTools.");
258
- }
259
- /**
260
- * Rewrite this {resetPaintAreaUIPosition} function under NrrdTools
261
- */
262
- resetPaintAreaUIPosition(l, t) {
263
- throw new Error("Child class must implement abstract resetPaintAreaUIPosition, currently you can find it in NrrdTools.");
264
- }
265
- /**
266
- * Rewrite this {resetPaintAreaUIPosition} function under NrrdTools
267
- */
268
- setEmptyCanvasSize(axis) {
269
- throw new Error("Child class must implement abstract setEmptyCanvasSize, currently you can find it in NrrdTools.");
270
- }
271
- /**
272
- * Rewrite this {convertCursorPoint} function under NrrdTools
273
- */
274
- convertCursorPoint(from, to, cursorNumX, cursorNumY, currentSliceIndex) {
275
- throw new Error("Child class must implement abstract convertCursorPoint, currently you can find it in NrrdTools.");
276
- }
277
- /**
278
- * Rewrite this {resetLayerCanvas} function under NrrdTools
279
- */
280
- resetLayerCanvas() {
281
- throw new Error("Child class must implement abstract resetLayerCanvas, currently you can find it in NrrdTools.");
282
- }
283
- /**
284
- * Enter sphere mode: clear all layer canvases (not MaskVolume),
285
- * hide all mask data so sphere overlay is the only visible annotation.
286
- * Rewrite this under NrrdTools.
287
- */
288
- enterSphereMode() {
289
- throw new Error("Child class must implement abstract enterSphereMode, currently you can find it in NrrdTools.");
290
- }
291
- /**
292
- * Exit sphere mode: clear sphere canvas overlay, reload all layer
293
- * MaskVolume data back onto canvases. Rewrite this under NrrdTools.
294
- */
295
- exitSphereMode() {
296
- throw new Error("Child class must implement abstract exitSphereMode, currently you can find it in NrrdTools.");
297
- }
298
- /**
299
- * Rewrite this {setSyncsliceNum} function under NrrdTools
300
- */
301
- setSyncsliceNum() {
302
- throw new Error("Child class must implement abstract setSyncsliceNum, currently you can find it in NrrdTools.");
303
- }
304
- /**
305
- * Rewrite this {redrawDisplayCanvas} function under NrrdTools
306
- */
307
- redrawDisplayCanvas() {
308
- throw new Error("Child class must implement abstract redrawDisplayCanvas, currently you can find it in NrrdTools.");
309
- }
310
- /**
311
- * Get a painted mask image based on current axis and input slice index.
312
- *
313
- * Phase 3: Reads directly from MaskVolume.
314
- *
315
- * @param axis "x" | "y" | "z"
316
- * @param sliceIndex number
317
- * @returns Object with index and image, or undefined
318
- */
319
- filterDrawedImage(axis, sliceIndex) {
320
- try {
321
- const volume = this.getCurrentVolume();
322
- if (volume) {
323
- const dims = volume.getDimensions();
324
- const [w, h] = axis === 'z' ? [dims.width, dims.height]
325
- : axis === 'y' ? [dims.width, dims.depth]
326
- // Sagittal: width = depth (Z), height = height (Y)
327
- : [dims.depth, dims.height];
328
- const imageData = new ImageData(w, h);
329
- const channelVis = this.gui_states.layerChannel.channelVisibility[this.gui_states.layerChannel.layer];
330
- volume.renderLabelSliceInto(sliceIndex, axis, imageData, channelVis);
331
- return { index: sliceIndex, image: imageData };
332
- }
333
- }
334
- catch (err) {
335
- // Volume not ready or slice out of bounds
336
- }
337
- return undefined;
338
- }
339
- /**
340
- * Get or create a reusable ImageData buffer for the given axis.
341
- *
342
- * Reuses the same buffer across multiple slice renders to avoid
343
- * allocating a new ImageData per layer per slice switch.
344
- * The buffer is only reallocated when slice dimensions change (axis switch).
345
- *
346
- * @param axis - Axis: "x", "y", or "z"
347
- * @returns Reusable ImageData buffer with correct dimensions
348
- */
349
- getOrCreateSliceBuffer(axis) {
350
- try {
351
- const vol = this.getVolumeForLayer(this.nrrd_states.image.layers[0]);
352
- const dims = vol.getDimensions();
353
- const [w, h] = axis === "z" ? [dims.width, dims.height] :
354
- axis === "y" ? [dims.width, dims.depth] :
355
- // Sagittal: width = depth (Z), height = height (Y)
356
- // Matches setEmptyCanvasSize('x') and MaskVolume.getSliceDimensions('x')
357
- [dims.depth, dims.height];
358
- if (!this._reusableSliceBuffer ||
359
- this._reusableBufferWidth !== w ||
360
- this._reusableBufferHeight !== h) {
361
- this._reusableSliceBuffer = new ImageData(w, h);
362
- this._reusableBufferWidth = w;
363
- this._reusableBufferHeight = h;
364
- }
365
- return this._reusableSliceBuffer;
366
- }
367
- catch (_a) {
368
- return null; // Volume not ready
369
- }
370
- }
371
- /**
372
- * Render a layer's slice into a reusable buffer and draw to the target canvas.
373
- *
374
- * Uses MaskVolume.renderLabelSliceInto() for zero-allocation rendering.
375
- * The caller should obtain the buffer via getOrCreateSliceBuffer() and reuse
376
- * it across multiple layer renders.
377
- *
378
- * @param layer - Layer name: "layer1", "layer2", or "layer3"
379
- * @param axis - Axis: "x", "y", or "z"
380
- * @param sliceIndex - Slice index
381
- * @param buffer - Reusable ImageData buffer (from getOrCreateSliceBuffer)
382
- * @param targetCtx - Canvas context to draw the result onto
383
- * @param scaledWidth - Target display width
384
- * @param scaledHeight - Target display height
385
- */
386
- renderSliceToCanvas(layer, axis, sliceIndex, buffer, targetCtx, scaledWidth, scaledHeight) {
387
- try {
388
- const volume = this.getVolumeForLayer(layer);
389
- if (!volume)
390
- return;
391
- // Get channel visibility for this layer
392
- const channelVis = this.gui_states.layerChannel.channelVisibility[layer];
393
- // Render label slice at full alpha — globalAlpha applied during compositeAllLayers
394
- volume.renderLabelSliceInto(sliceIndex, axis, buffer, channelVis, 1.0);
395
- this.setEmptyCanvasSize(axis);
396
- this.protectedData.ctxes.emptyCtx.putImageData(buffer, 0, 0);
397
- targetCtx.imageSmoothingEnabled = false;
398
- // Coronal (axis='y') Z-flip: vertically flip the rendered mask to match
399
- // the Z-flip applied during the write path (syncLayerSliceData).
400
- // Same pattern as SphereTool.refreshSphereCanvas('y') scale(1,-1).
401
- // Same-view: write_flip + read_flip = identity (correct).
402
- // Cross-view (sagittal↔coronal): aligns Z-axis direction (fixes flip bug).
403
- if (axis === 'y') {
404
- targetCtx.save();
405
- targetCtx.scale(1, -1);
406
- targetCtx.translate(0, -scaledHeight);
407
- }
408
- targetCtx.drawImage(this.protectedData.canvases.emptyCanvas, 0, 0, scaledWidth, scaledHeight);
409
- if (axis === 'y') {
410
- targetCtx.restore();
411
- }
412
- }
413
- catch (err) {
414
- // Slice out of bounds or volume not ready — skip silently
415
- }
416
- }
417
- /**
418
- * Invalidate the reusable buffer (e.g. when switching datasets).
419
- * The buffer will be lazily recreated on next use.
420
- */
421
- invalidateSliceBuffer() {
422
- this._reusableSliceBuffer = null;
423
- this._reusableBufferWidth = 0;
424
- this._reusableBufferHeight = 0;
425
- }
426
- /**
427
- * Apply the same flip transform used by flipDisplayImageByAxis() to any
428
- * canvas context. This ensures mask overlays align with the flipped CT image.
429
- *
430
- * The flip is its own inverse (applying twice = identity), so it works for
431
- * both directions: volume→display (rendering) and display→volume (storing).
432
- *
433
- * @param ctx Target 2D context (must be wrapped in save/restore by caller).
434
- * @param width Canvas width in pixels.
435
- * @param height Canvas height in pixels.
436
- * @param axis Current viewing axis.
437
- */
438
- applyMaskFlipForAxis(ctx, width, height, axis) {
439
- switch (axis) {
440
- case "x": // sagittal: flip both axes
441
- ctx.scale(-1, -1);
442
- ctx.translate(-width, -height);
443
- break;
444
- case "y": // coronal: flip vertically
445
- ctx.scale(1, -1);
446
- ctx.translate(0, -height);
447
- break;
448
- case "z": // axial: flip vertically
449
- ctx.scale(1, -1);
450
- ctx.translate(0, -height);
451
- break;
452
- }
453
- }
454
- /**
455
- * Composite all layer canvases to the master display canvas.
456
- * Only draws layers whose visibility is enabled.
457
- */
458
- compositeAllLayers() {
459
- const masterCtx = this.protectedData.ctxes.drawingLayerMasterCtx;
460
- const width = this.nrrd_states.view.changedWidth;
461
- const height = this.nrrd_states.view.changedHeight;
462
- masterCtx.clearRect(0, 0, width, height);
463
- // Master stores full-alpha composite; globalAlpha is applied once in
464
- // start() when drawing master to drawingCtx (single point of control).
465
- for (const layerId of this.nrrd_states.image.layers) {
466
- if (!this.gui_states.layerChannel.layerVisibility[layerId])
467
- continue;
468
- const target = this.protectedData.layerTargets.get(layerId);
469
- if (target)
470
- masterCtx.drawImage(target.canvas, 0, 0, width, height);
471
- }
472
- }
473
- }
474
- //# sourceMappingURL=CommToolsData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CommToolsData.js","sourceRoot":"","sources":["../../../src/Utils/segmentation/CommToolsData.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EA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