copper3d 2.2.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +1056 -5
  2. package/dist/Scene/copperScene.d.ts +3 -0
  3. package/dist/Scene/copperScene.js +13 -0
  4. package/dist/Scene/copperScene.js.map +1 -1
  5. package/dist/Utils/segmentation/CommToolsData.d.ts +109 -6
  6. package/dist/Utils/segmentation/CommToolsData.js +314 -50
  7. package/dist/Utils/segmentation/CommToolsData.js.map +1 -1
  8. package/dist/Utils/segmentation/DragOperator.d.ts +13 -7
  9. package/dist/Utils/segmentation/DragOperator.js +51 -165
  10. package/dist/Utils/segmentation/DragOperator.js.map +1 -1
  11. package/dist/Utils/segmentation/DrawToolCore.d.ts +57 -76
  12. package/dist/Utils/segmentation/DrawToolCore.js +368 -878
  13. package/dist/Utils/segmentation/DrawToolCore.js.map +1 -1
  14. package/dist/Utils/segmentation/NrrdTools.d.ts +277 -15
  15. package/dist/Utils/segmentation/NrrdTools.js +594 -232
  16. package/dist/Utils/segmentation/NrrdTools.js.map +1 -1
  17. package/dist/Utils/segmentation/core/MaskVolume.d.ts +477 -0
  18. package/dist/Utils/segmentation/core/MaskVolume.js +1238 -0
  19. package/dist/Utils/segmentation/core/MaskVolume.js.map +1 -0
  20. package/dist/Utils/segmentation/core/MigrationUtils.d.ts +97 -0
  21. package/dist/Utils/segmentation/core/MigrationUtils.js +163 -0
  22. package/dist/Utils/segmentation/core/MigrationUtils.js.map +1 -0
  23. package/dist/Utils/segmentation/core/UndoManager.d.ts +47 -0
  24. package/dist/Utils/segmentation/core/UndoManager.js +86 -0
  25. package/dist/Utils/segmentation/core/UndoManager.js.map +1 -0
  26. package/dist/Utils/segmentation/core/index.d.ts +76 -0
  27. package/dist/Utils/segmentation/core/index.js +75 -0
  28. package/dist/Utils/segmentation/core/index.js.map +1 -0
  29. package/dist/Utils/segmentation/core/types.d.ts +106 -0
  30. package/dist/Utils/segmentation/core/types.js +98 -0
  31. package/dist/Utils/segmentation/core/types.js.map +1 -0
  32. package/dist/Utils/segmentation/coreTools/coreType.d.ts +55 -36
  33. package/dist/Utils/segmentation/coreTools/coreType.js.map +1 -1
  34. package/dist/Utils/segmentation/coreTools/gui.d.ts +6 -16
  35. package/dist/Utils/segmentation/coreTools/gui.js +23 -27
  36. package/dist/Utils/segmentation/coreTools/gui.js.map +1 -1
  37. package/dist/Utils/segmentation/eventRouter/EventRouter.d.ts +144 -0
  38. package/dist/Utils/segmentation/eventRouter/EventRouter.js +369 -0
  39. package/dist/Utils/segmentation/eventRouter/EventRouter.js.map +1 -0
  40. package/dist/Utils/segmentation/eventRouter/index.d.ts +7 -0
  41. package/dist/Utils/segmentation/eventRouter/index.js +7 -0
  42. package/dist/Utils/segmentation/eventRouter/index.js.map +1 -0
  43. package/dist/Utils/segmentation/eventRouter/types.d.ts +70 -0
  44. package/dist/Utils/segmentation/eventRouter/types.js +7 -0
  45. package/dist/Utils/segmentation/eventRouter/types.js.map +1 -0
  46. package/dist/Utils/segmentation/tools/BaseTool.d.ts +25 -0
  47. package/dist/Utils/segmentation/tools/BaseTool.js +18 -0
  48. package/dist/Utils/segmentation/tools/BaseTool.js.map +1 -0
  49. package/dist/Utils/segmentation/tools/ContrastTool.d.ts +26 -0
  50. package/dist/Utils/segmentation/tools/ContrastTool.js +118 -0
  51. package/dist/Utils/segmentation/tools/ContrastTool.js.map +1 -0
  52. package/dist/Utils/segmentation/tools/CrosshairTool.d.ts +30 -0
  53. package/dist/Utils/segmentation/tools/CrosshairTool.js +157 -0
  54. package/dist/Utils/segmentation/tools/CrosshairTool.js.map +1 -0
  55. package/dist/Utils/segmentation/tools/DragSliceTool.d.ts +44 -0
  56. package/dist/Utils/segmentation/tools/DragSliceTool.js +170 -0
  57. package/dist/Utils/segmentation/tools/DragSliceTool.js.map +1 -0
  58. package/dist/Utils/segmentation/tools/EraserTool.d.ts +16 -0
  59. package/dist/Utils/segmentation/tools/EraserTool.js +92 -0
  60. package/dist/Utils/segmentation/tools/EraserTool.js.map +1 -0
  61. package/dist/Utils/segmentation/tools/ImageStoreHelper.d.ts +65 -0
  62. package/dist/Utils/segmentation/tools/ImageStoreHelper.js +174 -0
  63. package/dist/Utils/segmentation/tools/ImageStoreHelper.js.map +1 -0
  64. package/dist/Utils/segmentation/tools/SphereTool.d.ts +38 -0
  65. package/dist/Utils/segmentation/tools/SphereTool.js +193 -0
  66. package/dist/Utils/segmentation/tools/SphereTool.js.map +1 -0
  67. package/dist/Utils/segmentation/tools/ZoomTool.d.ts +20 -0
  68. package/dist/Utils/segmentation/tools/ZoomTool.js +59 -0
  69. package/dist/Utils/segmentation/tools/ZoomTool.js.map +1 -0
  70. package/dist/Utils/segmentation/tools/index.d.ts +22 -0
  71. package/dist/Utils/segmentation/tools/index.js +23 -0
  72. package/dist/Utils/segmentation/tools/index.js.map +1 -0
  73. package/dist/bundle.esm.js +4740 -1979
  74. package/dist/bundle.umd.js +4743 -1978
  75. package/dist/index.d.ts +5 -3
  76. package/dist/index.js +4 -2
  77. package/dist/index.js.map +1 -1
  78. package/dist/types/Renderer/copperRenderer.d.ts +1 -1
  79. package/dist/types/Renderer/copperRendererOnDemond.d.ts +1 -1
  80. package/dist/types/Scene/copperScene.d.ts +3 -0
  81. package/dist/types/Utils/segmentation/CommToolsData.d.ts +109 -6
  82. package/dist/types/Utils/segmentation/DragOperator.d.ts +13 -7
  83. package/dist/types/Utils/segmentation/DrawToolCore.d.ts +57 -76
  84. package/dist/types/Utils/segmentation/NrrdTools.d.ts +277 -15
  85. package/dist/types/Utils/segmentation/core/MaskVolume.d.ts +477 -0
  86. package/dist/types/Utils/segmentation/core/MigrationUtils.d.ts +97 -0
  87. package/dist/types/Utils/segmentation/core/UndoManager.d.ts +47 -0
  88. package/dist/types/Utils/segmentation/core/index.d.ts +76 -0
  89. package/dist/types/Utils/segmentation/core/types.d.ts +106 -0
  90. package/dist/types/Utils/segmentation/coreTools/coreType.d.ts +55 -36
  91. package/dist/types/Utils/segmentation/coreTools/gui.d.ts +6 -16
  92. package/dist/types/Utils/segmentation/eventRouter/EventRouter.d.ts +144 -0
  93. package/dist/types/Utils/segmentation/eventRouter/index.d.ts +7 -0
  94. package/dist/types/Utils/segmentation/eventRouter/types.d.ts +70 -0
  95. package/dist/types/Utils/segmentation/tools/BaseTool.d.ts +25 -0
  96. package/dist/types/Utils/segmentation/tools/ContrastTool.d.ts +26 -0
  97. package/dist/types/Utils/segmentation/tools/CrosshairTool.d.ts +30 -0
  98. package/dist/types/Utils/segmentation/tools/DragSliceTool.d.ts +44 -0
  99. package/dist/types/Utils/segmentation/tools/EraserTool.d.ts +16 -0
  100. package/dist/types/Utils/segmentation/tools/ImageStoreHelper.d.ts +65 -0
  101. package/dist/types/Utils/segmentation/tools/SphereTool.d.ts +38 -0
  102. package/dist/types/Utils/segmentation/tools/ZoomTool.d.ts +20 -0
  103. package/dist/types/Utils/segmentation/tools/index.d.ts +22 -0
  104. package/dist/types/index.d.ts +5 -3
  105. package/dist/types/types/types.d.ts +3 -3
  106. package/dist/types/types.d.ts +3 -3
  107. package/package.json +1 -1
  108. package/dist/Utils/segmentation/coreTools/archive.d.ts +0 -1
  109. package/dist/Utils/segmentation/coreTools/archive.js +0 -23
  110. package/dist/Utils/segmentation/coreTools/archive.js.map +0 -1
  111. package/dist/types/Utils/segmentation/coreTools/archive.d.ts +0 -1
