copper3d 1.15.11 → 1.15.12
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/nrrd_tool.d.ts +21 -4
- package/dist/Utils/nrrd_tool.js +560 -305
- package/dist/Utils/nrrd_tool.js.map +1 -1
- package/dist/bundle.esm.js +562 -307
- package/dist/bundle.umd.js +562 -307
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/types/Utils/nrrd_tool.d.ts +21 -4
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/bundle.esm.js
CHANGED
|
@@ -67640,6 +67640,7 @@ class nrrd_tools {
|
|
|
67640
67640
|
label2: this.paintImagesLabel2,
|
|
67641
67641
|
label3: this.paintImagesLabel3,
|
|
67642
67642
|
};
|
|
67643
|
+
// used to store display marks with multiple labels
|
|
67643
67644
|
this.paintImages = { x: [], y: [], z: [] };
|
|
67644
67645
|
// store all contrast slices, include x, y, z orientation
|
|
67645
67646
|
this.allSlicesArray = [];
|
|
@@ -67667,7 +67668,6 @@ class nrrd_tools {
|
|
|
67667
67668
|
this.Is_Shift_Pressed = false;
|
|
67668
67669
|
this.Is_Draw = false;
|
|
67669
67670
|
this.sensitiveArray = [];
|
|
67670
|
-
this.handleWheelMove = () => { };
|
|
67671
67671
|
this.start = () => { };
|
|
67672
67672
|
this.undoArray = [];
|
|
67673
67673
|
this.initState = true;
|
|
@@ -67703,6 +67703,10 @@ class nrrd_tools {
|
|
|
67703
67703
|
isCursorSelect: false,
|
|
67704
67704
|
cursorPageX: 0,
|
|
67705
67705
|
cursorPageY: 0,
|
|
67706
|
+
// x: [cursorX, cursorY, sliceIndex]
|
|
67707
|
+
sphereOrigin: { x: [0, 0, 0], y: [0, 0, 0], z: [0, 0, 0] },
|
|
67708
|
+
spherePlanB: false,
|
|
67709
|
+
sphereRadius: 10,
|
|
67706
67710
|
Mouse_Over_x: 0,
|
|
67707
67711
|
Mouse_Over_y: 0,
|
|
67708
67712
|
Mouse_Over: false,
|
|
@@ -67752,12 +67756,9 @@ class nrrd_tools {
|
|
|
67752
67756
|
brushAndEraserSize: 15,
|
|
67753
67757
|
cursor: "dot",
|
|
67754
67758
|
label: "label1",
|
|
67759
|
+
sphere: false,
|
|
67755
67760
|
// EraserSize: 25,
|
|
67756
67761
|
clear: () => {
|
|
67757
|
-
// const text = "Are you sure remove annotations on Current slice?";
|
|
67758
|
-
// if (confirm(text) === true) {
|
|
67759
|
-
// this.clearPaint();
|
|
67760
|
-
// }
|
|
67761
67762
|
this.clearPaint();
|
|
67762
67763
|
},
|
|
67763
67764
|
clearAll: () => {
|
|
@@ -67791,6 +67792,36 @@ class nrrd_tools {
|
|
|
67791
67792
|
this.exportData();
|
|
67792
67793
|
},
|
|
67793
67794
|
};
|
|
67795
|
+
this.dragPrameters = {
|
|
67796
|
+
move: 0,
|
|
67797
|
+
y: 0,
|
|
67798
|
+
h: 0,
|
|
67799
|
+
sensivity: 1,
|
|
67800
|
+
handleOnDragMouseUp: (ev) => { },
|
|
67801
|
+
handleOnDragMouseDown: (ev) => { },
|
|
67802
|
+
handleOnDragMouseMove: (ev) => { },
|
|
67803
|
+
};
|
|
67804
|
+
this.drawingPrameters = {
|
|
67805
|
+
handleOnDrawingMouseDown: (ev) => { },
|
|
67806
|
+
handleOnDrawingMouseMove: (ev) => { },
|
|
67807
|
+
handleOnPanMouseMove: (ev) => { },
|
|
67808
|
+
handleOnDrawingMouseUp: (ev) => { },
|
|
67809
|
+
handleOnDrawingMouseLeave: (ev) => { },
|
|
67810
|
+
handleOnDrawingBrushCricleMove: (ev) => { },
|
|
67811
|
+
handleZoomWheel: (e) => { },
|
|
67812
|
+
handleSphereWheel: (e) => { },
|
|
67813
|
+
};
|
|
67814
|
+
this.configDragMode = () => {
|
|
67815
|
+
this.container.style.cursor = "pointer";
|
|
67816
|
+
this.container.addEventListener("pointerdown", this.dragPrameters.handleOnDragMouseDown, true);
|
|
67817
|
+
this.container.addEventListener("pointerup", this.dragPrameters.handleOnDragMouseUp, true);
|
|
67818
|
+
};
|
|
67819
|
+
this.removeDragMode = () => {
|
|
67820
|
+
this.container.style.cursor = "";
|
|
67821
|
+
this.container.removeEventListener("pointerdown", this.dragPrameters.handleOnDragMouseDown, true);
|
|
67822
|
+
this.container.removeEventListener("pointerup", this.dragPrameters.handleOnDragMouseUp, true);
|
|
67823
|
+
this.setIsDrawFalse(1000);
|
|
67824
|
+
};
|
|
67794
67825
|
this.drawLine = (x1, y1, x2, y2) => {
|
|
67795
67826
|
this.drawingCtx.beginPath();
|
|
67796
67827
|
this.drawingCtx.moveTo(x1, y1);
|
|
@@ -67823,7 +67854,7 @@ class nrrd_tools {
|
|
|
67823
67854
|
this.sensitiveArray.push((i + 1) / 20);
|
|
67824
67855
|
}
|
|
67825
67856
|
this.container.addEventListener("keydown", (ev) => {
|
|
67826
|
-
if (ev.key === "Shift") {
|
|
67857
|
+
if (ev.key === "Shift" && !this.gui_states.sphere) {
|
|
67827
67858
|
this.Is_Shift_Pressed = true;
|
|
67828
67859
|
this.nrrd_states.enableCursorChoose = false;
|
|
67829
67860
|
}
|
|
@@ -68003,12 +68034,94 @@ class nrrd_tools {
|
|
|
68003
68034
|
paintImages.z.push(initMark_z);
|
|
68004
68035
|
}
|
|
68005
68036
|
}
|
|
68037
|
+
convertCursorPoint(from, to, cursorNumX, cursorNumY, currentSliceIndex) {
|
|
68038
|
+
const nrrd = this.nrrd_states;
|
|
68039
|
+
const dimensions = nrrd.dimensions;
|
|
68040
|
+
const ratios = nrrd.ratios;
|
|
68041
|
+
const { nrrd_x_mm, nrrd_y_mm, nrrd_z_mm } = nrrd;
|
|
68042
|
+
let currentIndex = 0;
|
|
68043
|
+
let oldIndex = 0;
|
|
68044
|
+
let convertCursorNumX = 0;
|
|
68045
|
+
let convertCursorNumY = 0;
|
|
68046
|
+
const convertIndex = {
|
|
68047
|
+
x: {
|
|
68048
|
+
y: (val) => Math.ceil((val / nrrd_x_mm) * dimensions[0]),
|
|
68049
|
+
z: (val) => Math.ceil((val / nrrd_z_mm) * dimensions[2]),
|
|
68050
|
+
},
|
|
68051
|
+
y: {
|
|
68052
|
+
x: (val) => Math.ceil((val / nrrd_y_mm) * dimensions[1]),
|
|
68053
|
+
z: (val) => Math.ceil((val / nrrd_z_mm) * dimensions[2]),
|
|
68054
|
+
},
|
|
68055
|
+
z: {
|
|
68056
|
+
x: (val) => Math.ceil((val / nrrd_x_mm) * dimensions[0]),
|
|
68057
|
+
y: (val) => Math.ceil((val / nrrd_y_mm) * dimensions[1]),
|
|
68058
|
+
},
|
|
68059
|
+
};
|
|
68060
|
+
const convertCursor = {
|
|
68061
|
+
x: {
|
|
68062
|
+
y: (sliceIndex) => Math.ceil((sliceIndex / dimensions[0]) * nrrd_x_mm),
|
|
68063
|
+
z: (sliceIndex) => Math.ceil((sliceIndex / dimensions[0]) * nrrd_x_mm),
|
|
68064
|
+
},
|
|
68065
|
+
y: {
|
|
68066
|
+
x: (sliceIndex) => Math.ceil((sliceIndex / dimensions[1]) * nrrd_y_mm),
|
|
68067
|
+
z: (sliceIndex) => Math.ceil((sliceIndex / dimensions[1]) * nrrd_y_mm),
|
|
68068
|
+
},
|
|
68069
|
+
z: {
|
|
68070
|
+
x: (sliceIndex) => Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm),
|
|
68071
|
+
y: (sliceIndex) => Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm),
|
|
68072
|
+
},
|
|
68073
|
+
};
|
|
68074
|
+
if (from === to) {
|
|
68075
|
+
return;
|
|
68076
|
+
}
|
|
68077
|
+
if (from === "z" && to === "x") {
|
|
68078
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
68079
|
+
oldIndex = currentIndex * ratios[to];
|
|
68080
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
68081
|
+
convertCursorNumY = cursorNumY;
|
|
68082
|
+
}
|
|
68083
|
+
else if (from === "y" && to === "x") {
|
|
68084
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
68085
|
+
oldIndex = currentIndex * ratios.x;
|
|
68086
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
68087
|
+
convertCursorNumX = cursorNumY;
|
|
68088
|
+
}
|
|
68089
|
+
else if (from === "z" && to === "y") {
|
|
68090
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
68091
|
+
oldIndex = currentIndex * ratios[to];
|
|
68092
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
68093
|
+
convertCursorNumX = cursorNumX;
|
|
68094
|
+
}
|
|
68095
|
+
else if (from === "x" && to === "y") {
|
|
68096
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
68097
|
+
oldIndex = currentIndex * ratios[to];
|
|
68098
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
68099
|
+
convertCursorNumY = cursorNumX;
|
|
68100
|
+
}
|
|
68101
|
+
else if (from === "x" && to === "z") {
|
|
68102
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
68103
|
+
oldIndex = currentIndex * ratios[to];
|
|
68104
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
68105
|
+
convertCursorNumY = cursorNumY;
|
|
68106
|
+
}
|
|
68107
|
+
else if (from === "y" && to === "z") {
|
|
68108
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
68109
|
+
oldIndex = currentIndex * ratios.z;
|
|
68110
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
68111
|
+
convertCursorNumX = cursorNumX;
|
|
68112
|
+
}
|
|
68113
|
+
else {
|
|
68114
|
+
return;
|
|
68115
|
+
}
|
|
68116
|
+
return { currentIndex, oldIndex, convertCursorNumX, convertCursorNumY };
|
|
68117
|
+
}
|
|
68006
68118
|
/**
|
|
68007
68119
|
* Switch all contrast slices' orientation
|
|
68008
68120
|
* @param {string} aixs:"x" | "y" | "z"
|
|
68009
68121
|
* */
|
|
68010
|
-
setSliceOrientation(
|
|
68011
|
-
|
|
68122
|
+
setSliceOrientation(axisTo) {
|
|
68123
|
+
let convetObj;
|
|
68124
|
+
if (this.nrrd_states.enableCursorChoose || this.gui_states.sphere) {
|
|
68012
68125
|
if (this.axis === "z") {
|
|
68013
68126
|
this.cursorPage.z.index = this.nrrd_states.currentIndex;
|
|
68014
68127
|
this.cursorPage.z.cursorPageX = this.nrrd_states.cursorPageX;
|
|
@@ -68024,27 +68137,19 @@ class nrrd_tools {
|
|
|
68024
68137
|
this.cursorPage.y.cursorPageX = this.nrrd_states.cursorPageX;
|
|
68025
68138
|
this.cursorPage.y.cursorPageY = this.nrrd_states.cursorPageY;
|
|
68026
68139
|
}
|
|
68027
|
-
if (
|
|
68140
|
+
if (axisTo === "z") {
|
|
68028
68141
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.z.updated) {
|
|
68029
68142
|
if (this.axis === "x") {
|
|
68030
|
-
|
|
68031
|
-
|
|
68032
|
-
this.nrrd_states.oldIndex =
|
|
68033
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.z;
|
|
68034
|
-
this.nrrd_states.cursorPageX = Math.ceil((this.cursorPage.x.index / this.nrrd_states.dimensions[0]) *
|
|
68035
|
-
this.nrrd_states.nrrd_x_mm);
|
|
68143
|
+
// convert x to z
|
|
68144
|
+
convetObj = this.convertCursorPoint("x", "z", this.cursorPage.x.cursorPageX, this.cursorPage.x.cursorPageY, this.cursorPage.x.index);
|
|
68036
68145
|
}
|
|
68037
68146
|
if (this.axis === "y") {
|
|
68038
|
-
|
|
68039
|
-
|
|
68040
|
-
this.nrrd_states.oldIndex =
|
|
68041
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.z;
|
|
68042
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.y.index / this.nrrd_states.dimensions[1]) *
|
|
68043
|
-
this.nrrd_states.nrrd_y_mm);
|
|
68147
|
+
// convert y to z
|
|
68148
|
+
convetObj = this.convertCursorPoint("y", "z", this.cursorPage.y.cursorPageX, this.cursorPage.y.cursorPageY, this.cursorPage.y.index);
|
|
68044
68149
|
}
|
|
68045
|
-
this.cursorPage.z.updated = true;
|
|
68046
68150
|
}
|
|
68047
68151
|
else {
|
|
68152
|
+
// not cursor select, freedom to switch x -> z or y -> z and z -> x or z -> y
|
|
68048
68153
|
this.nrrd_states.currentIndex = this.cursorPage.z.index;
|
|
68049
68154
|
this.nrrd_states.oldIndex =
|
|
68050
68155
|
this.cursorPage.z.index * this.nrrd_states.ratios.z;
|
|
@@ -68052,28 +68157,19 @@ class nrrd_tools {
|
|
|
68052
68157
|
this.nrrd_states.cursorPageY = this.cursorPage.z.cursorPageY;
|
|
68053
68158
|
}
|
|
68054
68159
|
}
|
|
68055
|
-
else if (
|
|
68160
|
+
else if (axisTo === "x") {
|
|
68056
68161
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.x.updated) {
|
|
68057
68162
|
if (this.axis === "z") {
|
|
68058
|
-
|
|
68059
|
-
|
|
68060
|
-
this.nrrd_states.oldIndex =
|
|
68061
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.x;
|
|
68062
|
-
this.nrrd_states.cursorPageX = Math.floor((this.cursorPage.z.index / this.nrrd_states.dimensions[2]) *
|
|
68063
|
-
this.nrrd_states.nrrd_z_mm);
|
|
68163
|
+
// convert z to x
|
|
68164
|
+
convetObj = this.convertCursorPoint("z", "x", this.cursorPage.z.cursorPageX, this.cursorPage.z.cursorPageY, this.cursorPage.z.index);
|
|
68064
68165
|
}
|
|
68065
68166
|
if (this.axis === "y") {
|
|
68066
|
-
|
|
68067
|
-
|
|
68068
|
-
this.nrrd_states.oldIndex =
|
|
68069
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.x;
|
|
68070
|
-
this.nrrd_states.cursorPageX = this.cursorPage.y.cursorPageY;
|
|
68071
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.y.index / this.nrrd_states.dimensions[1]) *
|
|
68072
|
-
this.nrrd_states.nrrd_y_mm);
|
|
68167
|
+
// convert y to x
|
|
68168
|
+
convetObj = this.convertCursorPoint("y", "x", this.cursorPage.y.cursorPageX, this.cursorPage.y.cursorPageY, this.cursorPage.y.index);
|
|
68073
68169
|
}
|
|
68074
|
-
this.cursorPage.x.updated = true;
|
|
68075
68170
|
}
|
|
68076
68171
|
else {
|
|
68172
|
+
// not cursor select, freedom to switch z -> x or y -> x and x -> z or x -> y
|
|
68077
68173
|
this.nrrd_states.currentIndex = this.cursorPage.x.index;
|
|
68078
68174
|
this.nrrd_states.oldIndex =
|
|
68079
68175
|
this.cursorPage.x.index * this.nrrd_states.ratios.x;
|
|
@@ -68081,28 +68177,19 @@ class nrrd_tools {
|
|
|
68081
68177
|
this.nrrd_states.cursorPageY = this.cursorPage.x.cursorPageY;
|
|
68082
68178
|
}
|
|
68083
68179
|
}
|
|
68084
|
-
else if (
|
|
68180
|
+
else if (axisTo === "y") {
|
|
68085
68181
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.y.updated) {
|
|
68086
68182
|
if (this.axis === "z") {
|
|
68087
|
-
|
|
68088
|
-
|
|
68089
|
-
this.nrrd_states.oldIndex =
|
|
68090
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.y;
|
|
68091
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.z.index / this.nrrd_states.dimensions[2]) *
|
|
68092
|
-
this.nrrd_states.nrrd_z_mm);
|
|
68183
|
+
// convert z to y
|
|
68184
|
+
convetObj = this.convertCursorPoint("z", "y", this.cursorPage.z.cursorPageX, this.cursorPage.z.cursorPageY, this.cursorPage.z.index);
|
|
68093
68185
|
}
|
|
68094
68186
|
if (this.axis === "x") {
|
|
68095
|
-
|
|
68096
|
-
|
|
68097
|
-
this.nrrd_states.oldIndex =
|
|
68098
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.y;
|
|
68099
|
-
this.nrrd_states.cursorPageX = Math.ceil((this.cursorPage.x.index / this.nrrd_states.dimensions[0]) *
|
|
68100
|
-
this.nrrd_states.nrrd_x_mm);
|
|
68101
|
-
this.nrrd_states.cursorPageY = this.cursorPage.x.cursorPageX;
|
|
68187
|
+
// convert x to y
|
|
68188
|
+
convetObj = this.convertCursorPoint("x", "y", this.cursorPage.x.cursorPageX, this.cursorPage.x.cursorPageY, this.cursorPage.x.index);
|
|
68102
68189
|
}
|
|
68103
|
-
this.cursorPage.y.updated = true;
|
|
68104
68190
|
}
|
|
68105
68191
|
else {
|
|
68192
|
+
// not cursor select, freedom to switch z -> y or x -> y and y -> z or y -> x
|
|
68106
68193
|
this.nrrd_states.currentIndex = this.cursorPage.y.index;
|
|
68107
68194
|
this.nrrd_states.oldIndex =
|
|
68108
68195
|
this.cursorPage.y.index * this.nrrd_states.ratios.y;
|
|
@@ -68110,14 +68197,38 @@ class nrrd_tools {
|
|
|
68110
68197
|
this.nrrd_states.cursorPageY = this.cursorPage.y.cursorPageY;
|
|
68111
68198
|
}
|
|
68112
68199
|
}
|
|
68200
|
+
if (convetObj) {
|
|
68201
|
+
// update convert cursor point, when cursor select
|
|
68202
|
+
this.nrrd_states.currentIndex = convetObj.currentIndex;
|
|
68203
|
+
this.nrrd_states.oldIndex = convetObj.oldIndex;
|
|
68204
|
+
this.nrrd_states.cursorPageX = convetObj.convertCursorNumX;
|
|
68205
|
+
this.nrrd_states.cursorPageY = convetObj.convertCursorNumY;
|
|
68206
|
+
convetObj = undefined;
|
|
68207
|
+
switch (axisTo) {
|
|
68208
|
+
case "x":
|
|
68209
|
+
this.cursorPage.x.updated = true;
|
|
68210
|
+
break;
|
|
68211
|
+
case "y":
|
|
68212
|
+
this.cursorPage.y.updated = true;
|
|
68213
|
+
break;
|
|
68214
|
+
case "z":
|
|
68215
|
+
this.cursorPage.z.updated = true;
|
|
68216
|
+
break;
|
|
68217
|
+
}
|
|
68218
|
+
}
|
|
68113
68219
|
if (this.cursorPage.x.updated &&
|
|
68114
68220
|
this.cursorPage.y.updated &&
|
|
68115
68221
|
this.cursorPage.z.updated) {
|
|
68222
|
+
// one point convert to all axis, reset all updated status
|
|
68116
68223
|
this.nrrd_states.isCursorSelect = false;
|
|
68117
68224
|
}
|
|
68118
68225
|
}
|
|
68119
|
-
this.axis =
|
|
68226
|
+
this.axis = axisTo;
|
|
68120
68227
|
this.resetDisplaySlicesStatus();
|
|
68228
|
+
// for sphere plan a
|
|
68229
|
+
if (this.gui_states.sphere && !this.nrrd_states.spherePlanB) {
|
|
68230
|
+
this.drawSphere(this.nrrd_states.sphereOrigin[axisTo][0], this.nrrd_states.sphereOrigin[axisTo][1], this.nrrd_states.sphereRadius);
|
|
68231
|
+
}
|
|
68121
68232
|
}
|
|
68122
68233
|
addSkip(index) {
|
|
68123
68234
|
this.skipSlicesDic[index] = this.backUpDisplaySlices[index];
|
|
@@ -68443,62 +68554,51 @@ class nrrd_tools {
|
|
|
68443
68554
|
this.mainAreaContainer.appendChild(loadingbar);
|
|
68444
68555
|
}
|
|
68445
68556
|
drag(opts) {
|
|
68446
|
-
|
|
68447
|
-
let y;
|
|
68448
|
-
let h = this.container.offsetHeight;
|
|
68449
|
-
let sensivity = 1;
|
|
68450
|
-
let handleOnMouseUp;
|
|
68451
|
-
let handleOnMouseDown;
|
|
68452
|
-
let handleOnMouseMove;
|
|
68557
|
+
this.dragPrameters.h = this.container.offsetHeight;
|
|
68453
68558
|
this.sensitiveArray.reverse();
|
|
68454
68559
|
if (opts === null || opts === void 0 ? void 0 : opts.showNumber) {
|
|
68455
68560
|
this.container.appendChild(this.showDragNumberDiv);
|
|
68456
68561
|
}
|
|
68457
|
-
|
|
68562
|
+
this.dragPrameters.handleOnDragMouseDown = (ev) => {
|
|
68458
68563
|
// before start drag event, remove wheel event.
|
|
68459
|
-
this.drawingCanvas.removeEventListener("wheel", this.
|
|
68564
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
68460
68565
|
if (ev.button === 0) {
|
|
68461
68566
|
// this.setSyncsliceNum();
|
|
68462
|
-
y = ev.offsetY / h;
|
|
68463
|
-
this.container.addEventListener("pointermove",
|
|
68464
|
-
|
|
68567
|
+
this.dragPrameters.y = ev.offsetY / this.dragPrameters.h;
|
|
68568
|
+
this.container.addEventListener("pointermove", this.dragPrameters.handleOnDragMouseMove, false);
|
|
68569
|
+
this.dragPrameters.sensivity =
|
|
68570
|
+
this.sensitiveArray[this.gui_states.dragSensitivity - 1];
|
|
68465
68571
|
}
|
|
68466
68572
|
};
|
|
68467
|
-
|
|
68468
|
-
if (y - ev.offsetY / h >= 0) {
|
|
68469
|
-
move = -Math.ceil(((y - ev.offsetY / h) * 10) /
|
|
68573
|
+
this.dragPrameters.handleOnDragMouseMove = throttle((ev) => {
|
|
68574
|
+
if (this.dragPrameters.y - ev.offsetY / this.dragPrameters.h >= 0) {
|
|
68575
|
+
this.dragPrameters.move = -Math.ceil(((this.dragPrameters.y - ev.offsetY / this.dragPrameters.h) * 10) /
|
|
68576
|
+
this.dragPrameters.sensivity);
|
|
68470
68577
|
}
|
|
68471
68578
|
else {
|
|
68472
|
-
move = -Math.floor(((y - ev.offsetY / h) * 10) /
|
|
68579
|
+
this.dragPrameters.move = -Math.floor(((this.dragPrameters.y - ev.offsetY / this.dragPrameters.h) * 10) /
|
|
68580
|
+
this.dragPrameters.sensivity);
|
|
68473
68581
|
}
|
|
68474
|
-
this.updateIndex(move);
|
|
68582
|
+
this.updateIndex(this.dragPrameters.move);
|
|
68475
68583
|
(opts === null || opts === void 0 ? void 0 : opts.getSliceNum) &&
|
|
68476
68584
|
opts.getSliceNum(this.nrrd_states.currentIndex, this.nrrd_states.contrastNum);
|
|
68477
|
-
y = ev.offsetY / h;
|
|
68478
|
-
}, sensivity * 200);
|
|
68479
|
-
|
|
68585
|
+
this.dragPrameters.y = ev.offsetY / this.dragPrameters.h;
|
|
68586
|
+
}, this.dragPrameters.sensivity * 200);
|
|
68587
|
+
this.dragPrameters.handleOnDragMouseUp = (ev) => {
|
|
68480
68588
|
// after drag, add the wheel event
|
|
68481
|
-
this.drawingCanvas.addEventListener("wheel", this.
|
|
68589
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
68482
68590
|
this.setSyncsliceNum();
|
|
68483
|
-
this.container.removeEventListener("pointermove",
|
|
68484
|
-
};
|
|
68485
|
-
const configDragMode = () => {
|
|
68486
|
-
this.container.style.cursor = "pointer";
|
|
68487
|
-
this.container.addEventListener("pointerdown", handleOnMouseDown, true);
|
|
68488
|
-
this.container.addEventListener("pointerup", handleOnMouseUp, true);
|
|
68591
|
+
this.container.removeEventListener("pointermove", this.dragPrameters.handleOnDragMouseMove, false);
|
|
68489
68592
|
};
|
|
68490
|
-
configDragMode();
|
|
68593
|
+
this.configDragMode();
|
|
68491
68594
|
this.container.addEventListener("keydown", (ev) => {
|
|
68492
68595
|
if (ev.key === "Shift") {
|
|
68493
|
-
this.
|
|
68494
|
-
this.container.removeEventListener("pointerdown", handleOnMouseDown, true);
|
|
68495
|
-
this.container.removeEventListener("pointerup", handleOnMouseUp, false);
|
|
68496
|
-
this.setIsDrawFalse(1000);
|
|
68596
|
+
this.removeDragMode();
|
|
68497
68597
|
}
|
|
68498
68598
|
});
|
|
68499
68599
|
this.container.addEventListener("keyup", (ev) => {
|
|
68500
|
-
if (ev.key === "Shift") {
|
|
68501
|
-
configDragMode();
|
|
68600
|
+
if (ev.key === "Shift" && !this.gui_states.sphere) {
|
|
68601
|
+
this.configDragMode();
|
|
68502
68602
|
}
|
|
68503
68603
|
});
|
|
68504
68604
|
}
|
|
@@ -68656,6 +68756,7 @@ class nrrd_tools {
|
|
|
68656
68756
|
// draw lines starts position
|
|
68657
68757
|
let Is_Painting = false;
|
|
68658
68758
|
let lines = [];
|
|
68759
|
+
const clearArc = this.useEraser();
|
|
68659
68760
|
this.updateOriginAndChangedWH();
|
|
68660
68761
|
this.initAllCanvas();
|
|
68661
68762
|
this.configGui(modeFolder);
|
|
@@ -68665,12 +68766,15 @@ class nrrd_tools {
|
|
|
68665
68766
|
(_c = this.displayCtx) === null || _c === void 0 ? void 0 : _c.restore();
|
|
68666
68767
|
this.previousDrawingImage = this.drawingCtx.getImageData(0, 0, this.drawingCanvas.width, this.drawingCanvas.height);
|
|
68667
68768
|
// let a global variable to store the wheel move event
|
|
68668
|
-
this.
|
|
68769
|
+
this.drawingPrameters.handleZoomWheel = this.configMouseZoomWheel((_d = this.sceneIn) === null || _d === void 0 ? void 0 : _d.controls);
|
|
68669
68770
|
// init to add it
|
|
68670
|
-
this.drawingCanvas.addEventListener("wheel", this.
|
|
68771
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel, {
|
|
68671
68772
|
passive: false,
|
|
68672
68773
|
});
|
|
68673
|
-
|
|
68774
|
+
// sphere Wheel
|
|
68775
|
+
this.drawingPrameters.handleSphereWheel = this.configMouseSphereWheel();
|
|
68776
|
+
// pan move
|
|
68777
|
+
this.drawingPrameters.handleOnPanMouseMove = (e) => {
|
|
68674
68778
|
this.drawingCanvas.style.cursor = "grabbing";
|
|
68675
68779
|
this.nrrd_states.previousPanelL = e.clientX - panelMoveInnerX;
|
|
68676
68780
|
this.nrrd_states.previousPanelT = e.clientY - panelMoveInnerY;
|
|
@@ -68679,8 +68783,9 @@ class nrrd_tools {
|
|
|
68679
68783
|
this.displayCanvas.style.top = this.drawingCanvas.style.top =
|
|
68680
68784
|
this.nrrd_states.previousPanelT + "px";
|
|
68681
68785
|
};
|
|
68682
|
-
//
|
|
68683
|
-
|
|
68786
|
+
// brush circle move
|
|
68787
|
+
this.drawingPrameters.handleOnDrawingBrushCricleMove = (e) => {
|
|
68788
|
+
e.preventDefault();
|
|
68684
68789
|
this.nrrd_states.Mouse_Over_x = e.offsetX;
|
|
68685
68790
|
this.nrrd_states.Mouse_Over_y = e.offsetY;
|
|
68686
68791
|
if (this.nrrd_states.Mouse_Over_x === undefined) {
|
|
@@ -68689,21 +68794,31 @@ class nrrd_tools {
|
|
|
68689
68794
|
}
|
|
68690
68795
|
if (e.type === "mouseout") {
|
|
68691
68796
|
this.nrrd_states.Mouse_Over = false;
|
|
68692
|
-
this.drawingCanvas.removeEventListener("mousemove",
|
|
68797
|
+
this.drawingCanvas.removeEventListener("mousemove", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
68693
68798
|
}
|
|
68694
68799
|
else if (e.type === "mouseover") {
|
|
68695
68800
|
this.nrrd_states.Mouse_Over = true;
|
|
68696
|
-
this.drawingCanvas.addEventListener("mousemove",
|
|
68801
|
+
this.drawingCanvas.addEventListener("mousemove", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
68697
68802
|
}
|
|
68698
|
-
e.preventDefault();
|
|
68699
68803
|
};
|
|
68700
|
-
//
|
|
68701
|
-
this.
|
|
68702
|
-
|
|
68703
|
-
|
|
68704
|
-
|
|
68804
|
+
// drawing move
|
|
68805
|
+
this.drawingPrameters.handleOnDrawingMouseMove = (e) => {
|
|
68806
|
+
this.Is_Draw = true;
|
|
68807
|
+
if (Is_Painting) {
|
|
68808
|
+
if (this.gui_states.Eraser) {
|
|
68809
|
+
this.nrrd_states.stepClear = 1;
|
|
68810
|
+
// drawingCtx.clearRect(e.offsetX - 5, e.offsetY - 5, 25, 25);
|
|
68811
|
+
clearArc(e.offsetX, e.offsetY, this.gui_states.brushAndEraserSize);
|
|
68812
|
+
}
|
|
68813
|
+
else {
|
|
68814
|
+
lines.push({ x: e.offsetX, y: e.offsetY });
|
|
68815
|
+
this.paintOnCanvasLayer(e.offsetX, e.offsetY);
|
|
68816
|
+
}
|
|
68817
|
+
}
|
|
68818
|
+
};
|
|
68819
|
+
this.drawingPrameters.handleOnDrawingMouseDown = (e) => {
|
|
68705
68820
|
if (leftclicked || rightclicked) {
|
|
68706
|
-
this.drawingCanvas.removeEventListener("pointerup",
|
|
68821
|
+
this.drawingCanvas.removeEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68707
68822
|
this.drawingLayerMasterCtx.closePath();
|
|
68708
68823
|
return;
|
|
68709
68824
|
}
|
|
@@ -68714,7 +68829,7 @@ class nrrd_tools {
|
|
|
68714
68829
|
currentSliceIndex = this.mainPreSlice.index;
|
|
68715
68830
|
}
|
|
68716
68831
|
// remove it when mouse click down
|
|
68717
|
-
this.drawingCanvas.removeEventListener("wheel", this.
|
|
68832
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
68718
68833
|
if (e.button === 0) {
|
|
68719
68834
|
if (this.Is_Shift_Pressed) {
|
|
68720
68835
|
leftclicked = true;
|
|
@@ -68734,32 +68849,24 @@ class nrrd_tools {
|
|
|
68734
68849
|
}
|
|
68735
68850
|
this.nrrd_states.drawStartPos.set(e.offsetX, e.offsetY);
|
|
68736
68851
|
// this.drawingLayerMasterCtx.beginPath();
|
|
68737
|
-
this.drawingCanvas.addEventListener("pointerup",
|
|
68738
|
-
this.drawingCanvas.addEventListener("pointermove",
|
|
68852
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68853
|
+
this.drawingCanvas.addEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
68739
68854
|
}
|
|
68740
68855
|
else if (this.nrrd_states.enableCursorChoose) {
|
|
68741
68856
|
this.nrrd_states.cursorPageX =
|
|
68742
68857
|
e.offsetX / this.nrrd_states.sizeFoctor;
|
|
68743
68858
|
this.nrrd_states.cursorPageY =
|
|
68744
68859
|
e.offsetY / this.nrrd_states.sizeFoctor;
|
|
68745
|
-
this.
|
|
68746
|
-
|
|
68747
|
-
|
|
68748
|
-
|
|
68749
|
-
|
|
68750
|
-
|
|
68751
|
-
|
|
68752
|
-
|
|
68753
|
-
|
|
68754
|
-
|
|
68755
|
-
this.cursorPage.z.updated = false;
|
|
68756
|
-
break;
|
|
68757
|
-
case "z":
|
|
68758
|
-
this.cursorPage.x.updated = false;
|
|
68759
|
-
this.cursorPage.y.updated = false;
|
|
68760
|
-
this.cursorPage.z.updated = true;
|
|
68761
|
-
break;
|
|
68762
|
-
}
|
|
68860
|
+
this.enableCrosshair();
|
|
68861
|
+
}
|
|
68862
|
+
else if (this.gui_states.sphere) {
|
|
68863
|
+
console.log("sphere down");
|
|
68864
|
+
let mouseX = e.offsetX;
|
|
68865
|
+
let mouseY = e.offsetY;
|
|
68866
|
+
// draw circle
|
|
68867
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
68868
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68869
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68763
68870
|
}
|
|
68764
68871
|
}
|
|
68765
68872
|
else if (e.button === 2) {
|
|
@@ -68771,28 +68878,15 @@ class nrrd_tools {
|
|
|
68771
68878
|
panelMoveInnerX = e.clientX - offsetX;
|
|
68772
68879
|
panelMoveInnerY = e.clientY - offsetY;
|
|
68773
68880
|
this.drawingCanvas.style.cursor = "grab";
|
|
68774
|
-
this.drawingCanvas.addEventListener("pointerup",
|
|
68775
|
-
this.drawingCanvas.addEventListener("pointermove",
|
|
68881
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68882
|
+
this.drawingCanvas.addEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68776
68883
|
}
|
|
68777
68884
|
else {
|
|
68778
68885
|
return;
|
|
68779
68886
|
}
|
|
68780
|
-
}, true);
|
|
68781
|
-
const clearArc = this.useEraser();
|
|
68782
|
-
const handleOnPainterMove = (e) => {
|
|
68783
|
-
this.Is_Draw = true;
|
|
68784
|
-
if (Is_Painting) {
|
|
68785
|
-
if (this.gui_states.Eraser) {
|
|
68786
|
-
this.nrrd_states.stepClear = 1;
|
|
68787
|
-
// drawingCtx.clearRect(e.offsetX - 5, e.offsetY - 5, 25, 25);
|
|
68788
|
-
clearArc(e.offsetX, e.offsetY, this.gui_states.brushAndEraserSize);
|
|
68789
|
-
}
|
|
68790
|
-
else {
|
|
68791
|
-
lines.push({ x: e.offsetX, y: e.offsetY });
|
|
68792
|
-
this.paintOnCanvasLayer(e.offsetX, e.offsetY);
|
|
68793
|
-
}
|
|
68794
|
-
}
|
|
68795
68887
|
};
|
|
68888
|
+
// disable browser right click menu
|
|
68889
|
+
this.drawingCanvas.addEventListener("pointerdown", this.drawingPrameters.handleOnDrawingMouseDown, true);
|
|
68796
68890
|
const redrawPreviousImageToLabelCtx = (ctx, label = "default") => {
|
|
68797
68891
|
var _a;
|
|
68798
68892
|
let paintImages;
|
|
@@ -68819,13 +68913,13 @@ class nrrd_tools {
|
|
|
68819
68913
|
// draw privous image
|
|
68820
68914
|
ctx.drawImage(this.emptyCanvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
68821
68915
|
};
|
|
68822
|
-
|
|
68916
|
+
this.drawingPrameters.handleOnDrawingMouseUp = (e) => {
|
|
68823
68917
|
if (e.button === 0) {
|
|
68824
68918
|
if (this.Is_Shift_Pressed || Is_Painting) {
|
|
68825
68919
|
leftclicked = false;
|
|
68826
68920
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
68827
68921
|
ctx.closePath();
|
|
68828
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
68922
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
68829
68923
|
if (!this.gui_states.Eraser) {
|
|
68830
68924
|
if (this.gui_states.segmentation) {
|
|
68831
68925
|
this.drawingCanvasLayerMaster.width =
|
|
@@ -68873,20 +68967,66 @@ class nrrd_tools {
|
|
|
68873
68967
|
undoObj.layers[this.gui_states.label].push(image);
|
|
68874
68968
|
this.undoArray.push(undoObj);
|
|
68875
68969
|
}
|
|
68970
|
+
// add wheel after pointer up
|
|
68971
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel, {
|
|
68972
|
+
passive: false,
|
|
68973
|
+
});
|
|
68974
|
+
}
|
|
68975
|
+
else if (this.gui_states.sphere &&
|
|
68976
|
+
!this.nrrd_states.enableCursorChoose) {
|
|
68977
|
+
console.log("sphere up");
|
|
68978
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
68979
|
+
let mouseX = e.offsetX;
|
|
68980
|
+
let mouseY = e.offsetY;
|
|
68981
|
+
this.nrrd_states.sphereOrigin[this.axis] = [
|
|
68982
|
+
mouseX,
|
|
68983
|
+
mouseY,
|
|
68984
|
+
this.nrrd_states.currentIndex,
|
|
68985
|
+
];
|
|
68986
|
+
/************ */
|
|
68987
|
+
this.setUpSphereOrigins(mouseX, mouseY);
|
|
68988
|
+
console.log(this.nrrd_states.sphereOrigin);
|
|
68989
|
+
this.nrrd_states.cursorPageX = mouseX;
|
|
68990
|
+
this.nrrd_states.cursorPageY = mouseY;
|
|
68991
|
+
this.enableCrosshair();
|
|
68992
|
+
// plan B
|
|
68993
|
+
// findout all index in the sphere radius range in Axial view
|
|
68994
|
+
if (this.nrrd_states.spherePlanB) {
|
|
68995
|
+
// clear stroe images
|
|
68996
|
+
this.clearStoreImages();
|
|
68997
|
+
for (let i = 0; i < this.nrrd_states.sphereRadius; i++) {
|
|
68998
|
+
this.setEmptyCanvasSize();
|
|
68999
|
+
const preIndex = this.nrrd_states.currentIndex - i;
|
|
69000
|
+
const nextIndex = this.nrrd_states.currentIndex + i;
|
|
69001
|
+
if (preIndex < this.nrrd_states.minIndex ||
|
|
69002
|
+
nextIndex > this.nrrd_states.maxIndex)
|
|
69003
|
+
return;
|
|
69004
|
+
if (preIndex === nextIndex) {
|
|
69005
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
69006
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69007
|
+
this.storeAllImages(preIndex, "");
|
|
69008
|
+
}
|
|
69009
|
+
else {
|
|
69010
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius - i);
|
|
69011
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69012
|
+
this.storeAllImages(preIndex, "");
|
|
69013
|
+
this.storeAllImages(nextIndex, "");
|
|
69014
|
+
}
|
|
69015
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69016
|
+
}
|
|
69017
|
+
}
|
|
69018
|
+
console.log(this.nrrd_states.sphereRadius);
|
|
69019
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68876
69020
|
}
|
|
68877
69021
|
}
|
|
68878
69022
|
else if (e.button === 2) {
|
|
68879
69023
|
rightclicked = false;
|
|
68880
69024
|
this.drawingCanvas.style.cursor = "grab";
|
|
68881
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69025
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68882
69026
|
}
|
|
68883
69027
|
else {
|
|
68884
69028
|
return;
|
|
68885
69029
|
}
|
|
68886
|
-
// add wheel after pointer up
|
|
68887
|
-
this.drawingCanvas.addEventListener("wheel", this.handleWheelMove, {
|
|
68888
|
-
passive: false,
|
|
68889
|
-
});
|
|
68890
69030
|
if (!this.gui_states.segmentation) {
|
|
68891
69031
|
this.setIsDrawFalse(100);
|
|
68892
69032
|
}
|
|
@@ -68897,12 +69037,13 @@ class nrrd_tools {
|
|
|
68897
69037
|
if (leftclicked) {
|
|
68898
69038
|
leftclicked = false;
|
|
68899
69039
|
this.drawingLayerMasterCtx.closePath();
|
|
68900
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69040
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
69041
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68901
69042
|
}
|
|
68902
69043
|
if (rightclicked) {
|
|
68903
69044
|
rightclicked = false;
|
|
68904
69045
|
this.drawingCanvas.style.cursor = "grab";
|
|
68905
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69046
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68906
69047
|
}
|
|
68907
69048
|
this.setIsDrawFalse(100);
|
|
68908
69049
|
if (this.gui_states.segmentation) {
|
|
@@ -68957,6 +69098,68 @@ class nrrd_tools {
|
|
|
68957
69098
|
}
|
|
68958
69099
|
});
|
|
68959
69100
|
}
|
|
69101
|
+
enableCrosshair() {
|
|
69102
|
+
this.nrrd_states.isCursorSelect = true;
|
|
69103
|
+
switch (this.axis) {
|
|
69104
|
+
case "x":
|
|
69105
|
+
this.cursorPage.x.updated = true;
|
|
69106
|
+
this.cursorPage.y.updated = false;
|
|
69107
|
+
this.cursorPage.z.updated = false;
|
|
69108
|
+
break;
|
|
69109
|
+
case "y":
|
|
69110
|
+
this.cursorPage.x.updated = false;
|
|
69111
|
+
this.cursorPage.y.updated = true;
|
|
69112
|
+
this.cursorPage.z.updated = false;
|
|
69113
|
+
break;
|
|
69114
|
+
case "z":
|
|
69115
|
+
this.cursorPage.x.updated = false;
|
|
69116
|
+
this.cursorPage.y.updated = false;
|
|
69117
|
+
this.cursorPage.z.updated = true;
|
|
69118
|
+
break;
|
|
69119
|
+
}
|
|
69120
|
+
}
|
|
69121
|
+
setUpSphereOrigins(mouseX, mouseY) {
|
|
69122
|
+
const convertCursor = (from, to) => {
|
|
69123
|
+
const convertObj = this.convertCursorPoint(from, to, mouseX, mouseY, this.nrrd_states.currentIndex);
|
|
69124
|
+
return {
|
|
69125
|
+
convertCursorNumX: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumX,
|
|
69126
|
+
convertCursorNumY: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumY,
|
|
69127
|
+
currentIndex: convertObj === null || convertObj === void 0 ? void 0 : convertObj.currentIndex,
|
|
69128
|
+
};
|
|
69129
|
+
};
|
|
69130
|
+
const axisConversions = {
|
|
69131
|
+
x: { axisTo1: "y", axisTo2: "z" },
|
|
69132
|
+
y: { axisTo1: "z", axisTo2: "x" },
|
|
69133
|
+
z: { axisTo1: "x", axisTo2: "y" },
|
|
69134
|
+
};
|
|
69135
|
+
const { axisTo1, axisTo2 } = axisConversions[this.axis];
|
|
69136
|
+
this.nrrd_states.sphereOrigin[axisTo1] = [
|
|
69137
|
+
convertCursor(this.axis, axisTo1).convertCursorNumX,
|
|
69138
|
+
convertCursor(this.axis, axisTo1).convertCursorNumY,
|
|
69139
|
+
convertCursor(this.axis, axisTo1).currentIndex,
|
|
69140
|
+
];
|
|
69141
|
+
this.nrrd_states.sphereOrigin[axisTo2] = [
|
|
69142
|
+
convertCursor(this.axis, axisTo2).convertCursorNumX,
|
|
69143
|
+
convertCursor(this.axis, axisTo2).convertCursorNumY,
|
|
69144
|
+
convertCursor(this.axis, axisTo2).currentIndex,
|
|
69145
|
+
];
|
|
69146
|
+
}
|
|
69147
|
+
// for sphere
|
|
69148
|
+
drawSphereCore(ctx, x, y, radius) {
|
|
69149
|
+
ctx.beginPath();
|
|
69150
|
+
ctx.arc(x, y, radius * this.nrrd_states.sizeFoctor, 0, 2 * Math.PI);
|
|
69151
|
+
ctx.fillStyle = this.gui_states.fillColor;
|
|
69152
|
+
ctx.fill();
|
|
69153
|
+
ctx.closePath();
|
|
69154
|
+
}
|
|
69155
|
+
drawSphere(mouseX, mouseY, radius) {
|
|
69156
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
69157
|
+
// clear canvas
|
|
69158
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69159
|
+
this.drawingLayerMasterCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69160
|
+
this.drawSphereCore(ctx, mouseX, mouseY, radius);
|
|
69161
|
+
this.drawingLayerMasterCtx.drawImage(canvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
69162
|
+
}
|
|
68960
69163
|
// need to update
|
|
68961
69164
|
undoLastPainting() {
|
|
68962
69165
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
@@ -68974,7 +69177,9 @@ class nrrd_tools {
|
|
|
68974
69177
|
if (layerLen > 0) {
|
|
68975
69178
|
// const imageSrc = undo.undos[undo.undos.length - 1];
|
|
68976
69179
|
const image = layerUndos[layerLen - 1];
|
|
68977
|
-
|
|
69180
|
+
if (!!image) {
|
|
69181
|
+
ctx.drawImage(image, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
69182
|
+
}
|
|
68978
69183
|
}
|
|
68979
69184
|
if (undo.layers.label1.length > 0) {
|
|
68980
69185
|
const image = undo.layers.label1[undo.layers.label1.length - 1];
|
|
@@ -68998,9 +69203,29 @@ class nrrd_tools {
|
|
|
68998
69203
|
return item.sliceIndex === this.nrrd_states.currentIndex;
|
|
68999
69204
|
});
|
|
69000
69205
|
}
|
|
69001
|
-
|
|
69206
|
+
// drawing canvas mouse shpere wheel
|
|
69207
|
+
configMouseSphereWheel() {
|
|
69208
|
+
const sphereEvent = (e) => {
|
|
69209
|
+
e.preventDefault();
|
|
69210
|
+
if (e.deltaY < 0) {
|
|
69211
|
+
this.nrrd_states.sphereRadius += 1;
|
|
69212
|
+
}
|
|
69213
|
+
else {
|
|
69214
|
+
this.nrrd_states.sphereRadius -= 1;
|
|
69215
|
+
}
|
|
69216
|
+
// limited the radius max and min
|
|
69217
|
+
this.nrrd_states.sphereRadius = Math.max(1, Math.min(this.nrrd_states.sphereRadius, 50));
|
|
69218
|
+
// get mouse position
|
|
69219
|
+
const mouseX = e.offsetX;
|
|
69220
|
+
const mouseY = e.offsetY;
|
|
69221
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
69222
|
+
};
|
|
69223
|
+
return sphereEvent;
|
|
69224
|
+
}
|
|
69225
|
+
// drawing canvas mouse zoom wheel
|
|
69226
|
+
configMouseZoomWheel(controls) {
|
|
69002
69227
|
let moveDistance = 1;
|
|
69003
|
-
const
|
|
69228
|
+
const handleZoomWheelMove = (e) => {
|
|
69004
69229
|
if (this.Is_Shift_Pressed) {
|
|
69005
69230
|
return;
|
|
69006
69231
|
}
|
|
@@ -69036,7 +69261,7 @@ class nrrd_tools {
|
|
|
69036
69261
|
}
|
|
69037
69262
|
this.nrrd_states.sizeFoctor = moveDistance;
|
|
69038
69263
|
};
|
|
69039
|
-
return
|
|
69264
|
+
return handleZoomWheelMove;
|
|
69040
69265
|
}
|
|
69041
69266
|
useEraser() {
|
|
69042
69267
|
const clearArc = (x, y, radius) => {
|
|
@@ -69147,155 +69372,6 @@ class nrrd_tools {
|
|
|
69147
69372
|
}
|
|
69148
69373
|
return { ctx, canvas };
|
|
69149
69374
|
}
|
|
69150
|
-
configGui(modeFolder) {
|
|
69151
|
-
if (modeFolder.__controllers.length > 0)
|
|
69152
|
-
this.removeGuiFolderChilden(modeFolder);
|
|
69153
|
-
modeFolder.open();
|
|
69154
|
-
const actionsFolder = modeFolder.addFolder("Default Actions");
|
|
69155
|
-
actionsFolder
|
|
69156
|
-
.add(this.gui_states, "label", ["label1", "label2", "label3"])
|
|
69157
|
-
.onChange((val) => {
|
|
69158
|
-
if (val === "label1") {
|
|
69159
|
-
this.gui_states.fillColor = "#00ff00";
|
|
69160
|
-
this.gui_states.brushColor = "#00ff00";
|
|
69161
|
-
}
|
|
69162
|
-
else if (val === "label2") {
|
|
69163
|
-
this.gui_states.fillColor = "#ff0000";
|
|
69164
|
-
this.gui_states.brushColor = "#ff0000";
|
|
69165
|
-
}
|
|
69166
|
-
else if (val === "label3") {
|
|
69167
|
-
this.gui_states.fillColor = "#0000ff";
|
|
69168
|
-
this.gui_states.brushColor = "#0000ff";
|
|
69169
|
-
}
|
|
69170
|
-
});
|
|
69171
|
-
actionsFolder
|
|
69172
|
-
.add(this.gui_states, "cursor", ["crosshair", "pencil", "dot"])
|
|
69173
|
-
.name("cursor icons")
|
|
69174
|
-
.onChange((value) => {
|
|
69175
|
-
if (value === "crosshair") {
|
|
69176
|
-
this.nrrd_states.defaultPaintCursor = "crosshair";
|
|
69177
|
-
}
|
|
69178
|
-
if (value === "pencil") {
|
|
69179
|
-
this.nrrd_states.defaultPaintCursor =
|
|
69180
|
-
"url(https://raw.githubusercontent.com/LinkunGao/copper3d_icons/main/icons/pencil-black.svg), auto";
|
|
69181
|
-
}
|
|
69182
|
-
if (value === "dot") {
|
|
69183
|
-
this.nrrd_states.defaultPaintCursor =
|
|
69184
|
-
"url(https://raw.githubusercontent.com/LinkunGao/copper3d-datasets/main/icons/dot.svg) 12 12,auto";
|
|
69185
|
-
}
|
|
69186
|
-
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69187
|
-
});
|
|
69188
|
-
actionsFolder
|
|
69189
|
-
.add(this.gui_states, "mainAreaSize")
|
|
69190
|
-
.name("zoom")
|
|
69191
|
-
.min(1)
|
|
69192
|
-
.max(8)
|
|
69193
|
-
.onFinishChange((factor) => {
|
|
69194
|
-
this.resetPaintArea();
|
|
69195
|
-
this.nrrd_states.sizeFoctor = factor;
|
|
69196
|
-
this.resizePaintArea(factor);
|
|
69197
|
-
});
|
|
69198
|
-
actionsFolder.add(this.gui_states, "resetZoom");
|
|
69199
|
-
actionsFolder
|
|
69200
|
-
.add(this.gui_states, "globalAlpha")
|
|
69201
|
-
.name("opacity")
|
|
69202
|
-
.min(0.1)
|
|
69203
|
-
.max(1)
|
|
69204
|
-
.step(0.01);
|
|
69205
|
-
actionsFolder.add(this.gui_states, "segmentation").name("Pencil");
|
|
69206
|
-
actionsFolder
|
|
69207
|
-
.add(this.gui_states, "brushAndEraserSize")
|
|
69208
|
-
.min(5)
|
|
69209
|
-
.max(50)
|
|
69210
|
-
.step(1)
|
|
69211
|
-
.onChange(() => {
|
|
69212
|
-
if (this.gui_states.Eraser) {
|
|
69213
|
-
this.eraserUrls.length > 0
|
|
69214
|
-
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69215
|
-
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69216
|
-
}
|
|
69217
|
-
});
|
|
69218
|
-
actionsFolder.add(this.gui_states, "Eraser").onChange((value) => {
|
|
69219
|
-
this.gui_states.Eraser = value;
|
|
69220
|
-
if (this.gui_states.Eraser) {
|
|
69221
|
-
this.eraserUrls.length > 0
|
|
69222
|
-
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69223
|
-
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69224
|
-
}
|
|
69225
|
-
else {
|
|
69226
|
-
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69227
|
-
}
|
|
69228
|
-
});
|
|
69229
|
-
actionsFolder.add(this.gui_states, "clear");
|
|
69230
|
-
actionsFolder.add(this.gui_states, "clearAll");
|
|
69231
|
-
actionsFolder.add(this.gui_states, "undo");
|
|
69232
|
-
actionsFolder
|
|
69233
|
-
.add(this.mainPreSlice.volume, "windowHigh", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69234
|
-
.name("Image contrast")
|
|
69235
|
-
.onChange((value) => {
|
|
69236
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69237
|
-
this.updateSlicesContrast(value, "windowHigh");
|
|
69238
|
-
})
|
|
69239
|
-
.onFinishChange(() => {
|
|
69240
|
-
this.repraintAllContrastSlices();
|
|
69241
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69242
|
-
});
|
|
69243
|
-
actionsFolder.add(this.gui_states, "exportMarks");
|
|
69244
|
-
const advanceFolder = modeFolder.addFolder("Advance settings");
|
|
69245
|
-
advanceFolder
|
|
69246
|
-
.add(this.gui_states, "dragSensitivity")
|
|
69247
|
-
.min(1)
|
|
69248
|
-
.max(this.nrrd_states.Max_sensitive)
|
|
69249
|
-
.step(1);
|
|
69250
|
-
const segmentationFolder = advanceFolder.addFolder("Pencil settings");
|
|
69251
|
-
segmentationFolder
|
|
69252
|
-
.add(this.gui_states, "lineWidth")
|
|
69253
|
-
.name("outerLineWidth")
|
|
69254
|
-
.min(1.7)
|
|
69255
|
-
.max(3)
|
|
69256
|
-
.step(0.01);
|
|
69257
|
-
segmentationFolder.addColor(this.gui_states, "color");
|
|
69258
|
-
segmentationFolder.addColor(this.gui_states, "fillColor");
|
|
69259
|
-
const bushFolder = advanceFolder.addFolder("Brush settings");
|
|
69260
|
-
bushFolder.addColor(this.gui_states, "brushColor");
|
|
69261
|
-
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
|
|
69262
|
-
advanceFolder.add(this.gui_states, "downloadCurrentMask");
|
|
69263
|
-
const contrastFolder = advanceFolder.addFolder("contrast advance settings");
|
|
69264
|
-
contrastFolder
|
|
69265
|
-
.add(this.mainPreSlice.volume, "lowerThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69266
|
-
.name("Lower Threshold")
|
|
69267
|
-
.onChange((value) => {
|
|
69268
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69269
|
-
this.updateSlicesContrast(value, "lowerThreshold");
|
|
69270
|
-
})
|
|
69271
|
-
.onFinishChange(() => {
|
|
69272
|
-
this.repraintAllContrastSlices();
|
|
69273
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69274
|
-
});
|
|
69275
|
-
contrastFolder
|
|
69276
|
-
.add(this.mainPreSlice.volume, "upperThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69277
|
-
.name("Upper Threshold")
|
|
69278
|
-
.onChange((value) => {
|
|
69279
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69280
|
-
this.updateSlicesContrast(value, "upperThreshold");
|
|
69281
|
-
})
|
|
69282
|
-
.onFinishChange(() => {
|
|
69283
|
-
this.repraintAllContrastSlices();
|
|
69284
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69285
|
-
});
|
|
69286
|
-
contrastFolder
|
|
69287
|
-
.add(this.mainPreSlice.volume, "windowLow", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69288
|
-
.name("Window Low")
|
|
69289
|
-
.onChange((value) => {
|
|
69290
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69291
|
-
this.updateSlicesContrast(value, "windowLow");
|
|
69292
|
-
})
|
|
69293
|
-
.onFinishChange(() => {
|
|
69294
|
-
this.repraintAllContrastSlices();
|
|
69295
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69296
|
-
});
|
|
69297
|
-
actionsFolder.open();
|
|
69298
|
-
}
|
|
69299
69375
|
updateSlicesContrast(value, flag) {
|
|
69300
69376
|
switch (flag) {
|
|
69301
69377
|
case "lowerThreshold":
|
|
@@ -69474,12 +69550,15 @@ class nrrd_tools {
|
|
|
69474
69550
|
delete dic[key];
|
|
69475
69551
|
}
|
|
69476
69552
|
}
|
|
69553
|
+
drawImageOnEmptyImage(canvas) {
|
|
69554
|
+
this.emptyCtx.drawImage(canvas, 0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69555
|
+
}
|
|
69477
69556
|
storeAllImages(index, label) {
|
|
69478
69557
|
// const image: HTMLImageElement = new Image();
|
|
69479
69558
|
// resize the drawing image data
|
|
69480
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
69559
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
69481
69560
|
this.setEmptyCanvasSize();
|
|
69482
|
-
this.
|
|
69561
|
+
this.drawImageOnEmptyImage(this.drawingCanvasLayerMaster);
|
|
69483
69562
|
}
|
|
69484
69563
|
let imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69485
69564
|
// 1.12.23
|
|
@@ -69549,7 +69628,7 @@ class nrrd_tools {
|
|
|
69549
69628
|
break;
|
|
69550
69629
|
}
|
|
69551
69630
|
this.storeImageToAxis(index, this.paintImages, imageData);
|
|
69552
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
69631
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
69553
69632
|
this.storeEachLayerImage(index, label);
|
|
69554
69633
|
}
|
|
69555
69634
|
}
|
|
@@ -69584,7 +69663,7 @@ class nrrd_tools {
|
|
|
69584
69663
|
storeImageToLabel(index, canvas, paintedImages) {
|
|
69585
69664
|
if (!this.nrrd_states.loadMaskJson) {
|
|
69586
69665
|
this.setEmptyCanvasSize();
|
|
69587
|
-
this.
|
|
69666
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69588
69667
|
}
|
|
69589
69668
|
const imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69590
69669
|
this.storeImageToAxis(index, paintedImages, imageData);
|
|
@@ -69806,10 +69885,186 @@ class nrrd_tools {
|
|
|
69806
69885
|
// }
|
|
69807
69886
|
// };
|
|
69808
69887
|
}
|
|
69888
|
+
configGui(modeFolder) {
|
|
69889
|
+
if (modeFolder.__controllers.length > 0)
|
|
69890
|
+
this.removeGuiFolderChilden(modeFolder);
|
|
69891
|
+
modeFolder.open();
|
|
69892
|
+
const actionsFolder = modeFolder.addFolder("Default Actions");
|
|
69893
|
+
actionsFolder
|
|
69894
|
+
.add(this.gui_states, "label", ["label1", "label2", "label3"])
|
|
69895
|
+
.onChange((val) => {
|
|
69896
|
+
if (val === "label1") {
|
|
69897
|
+
this.gui_states.fillColor = "#00ff00";
|
|
69898
|
+
this.gui_states.brushColor = "#00ff00";
|
|
69899
|
+
}
|
|
69900
|
+
else if (val === "label2") {
|
|
69901
|
+
this.gui_states.fillColor = "#ff0000";
|
|
69902
|
+
this.gui_states.brushColor = "#ff0000";
|
|
69903
|
+
}
|
|
69904
|
+
else if (val === "label3") {
|
|
69905
|
+
this.gui_states.fillColor = "#0000ff";
|
|
69906
|
+
this.gui_states.brushColor = "#0000ff";
|
|
69907
|
+
}
|
|
69908
|
+
});
|
|
69909
|
+
actionsFolder
|
|
69910
|
+
.add(this.gui_states, "cursor", ["crosshair", "pencil", "dot"])
|
|
69911
|
+
.name("cursor icons")
|
|
69912
|
+
.onChange((value) => {
|
|
69913
|
+
if (value === "crosshair") {
|
|
69914
|
+
this.nrrd_states.defaultPaintCursor = "crosshair";
|
|
69915
|
+
}
|
|
69916
|
+
if (value === "pencil") {
|
|
69917
|
+
this.nrrd_states.defaultPaintCursor =
|
|
69918
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d_icons/main/icons/pencil-black.svg), auto";
|
|
69919
|
+
}
|
|
69920
|
+
if (value === "dot") {
|
|
69921
|
+
this.nrrd_states.defaultPaintCursor =
|
|
69922
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d-datasets/main/icons/dot.svg) 12 12,auto";
|
|
69923
|
+
}
|
|
69924
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69925
|
+
});
|
|
69926
|
+
actionsFolder
|
|
69927
|
+
.add(this.gui_states, "mainAreaSize")
|
|
69928
|
+
.name("zoom")
|
|
69929
|
+
.min(1)
|
|
69930
|
+
.max(8)
|
|
69931
|
+
.onFinishChange((factor) => {
|
|
69932
|
+
this.resetPaintArea();
|
|
69933
|
+
this.nrrd_states.sizeFoctor = factor;
|
|
69934
|
+
this.resizePaintArea(factor);
|
|
69935
|
+
});
|
|
69936
|
+
actionsFolder.add(this.gui_states, "resetZoom");
|
|
69937
|
+
actionsFolder
|
|
69938
|
+
.add(this.gui_states, "globalAlpha")
|
|
69939
|
+
.name("opacity")
|
|
69940
|
+
.min(0.1)
|
|
69941
|
+
.max(1)
|
|
69942
|
+
.step(0.01);
|
|
69943
|
+
actionsFolder
|
|
69944
|
+
.add(this.gui_states, "segmentation")
|
|
69945
|
+
.name("Pencil")
|
|
69946
|
+
.onChange(() => {
|
|
69947
|
+
if (this.gui_states.segmentation) {
|
|
69948
|
+
// add canvas brush circle move event listeners
|
|
69949
|
+
this.drawingCanvas.removeEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69950
|
+
this.drawingCanvas.removeEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69951
|
+
}
|
|
69952
|
+
else {
|
|
69953
|
+
// add canvas brush circle move event listeners
|
|
69954
|
+
this.drawingCanvas.addEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69955
|
+
this.drawingCanvas.addEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69956
|
+
}
|
|
69957
|
+
});
|
|
69958
|
+
actionsFolder
|
|
69959
|
+
.add(this.gui_states, "sphere")
|
|
69960
|
+
.name("Sphere")
|
|
69961
|
+
.onChange(() => {
|
|
69962
|
+
if (this.gui_states.sphere) {
|
|
69963
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
69964
|
+
this.removeDragMode();
|
|
69965
|
+
}
|
|
69966
|
+
else {
|
|
69967
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
69968
|
+
this.configDragMode();
|
|
69969
|
+
}
|
|
69970
|
+
});
|
|
69971
|
+
actionsFolder
|
|
69972
|
+
.add(this.gui_states, "brushAndEraserSize")
|
|
69973
|
+
.min(5)
|
|
69974
|
+
.max(50)
|
|
69975
|
+
.step(1)
|
|
69976
|
+
.onChange(() => {
|
|
69977
|
+
if (this.gui_states.Eraser) {
|
|
69978
|
+
this.eraserUrls.length > 0
|
|
69979
|
+
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69980
|
+
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69981
|
+
}
|
|
69982
|
+
});
|
|
69983
|
+
actionsFolder.add(this.gui_states, "Eraser").onChange((value) => {
|
|
69984
|
+
this.gui_states.Eraser = value;
|
|
69985
|
+
if (this.gui_states.Eraser) {
|
|
69986
|
+
this.eraserUrls.length > 0
|
|
69987
|
+
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69988
|
+
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69989
|
+
}
|
|
69990
|
+
else {
|
|
69991
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69992
|
+
}
|
|
69993
|
+
});
|
|
69994
|
+
actionsFolder.add(this.gui_states, "clear");
|
|
69995
|
+
actionsFolder.add(this.gui_states, "clearAll");
|
|
69996
|
+
actionsFolder.add(this.gui_states, "undo");
|
|
69997
|
+
actionsFolder
|
|
69998
|
+
.add(this.mainPreSlice.volume, "windowHigh", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69999
|
+
.name("Image contrast")
|
|
70000
|
+
.onChange((value) => {
|
|
70001
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70002
|
+
this.updateSlicesContrast(value, "windowHigh");
|
|
70003
|
+
})
|
|
70004
|
+
.onFinishChange(() => {
|
|
70005
|
+
this.repraintAllContrastSlices();
|
|
70006
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70007
|
+
});
|
|
70008
|
+
actionsFolder.add(this.gui_states, "exportMarks");
|
|
70009
|
+
const advanceFolder = modeFolder.addFolder("Advance settings");
|
|
70010
|
+
advanceFolder
|
|
70011
|
+
.add(this.gui_states, "dragSensitivity")
|
|
70012
|
+
.min(1)
|
|
70013
|
+
.max(this.nrrd_states.Max_sensitive)
|
|
70014
|
+
.step(1);
|
|
70015
|
+
const segmentationFolder = advanceFolder.addFolder("Pencil settings");
|
|
70016
|
+
segmentationFolder
|
|
70017
|
+
.add(this.gui_states, "lineWidth")
|
|
70018
|
+
.name("outerLineWidth")
|
|
70019
|
+
.min(1.7)
|
|
70020
|
+
.max(3)
|
|
70021
|
+
.step(0.01);
|
|
70022
|
+
segmentationFolder.addColor(this.gui_states, "color");
|
|
70023
|
+
segmentationFolder.addColor(this.gui_states, "fillColor");
|
|
70024
|
+
const bushFolder = advanceFolder.addFolder("Brush settings");
|
|
70025
|
+
bushFolder.addColor(this.gui_states, "brushColor");
|
|
70026
|
+
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
|
|
70027
|
+
advanceFolder.add(this.gui_states, "downloadCurrentMask");
|
|
70028
|
+
const contrastFolder = advanceFolder.addFolder("contrast advance settings");
|
|
70029
|
+
contrastFolder
|
|
70030
|
+
.add(this.mainPreSlice.volume, "lowerThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70031
|
+
.name("Lower Threshold")
|
|
70032
|
+
.onChange((value) => {
|
|
70033
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70034
|
+
this.updateSlicesContrast(value, "lowerThreshold");
|
|
70035
|
+
})
|
|
70036
|
+
.onFinishChange(() => {
|
|
70037
|
+
this.repraintAllContrastSlices();
|
|
70038
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70039
|
+
});
|
|
70040
|
+
contrastFolder
|
|
70041
|
+
.add(this.mainPreSlice.volume, "upperThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70042
|
+
.name("Upper Threshold")
|
|
70043
|
+
.onChange((value) => {
|
|
70044
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70045
|
+
this.updateSlicesContrast(value, "upperThreshold");
|
|
70046
|
+
})
|
|
70047
|
+
.onFinishChange(() => {
|
|
70048
|
+
this.repraintAllContrastSlices();
|
|
70049
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70050
|
+
});
|
|
70051
|
+
contrastFolder
|
|
70052
|
+
.add(this.mainPreSlice.volume, "windowLow", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70053
|
+
.name("Window Low")
|
|
70054
|
+
.onChange((value) => {
|
|
70055
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70056
|
+
this.updateSlicesContrast(value, "windowLow");
|
|
70057
|
+
})
|
|
70058
|
+
.onFinishChange(() => {
|
|
70059
|
+
this.repraintAllContrastSlices();
|
|
70060
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70061
|
+
});
|
|
70062
|
+
actionsFolder.open();
|
|
70063
|
+
}
|
|
69809
70064
|
}
|
|
69810
70065
|
|
|
69811
70066
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
69812
|
-
const REVISION = "v1.15.
|
|
69813
|
-
console.log("%cCopper3D Visualisation %cBeta:v1.15.
|
|
70067
|
+
const REVISION = "v1.15.12";
|
|
70068
|
+
console.log("%cCopper3D Visualisation %cBeta:v1.15.12", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
|
|
69814
70069
|
|
|
69815
70070
|
export { CameraViewPoint, Copper3dTrackballControls, REVISION, addBoxHelper, addLabelToScene, configKiwriousHeart, convert3DPostoScreenPos, convertScreenPosto3DPos, copperMScene, copperMSceneRenderer, copperRenderer, copperRendererOnDemond, copperScene, copperSceneOnDemond, createTexture2D_NRRD, fullScreenListenner, kiwrious, loading, nrrd_tools, setHDRFilePath };
|