@@ -1,7 +1,8 @@
1
1
  import { throttle } from "../utils";
2
2
  import { createShowSliceNumberDiv } from "./coreTools/divControlTools";
3
+ import { DragSliceTool } from "./tools/DragSliceTool";
3
4
  export class DragOperator {
4
- constructor(container, nrrd_sates, gui_states, protectedData, drawingPrameters, setSyncsliceNum, setIsDrawFalse, flipDisplayImageByAxis, setEmptyCanvasSize, filterDrawedImage) {
5
+ constructor(container, nrrd_sates, gui_states, protectedData, drawingPrameters, setSyncsliceNum, setIsDrawFalse, flipDisplayImageByAxis, setEmptyCanvasSize, getOrCreateSliceBuffer, renderSliceToCanvas) {
5
6
  this.dragPrameters = {
6
7
  move: 0,
7
8
  y: 0,
@@ -12,6 +13,8 @@ export class DragOperator {
12
13
  handleOnDragMouseMove: (ev) => { },
13
14
  };
14
15
  this.sensitiveArray = [];
16
+ // EventRouter for centralized event handling
17
+ this.eventRouter = null;
15
18
  this.configDragMode = () => {
16
19
  this.container.style.cursor = "pointer";
17
20
  this.container.addEventListener("pointerdown", this.dragPrameters.handleOnDragMouseDown, true);
@@ -32,7 +35,8 @@ export class DragOperator {
32
35
  this.setIsDrawFalse = setIsDrawFalse;
33
36
  this.flipDisplayImageByAxis = flipDisplayImageByAxis;
34
37
  this.setEmptyCanvasSize = setEmptyCanvasSize;
35
- this.filterDrawedImage = filterDrawedImage;
38
+ this.getOrCreateSliceBuffer = getOrCreateSliceBuffer;
39
+ this.renderSliceToCanvas = renderSliceToCanvas;
36
40
  this.showDragNumberDiv = createShowSliceNumberDiv();
37
41
  this.init();
38
42
  }
@@ -40,16 +44,52 @@ export class DragOperator {
40
44
  for (let i = 0; i < this.gui_states.max_sensitive; i++) {
41
45
  this.sensitiveArray.push((i + 1) / 20);
42
46
  }
43
- this.dragEffectCanvases = {
47
+ const dragEffectCanvases = {
44
48
  drawingCanvasLayerMaster: this.protectedData.canvases.drawingCanvasLayerMaster,
45
- drawingCanvasLayerOne: this.protectedData.canvases.drawingCanvasLayerOne,
46
- drawingCanvasLayerTwo: this.protectedData.canvases.drawingCanvasLayerTwo,
47
- drawingCanvasLayerThree: this.protectedData.canvases.drawingCanvasLayerThree,
48
49
  displayCanvas: this.protectedData.canvases.displayCanvas,
50
+ layerTargets: this.protectedData.layerTargets,
49
51
  };
52
+ const toolCtx = {
53
+ nrrd_states: this.nrrd_states,
54
+ gui_states: this.gui_states,
55
+ protectedData: this.protectedData,
56
+ cursorPage: {},
57
+ };
58
+ this.dragSliceTool = new DragSliceTool(toolCtx, {
59
+ setSyncsliceNum: () => this.setSyncsliceNum(),
60
+ setIsDrawFalse: (target) => this.setIsDrawFalse(target),
61
+ flipDisplayImageByAxis: () => this.flipDisplayImageByAxis(),
62
+ setEmptyCanvasSize: (axis) => this.setEmptyCanvasSize(axis),
63
+ getOrCreateSliceBuffer: (axis) => this.getOrCreateSliceBuffer(axis),
64
+ renderSliceToCanvas: (layer, axis, sliceIndex, buffer, targetCtx, w, h) => this.renderSliceToCanvas(layer, axis, sliceIndex, buffer, targetCtx, w, h),
65
+ }, this.showDragNumberDiv, dragEffectCanvases);
50
66
  }
51
67
  setShowDragNumberDiv(sliceIndexContainer) {
52
68
  this.showDragNumberDiv = sliceIndexContainer;
69
+ this.dragSliceTool.setShowDragNumberDiv(sliceIndexContainer);
70
+ }
71
+ /**
72
+ * Set the EventRouter reference for centralized event handling.
73
+ * Called by NrrdTools/DrawToolCore after EventRouter is initialized.
74
+ * Subscribes to mode changes to control drag mode.
75
+ */
76
+ setEventRouter(eventRouter) {
77
+ this.eventRouter = eventRouter;
78
+ // Subscribe to mode changes to control drag/contrast modes
79
+ this.eventRouter.subscribeModeChange((prevMode, newMode) => {
80
+ const prev = prevMode;
81
+ const next = newMode;
82
+ // When entering draw or contrast mode, remove drag mode
83
+ if (next === 'draw' || next === 'contrast') {
84
+ this.removeDragMode();
85
+ }
86
+ // When leaving draw or contrast mode (returning to idle), restore drag mode
87
+ if ((prev === 'draw' || prev === 'contrast') && next === 'idle') {
88
+ if (!this.gui_states.sphere) {
89
+ this.configDragMode();
90
+ }
91
+ }
92
+ });
53
93
  }
54
94
  drag(opts) {
55
95
  this.dragPrameters.h = this.container.offsetHeight;
@@ -88,171 +128,17 @@ export class DragOperator {
88
128
  this.container.removeEventListener("pointermove", this.dragPrameters.handleOnDragMouseMove, false);
89
129
  };
90
130
  this.configDragMode();
91
- this.container.addEventListener("keydown", (ev) => {
92
- if (this.nrrd_states.configKeyBoard)
93
- return;
94
- if (ev.key === this.nrrd_states.keyboardSettings.draw) {
95
- this.removeDragMode();
96
- }
97
- });
98
- this.container.addEventListener("keyup", (ev) => {
99
- if (this.nrrd_states.configKeyBoard)
100
- return;
101
- if (this.nrrd_states.keyboardSettings.contrast.includes(ev.key)) {
102
- /**
103
- * if ctrl pressed remove the drag mode
104
- */
105
- if (this.protectedData.Is_Ctrl_Pressed) {
106
- this.removeDragMode();
107
- }
108
- else {
109
- this.configDragMode();
110
- }
111
- }
112
- if (ev.key === this.nrrd_states.keyboardSettings.draw && !this.gui_states.sphere) {
113
- if (this.protectedData.Is_Ctrl_Pressed) {
114
- return;
115
- }
116
- this.configDragMode();
117
- }
118
- });
131
+ // Keyboard handling is fully managed by EventRouter (injected via setEventRouter).
132
+ // Mode changes (draw/contrast) are routed through the onModeChange callback in DrawToolCore.
119
133
  }
120
134
  updateIndex(move) {
121
- let sliceModifyNum = 0;
122
- let contrastModifyNum = 0;
123
- if (this.nrrd_states.showContrast) {
124
- contrastModifyNum = move % this.protectedData.displaySlices.length;
125
- this.nrrd_states.contrastNum += contrastModifyNum;
126
- if (move > 0) {
127
- // move forward
128
- if (this.nrrd_states.currentIndex <= this.nrrd_states.maxIndex) {
129
- sliceModifyNum = Math.floor(move / this.protectedData.displaySlices.length);
130
- if (this.nrrd_states.contrastNum >
131
- this.protectedData.displaySlices.length - 1) {
132
- sliceModifyNum += 1;
133
- this.nrrd_states.contrastNum -=
134
- this.protectedData.displaySlices.length;
135
- }
136
- }
137
- else {
138
- sliceModifyNum = 0;
139
- }
140
- }
141
- else {
142
- // move back
143
- sliceModifyNum = Math.ceil(move / this.protectedData.displaySlices.length);
144
- if (this.nrrd_states.contrastNum < 0) {
145
- this.nrrd_states.contrastNum +=
146
- this.protectedData.displaySlices.length;
147
- sliceModifyNum -= 1;
148
- }
149
- }
150
- }
151
- else {
152
- sliceModifyNum = move;
153
- }
154
- // let newIndex = this.nrrd_states.oldIndex + sliceModifyNum;
155
- let newIndex = this.nrrd_states.currentIndex + sliceModifyNum;
156
- if (newIndex != this.nrrd_states.currentIndex ||
157
- this.nrrd_states.showContrast) {
158
- if (newIndex > this.nrrd_states.maxIndex) {
159
- newIndex = this.nrrd_states.maxIndex;
160
- this.nrrd_states.contrastNum =
161
- this.protectedData.displaySlices.length - 1;
162
- }
163
- else if (newIndex < this.nrrd_states.minIndex) {
164
- newIndex = this.nrrd_states.minIndex;
165
- this.nrrd_states.contrastNum = 0;
166
- }
167
- else {
168
- this.protectedData.mainPreSlices.index =
169
- newIndex * this.nrrd_states.RSARatio;
170
- // clear drawing canvas, and display next slicez
171
- this.setSyncsliceNum();
172
- let isSameIndex = true;
173
- if (newIndex != this.nrrd_states.currentIndex) {
174
- this.nrrd_states.switchSliceFlag = true;
175
- isSameIndex = false;
176
- }
177
- this.cleanCanvases(isSameIndex);
178
- if (this.nrrd_states.changedWidth === 0) {
179
- this.nrrd_states.changedWidth = this.nrrd_states.originWidth;
180
- this.nrrd_states.changedHeight = this.nrrd_states.originHeight;
181
- }
182
- // get the slice that need to be updated on displayCanvas
183
- let needToUpdateSlice = this.updateCurrentContrastSlice();
184
- needToUpdateSlice.repaint.call(needToUpdateSlice);
185
- this.nrrd_states.currentIndex = newIndex;
186
- this.drawDragSlice(needToUpdateSlice.canvas);
187
- }
188
- this.nrrd_states.oldIndex = newIndex * this.nrrd_states.RSARatio;
189
- this.updateShowNumDiv(this.nrrd_states.contrastNum);
190
- }
191
- }
192
- drawDragSlice(canvas) {
193
- this.protectedData.ctxes.displayCtx.save();
194
- // flip images
195
- this.flipDisplayImageByAxis();
196
- this.protectedData.ctxes.displayCtx.drawImage(canvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
197
- this.protectedData.ctxes.displayCtx.restore();
198
- if (this.protectedData.maskData.paintImages.x.length > 0 ||
199
- this.protectedData.maskData.paintImages.y.length > 0 ||
200
- this.protectedData.maskData.paintImages.z.length > 0) {
201
- if (this.nrrd_states.switchSliceFlag) {
202
- // 0929
203
- // this.paintedImage = this.filterDrawedImage(
204
- // this.protectedData.axis,
205
- // this.nrrd_states.currentIndex,
206
- // this.protectedData.maskData.paintImages
207
- // );
208
- this.drawMaskToLabelCtx(this.protectedData.maskData.paintImages, this.protectedData.ctxes.drawingLayerMasterCtx);
209
- this.drawMaskToLabelCtx(this.protectedData.maskData.paintImagesLabel1, this.protectedData.ctxes.drawingLayerOneCtx);
210
- this.drawMaskToLabelCtx(this.protectedData.maskData.paintImagesLabel2, this.protectedData.ctxes.drawingLayerTwoCtx);
211
- this.drawMaskToLabelCtx(this.protectedData.maskData.paintImagesLabel3, this.protectedData.ctxes.drawingLayerThreeCtx);
212
- this.nrrd_states.switchSliceFlag = false;
213
- }
214
- }
215
- }
216
- drawMaskToLabelCtx(paintedImages, ctx) {
217
- const paintedImage = this.filterDrawedImage(this.protectedData.axis, this.nrrd_states.currentIndex, paintedImages);
218
- if (paintedImage === null || paintedImage === void 0 ? void 0 : paintedImage.image) {
219
- // redraw the stored data to empty point 2
220
- this.setEmptyCanvasSize();
221
- this.protectedData.ctxes.emptyCtx.putImageData(paintedImage.image, 0, 0);
222
- ctx.drawImage(this.protectedData.canvases.emptyCanvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
223
- }
224
- }
225
- cleanCanvases(flag) {
226
- for (const name in this.dragEffectCanvases) {
227
- if (flag) {
228
- if (name === "displayCanvas") {
229
- this.dragEffectCanvases.displayCanvas.width =
230
- this.dragEffectCanvases.displayCanvas.width;
231
- }
232
- }
233
- else {
234
- this.dragEffectCanvases[name].width =
235
- this.dragEffectCanvases[name].width;
236
- }
237
- }
135
+ this.dragSliceTool.updateIndex(move);
238
136
  }
239
137
  updateShowNumDiv(contrastNum) {
240
- if (this.protectedData.mainPreSlices) {
241
- if (this.nrrd_states.currentIndex > this.nrrd_states.maxIndex) {
242
- this.nrrd_states.currentIndex = this.nrrd_states.maxIndex;
243
- }
244
- if (this.nrrd_states.showContrast) {
245
- this.showDragNumberDiv.innerHTML = `ContrastNum: ${contrastNum}/${this.protectedData.displaySlices.length - 1} SliceNum: ${this.nrrd_states.currentIndex}/${this.nrrd_states.maxIndex}`;
246
- }
247
- else {
248
- this.showDragNumberDiv.innerHTML = `SliceNum: ${this.nrrd_states.currentIndex}/${this.nrrd_states.maxIndex}`;
249
- }
250
- }
138
+ this.dragSliceTool.updateShowNumDiv(contrastNum);
251
139
  }
252
140
  updateCurrentContrastSlice() {
253
- this.protectedData.currentShowingSlice =
254
- this.protectedData.displaySlices[this.nrrd_states.contrastNum];
255
- return this.protectedData.currentShowingSlice;
141
+ return this.dragSliceTool.updateCurrentContrastSlice();
256
142
  }
257
143
  updateMainSlice(mainPreSlices) {
258
144
  this.protectedData.mainPreSlices = mainPreSlices;
@@ -1 +1 @@
1
- {"version":3,"file":"DragOperator.js","sourceRoot":"","sources":["../../../src/Utils/segmentation/DragOperator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAWpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAWvE,MAAM,OAAO,YAAY;IA8BvB,YACE,SAAsB,EACtB,UAAuB,EACvB,UAAsB,EACtB,aAAyB,EACzB,gBAAgC,EAEhC,eAA2B,EAC3B,cAAwC,EACxC,sBAAkC,EAClC,kBAAoD,EACpD,iBAIgB;QA1CV,kBAAa,GAAmB;YACtC,IAAI,EAAE,CAAC;YACP,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,SAAS,EAAE,CAAC;YACZ,mBAAmB,EAAE,CAAC,EAAc,EAAE,EAAE,GAAE,CAAC;YAC3C,qBAAqB,EAAE,CAAC,EAAc,EAAE,EAAE,GAAE,CAAC;YAC7C,qBAAqB,EAAE,CAAC,EAAc,EAAE,EAAE,GAAE,CAAC;SAC9C,CAAC;QAEM,mBAAc,GAAa,EAAE,CAAC;QAyWtC,mBAAc,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;YACxC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAC7B,aAAa,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BAAgB,CAAC,WAAmB;QAClC,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED,0BAA0B;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC,0BAA0B,EAAE,CAAC;IACzD,CAAC;IA8BD,eAAe,CAAC,aAAkB;QAChC,IAAI,CAAC,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC;IACnD,CAAC;CACF"}
@@ -1,5 +1,13 @@
1
- import { IDrawingEvents, IContrastEvents, IDrawOpts, IPaintImage, IPaintImages, IUndoType } from "./coreTools/coreType";
1
+ import { IConvertObjType, IDrawingEvents, IContrastEvents, IDrawOpts, IPaintImages } from "./coreTools/coreType";
2
2
  import { CommToolsData } from "./CommToolsData";
3
+ import { EventRouter } from "./eventRouter";
4
+ import { SphereTool } from "./tools/SphereTool";
5
+ import { CrosshairTool } from "./tools/CrosshairTool";
6
+ import { ContrastTool } from "./tools/ContrastTool";
7
+ import { ZoomTool } from "./tools/ZoomTool";
8
+ import { EraserTool } from "./tools/EraserTool";
9
+ import { ImageStoreHelper } from "./tools/ImageStoreHelper";
10
+ import { UndoManager } from "./core";
3
11
  export declare class DrawToolCore extends CommToolsData {
4
12
  container: HTMLElement;
5
13
  mainAreaContainer: HTMLDivElement;
@@ -7,9 +15,23 @@ export declare class DrawToolCore extends CommToolsData {
7
15
  contrastEventPrameters: IContrastEvents;
8
16
  eraserUrls: string[];
9
17
  pencilUrls: string[];
10
- undoArray: Array<IUndoType>;
18
+ undoManager: UndoManager;
19
+ /** Snapshot of the active layer's slice captured on mouse-down (before drawing). */
20
+ private preDrawSlice;
21
+ private preDrawAxis;
22
+ private preDrawSliceIndex;
23
+ protected eventRouter: EventRouter | null;
24
+ protected sphereTool: SphereTool;
25
+ protected crosshairTool: CrosshairTool;
26
+ protected contrastTool: ContrastTool;
27
+ protected zoomTool: ZoomTool;
28
+ protected eraserTool: EraserTool;
29
+ protected imageStoreHelper: ImageStoreHelper;
11
30
  start: () => void;
12
- constructor(container: HTMLElement);
31
+ constructor(container: HTMLElement, options?: {
32
+ layers?: string[];
33
+ });
34
+ private initTools;
13
35
  private initDrawToolCore;
14
36
  setEraserUrls(urls: string[]): void;
15
37
  setPencilIconUrls(urls: string[]): void;
@@ -30,96 +52,55 @@ export declare class DrawToolCore extends CommToolsData {
30
52
  configMouseSliceWheel(): void;
31
53
  private enableCrosshair;
32
54
  drawImageOnEmptyImage(canvas: HTMLCanvasElement): void;
33
- /****************************Sphere calculate distance functions****************************************************/
34
- private getSpherePosition;
55
+ /****************************Sphere functions (delegated to SphereTool)****************************************************/
35
56
  drawCalculatorSphereOnEachViews(axis: "x" | "y" | "z"): void;
36
- /****************************Sphere functions****************************************************/
37
- private storeSphereImages;
38
57
  private drawSphereOnEachViews;
39
- /**
40
- *
41
- * @param ctx draw sphere canvas ctx
42
- * @param x width must be match the origin size, size factor 1, ignore the size factor
43
- * @param y height must be match the origin size, size factor 1, ignore the size factor
44
- * @param radius radius must be match the origin size, size factor 1, ignore the size factor
45
- * @param color sphere color
46
- */
47
- private drawSphereCore;
48
- private setSphereCanvasSize;
49
58
  private configMouseSphereWheel;
50
59
  drawCalculatorSphere(radius: number): void;
51
60
  drawSphere(mouseX: number, mouseY: number, radius: number): void;
52
- private clearSphereCanvas;
53
61
  /**
54
- * We generate the MRI slice from threejs based on mm, but when we display it is based on pixel size/distance.
55
- * So, the index munber on each axis (sagittal, axial, coronal) is the slice's depth in mm distance. And the width and height displayed on screen is the slice's width and height in pixel distance.
56
- *
57
- * When we switch into different axis' views, we need to convert current view's the depth to the pixel distance in other views width or height, and convert the current view's width or height from pixel distance to mm distance as other views' depth (slice index) in general.
58
- *
59
- * Then as for the crosshair (Cursor Inspector), we also need to convert the cursor point (x, y, z) to other views' (x, y, z).
60
- *
61
- * @param from "x" | "y" | "z", current view axis, "x: sagittle, y: coronal, z: axial".
62
- * @param to "x" | "y" | "z", target view axis (where you want jump to), "x: sagittle, y: coronal, z: axial".
63
- * @param cursorNumX number, cursor point x on current axis's slice. (pixel distance)
64
- * @param cursorNumY number, cursor point y on current axis's slice. (pixel distance)
65
- * @param currentSliceIndex number, current axis's slice's index/depth. (mm distance)
66
- * @returns
67
- */
68
- convertCursorPoint(from: "x" | "y" | "z", to: "x" | "y" | "z", cursorNumX: number, cursorNumY: number, currentSliceIndex: number): {
69
- currentIndex: number;
70
- oldIndex: number;
71
- convertCursorNumX: number;
72
- convertCursorNumY: number;
73
- } | undefined;
62
+ * Convert cursor point between axis views.
63
+ * Delegated to CrosshairTool.
64
+ */
65
+ convertCursorPoint(from: "x" | "y" | "z", to: "x" | "y" | "z", cursorNumX: number, cursorNumY: number, currentSliceIndex: number): IConvertObjType | undefined;
74
66
  private setUpSphereOrigins;
75
- /****************************label div controls****************************************************/
76
- getRestLabel(): ("label1" | "label2" | "label3")[];
77
- /**************************** Undo clear functions****************************************************/
78
- private getCurrentUndo;
67
+ /****************************layer div controls****************************************************/
68
+ getRestLayer(): string[];
69
+ /**************************** Undo/Redo functions (Phase 6 — Delta-based) ****************************/
79
70
  /**
80
- * Clear mask on current slice canvas
71
+ * Clear mask on current slice canvas.
72
+ *
73
+ * Phase 2: Clears the MaskVolume slice for all three layers,
74
+ * re-stores, and notifies external via getMask callback with clearFlag=true.
75
+ * Phase 6: Also records a MaskDelta for undo support.
81
76
  */
82
77
  clearPaint(): void;
83
- undoLastPainting(): void;
84
- /****************************Store images****************************************************/
85
- storeImageToAxis(index: number, paintedImages: IPaintImages, imageData: ImageData, axis?: "x" | "y" | "z"): void;
86
- storeAllImages(index: number, label: string): void;
87
- storeImageToLabel(index: number, canvas: HTMLCanvasElement, paintedImages: IPaintImages): ImageData;
88
- storeEachLayerImage(index: number, label: string): void;
89
- sliceArrayH(arr: Uint8ClampedArray, row: number, col: number): Uint8ClampedArray[];
90
- sliceArrayV(arr: Uint8ClampedArray, row: number, col: number): number[][];
91
78
  /**
92
- *
93
- * @param paintImageArray : the target view slice's marked images array
94
- * @param length : the target view slice's dimention (total slice index num)
95
- * @param ratio : the target slice image's width/height ratio of its dimention length
96
- * @param markedArr : current painted image's vertical 2d Array
97
- * @param targetWidth : the target image width
98
- * @param convertIndex : Mapping current image's index to target slice image's width/height pixel start point
79
+ * Undo the last drawing operation on the active layer.
80
+ * Restores the MaskVolume slice to its pre-draw state, re-renders
81
+ * the canvas, and notifies the backend.
99
82
  */
100
- replaceVerticalColPixels(paintImageArray: IPaintImage[], length: number, ratio: number, markedArr: number[][] | Uint8ClampedArray[], targetWidth: number, convertIndex: number): void;
83
+ undoLastPainting(): void;
101
84
  /**
102
- *
103
- * @param paintImageArray : the target view slice's marked images array
104
- * @param length : the target view slice's dimention (total slice index num)
105
- * @param ratio : the target slice image's width/height ratio of its dimention length
106
- * @param markedArr : current painted image's horizontal 2d Array
107
- * @param targetWidth : the target image width
108
- * @param convertIndex : Mapping current image's index to target slice image's width/height pixel start point
85
+ * Redo the last undone operation on the active layer.
86
+ * Reapplies the MaskVolume slice to its post-draw state, re-renders
87
+ * the canvas, and notifies the backend.
109
88
  */
110
- replaceHorizontalRowPixels(paintImageArray: IPaintImage[], length: number, ratio: number, markedArr: number[][] | Uint8ClampedArray[], targetWidth: number, convertIndex: number): void;
111
- /****************************** Utils for store image and itksnap core **************************************/
112
- checkSharedPlaceSlice(width: number, height: number, imageData: ImageData): Uint8ClampedArray;
113
- replaceArray(mainArr: number[] | Uint8ClampedArray, replaceArr: number[] | Uint8ClampedArray): void;
114
- findSliceInSharedPlace(): ImageData[];
115
- /******************************** Utils gui related functions ***************************************/
89
+ redoLastPainting(): void;
116
90
  /**
117
- * Set up root container events fns for drag function
118
- * @param callback
91
+ * Re-render a layer canvas from MaskVolume and composite to master.
92
+ * Called after writing oldSlice/newSlice back to the volume during undo/redo.
119
93
  */
94
+ private applyUndoRedoToCanvas;
95
+ /****************************Store images (delegated to ImageStoreHelper)****************************************************/
96
+ storeImageToAxis(index: number, paintedImages: IPaintImages, imageData: ImageData, axis?: "x" | "y" | "z"): void;
97
+ storeAllImages(index: number, layer: string): void;
98
+ storeImageToLayer(index: number, canvas: HTMLCanvasElement, paintedImages: IPaintImages): ImageData;
99
+ storeEachLayerImage(index: number, layer: string): void;
100
+ /******************************** Utils gui related functions (delegated to ContrastTool) ***************************************/
120
101
  setupConrastEvents(callback: (step: number, towards: "horizental" | "vertical") => void): void;
121
102
  configContrastDragMode: () => void;
122
103
  removeContrastDragMode: () => void;
123
- updateSlicesContrast(value: number, flag: string): void;
124
- repraintCurrentContrastSlice(): void;
104
+ updateSlicesContrast: (value: number, flag: string) => void;
105
+ repraintCurrentContrastSlice: () => void;
125
106
  }