copper3d 1.15.11 → 1.15.13
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 +559 -305
- package/dist/Utils/nrrd_tool.js.map +1 -1
- package/dist/bundle.esm.js +561 -307
- package/dist/bundle.umd.js +561 -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,23 @@ 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
|
-
this.cursorPage.y.updated = true;
|
|
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
|
+
let mouseX = e.offsetX;
|
|
68864
|
+
let mouseY = e.offsetY;
|
|
68865
|
+
// draw circle
|
|
68866
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
68867
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68868
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68763
68869
|
}
|
|
68764
68870
|
}
|
|
68765
68871
|
else if (e.button === 2) {
|
|
@@ -68771,28 +68877,15 @@ class nrrd_tools {
|
|
|
68771
68877
|
panelMoveInnerX = e.clientX - offsetX;
|
|
68772
68878
|
panelMoveInnerY = e.clientY - offsetY;
|
|
68773
68879
|
this.drawingCanvas.style.cursor = "grab";
|
|
68774
|
-
this.drawingCanvas.addEventListener("pointerup",
|
|
68775
|
-
this.drawingCanvas.addEventListener("pointermove",
|
|
68880
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68881
|
+
this.drawingCanvas.addEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68776
68882
|
}
|
|
68777
68883
|
else {
|
|
68778
68884
|
return;
|
|
68779
68885
|
}
|
|
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
68886
|
};
|
|
68887
|
+
// disable browser right click menu
|
|
68888
|
+
this.drawingCanvas.addEventListener("pointerdown", this.drawingPrameters.handleOnDrawingMouseDown, true);
|
|
68796
68889
|
const redrawPreviousImageToLabelCtx = (ctx, label = "default") => {
|
|
68797
68890
|
var _a;
|
|
68798
68891
|
let paintImages;
|
|
@@ -68819,13 +68912,13 @@ class nrrd_tools {
|
|
|
68819
68912
|
// draw privous image
|
|
68820
68913
|
ctx.drawImage(this.emptyCanvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
68821
68914
|
};
|
|
68822
|
-
|
|
68915
|
+
this.drawingPrameters.handleOnDrawingMouseUp = (e) => {
|
|
68823
68916
|
if (e.button === 0) {
|
|
68824
68917
|
if (this.Is_Shift_Pressed || Is_Painting) {
|
|
68825
68918
|
leftclicked = false;
|
|
68826
68919
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
68827
68920
|
ctx.closePath();
|
|
68828
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
68921
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
68829
68922
|
if (!this.gui_states.Eraser) {
|
|
68830
68923
|
if (this.gui_states.segmentation) {
|
|
68831
68924
|
this.drawingCanvasLayerMaster.width =
|
|
@@ -68873,20 +68966,63 @@ class nrrd_tools {
|
|
|
68873
68966
|
undoObj.layers[this.gui_states.label].push(image);
|
|
68874
68967
|
this.undoArray.push(undoObj);
|
|
68875
68968
|
}
|
|
68969
|
+
// add wheel after pointer up
|
|
68970
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel, {
|
|
68971
|
+
passive: false,
|
|
68972
|
+
});
|
|
68973
|
+
}
|
|
68974
|
+
else if (this.gui_states.sphere &&
|
|
68975
|
+
!this.nrrd_states.enableCursorChoose) {
|
|
68976
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
68977
|
+
let mouseX = e.offsetX;
|
|
68978
|
+
let mouseY = e.offsetY;
|
|
68979
|
+
this.nrrd_states.sphereOrigin[this.axis] = [
|
|
68980
|
+
mouseX,
|
|
68981
|
+
mouseY,
|
|
68982
|
+
this.nrrd_states.currentIndex,
|
|
68983
|
+
];
|
|
68984
|
+
/************ */
|
|
68985
|
+
this.setUpSphereOrigins(mouseX, mouseY);
|
|
68986
|
+
this.nrrd_states.cursorPageX = mouseX;
|
|
68987
|
+
this.nrrd_states.cursorPageY = mouseY;
|
|
68988
|
+
this.enableCrosshair();
|
|
68989
|
+
// plan B
|
|
68990
|
+
// findout all index in the sphere radius range in Axial view
|
|
68991
|
+
if (this.nrrd_states.spherePlanB) {
|
|
68992
|
+
// clear stroe images
|
|
68993
|
+
this.clearStoreImages();
|
|
68994
|
+
for (let i = 0; i < this.nrrd_states.sphereRadius; i++) {
|
|
68995
|
+
this.setEmptyCanvasSize();
|
|
68996
|
+
const preIndex = this.nrrd_states.currentIndex - i;
|
|
68997
|
+
const nextIndex = this.nrrd_states.currentIndex + i;
|
|
68998
|
+
if (preIndex < this.nrrd_states.minIndex ||
|
|
68999
|
+
nextIndex > this.nrrd_states.maxIndex)
|
|
69000
|
+
return;
|
|
69001
|
+
if (preIndex === nextIndex) {
|
|
69002
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
69003
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69004
|
+
this.storeAllImages(preIndex, "");
|
|
69005
|
+
}
|
|
69006
|
+
else {
|
|
69007
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius - i);
|
|
69008
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69009
|
+
this.storeAllImages(preIndex, "");
|
|
69010
|
+
this.storeAllImages(nextIndex, "");
|
|
69011
|
+
}
|
|
69012
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69013
|
+
}
|
|
69014
|
+
}
|
|
69015
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68876
69016
|
}
|
|
68877
69017
|
}
|
|
68878
69018
|
else if (e.button === 2) {
|
|
68879
69019
|
rightclicked = false;
|
|
68880
69020
|
this.drawingCanvas.style.cursor = "grab";
|
|
68881
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69021
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68882
69022
|
}
|
|
68883
69023
|
else {
|
|
68884
69024
|
return;
|
|
68885
69025
|
}
|
|
68886
|
-
// add wheel after pointer up
|
|
68887
|
-
this.drawingCanvas.addEventListener("wheel", this.handleWheelMove, {
|
|
68888
|
-
passive: false,
|
|
68889
|
-
});
|
|
68890
69026
|
if (!this.gui_states.segmentation) {
|
|
68891
69027
|
this.setIsDrawFalse(100);
|
|
68892
69028
|
}
|
|
@@ -68897,12 +69033,13 @@ class nrrd_tools {
|
|
|
68897
69033
|
if (leftclicked) {
|
|
68898
69034
|
leftclicked = false;
|
|
68899
69035
|
this.drawingLayerMasterCtx.closePath();
|
|
68900
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69036
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
69037
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68901
69038
|
}
|
|
68902
69039
|
if (rightclicked) {
|
|
68903
69040
|
rightclicked = false;
|
|
68904
69041
|
this.drawingCanvas.style.cursor = "grab";
|
|
68905
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69042
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68906
69043
|
}
|
|
68907
69044
|
this.setIsDrawFalse(100);
|
|
68908
69045
|
if (this.gui_states.segmentation) {
|
|
@@ -68957,6 +69094,68 @@ class nrrd_tools {
|
|
|
68957
69094
|
}
|
|
68958
69095
|
});
|
|
68959
69096
|
}
|
|
69097
|
+
enableCrosshair() {
|
|
69098
|
+
this.nrrd_states.isCursorSelect = true;
|
|
69099
|
+
switch (this.axis) {
|
|
69100
|
+
case "x":
|
|
69101
|
+
this.cursorPage.x.updated = true;
|
|
69102
|
+
this.cursorPage.y.updated = false;
|
|
69103
|
+
this.cursorPage.z.updated = false;
|
|
69104
|
+
break;
|
|
69105
|
+
case "y":
|
|
69106
|
+
this.cursorPage.x.updated = false;
|
|
69107
|
+
this.cursorPage.y.updated = true;
|
|
69108
|
+
this.cursorPage.z.updated = false;
|
|
69109
|
+
break;
|
|
69110
|
+
case "z":
|
|
69111
|
+
this.cursorPage.x.updated = false;
|
|
69112
|
+
this.cursorPage.y.updated = false;
|
|
69113
|
+
this.cursorPage.z.updated = true;
|
|
69114
|
+
break;
|
|
69115
|
+
}
|
|
69116
|
+
}
|
|
69117
|
+
setUpSphereOrigins(mouseX, mouseY) {
|
|
69118
|
+
const convertCursor = (from, to) => {
|
|
69119
|
+
const convertObj = this.convertCursorPoint(from, to, mouseX, mouseY, this.nrrd_states.currentIndex);
|
|
69120
|
+
return {
|
|
69121
|
+
convertCursorNumX: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumX,
|
|
69122
|
+
convertCursorNumY: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumY,
|
|
69123
|
+
currentIndex: convertObj === null || convertObj === void 0 ? void 0 : convertObj.currentIndex,
|
|
69124
|
+
};
|
|
69125
|
+
};
|
|
69126
|
+
const axisConversions = {
|
|
69127
|
+
x: { axisTo1: "y", axisTo2: "z" },
|
|
69128
|
+
y: { axisTo1: "z", axisTo2: "x" },
|
|
69129
|
+
z: { axisTo1: "x", axisTo2: "y" },
|
|
69130
|
+
};
|
|
69131
|
+
const { axisTo1, axisTo2 } = axisConversions[this.axis];
|
|
69132
|
+
this.nrrd_states.sphereOrigin[axisTo1] = [
|
|
69133
|
+
convertCursor(this.axis, axisTo1).convertCursorNumX,
|
|
69134
|
+
convertCursor(this.axis, axisTo1).convertCursorNumY,
|
|
69135
|
+
convertCursor(this.axis, axisTo1).currentIndex,
|
|
69136
|
+
];
|
|
69137
|
+
this.nrrd_states.sphereOrigin[axisTo2] = [
|
|
69138
|
+
convertCursor(this.axis, axisTo2).convertCursorNumX,
|
|
69139
|
+
convertCursor(this.axis, axisTo2).convertCursorNumY,
|
|
69140
|
+
convertCursor(this.axis, axisTo2).currentIndex,
|
|
69141
|
+
];
|
|
69142
|
+
}
|
|
69143
|
+
// for sphere
|
|
69144
|
+
drawSphereCore(ctx, x, y, radius) {
|
|
69145
|
+
ctx.beginPath();
|
|
69146
|
+
ctx.arc(x, y, radius * this.nrrd_states.sizeFoctor, 0, 2 * Math.PI);
|
|
69147
|
+
ctx.fillStyle = this.gui_states.fillColor;
|
|
69148
|
+
ctx.fill();
|
|
69149
|
+
ctx.closePath();
|
|
69150
|
+
}
|
|
69151
|
+
drawSphere(mouseX, mouseY, radius) {
|
|
69152
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
69153
|
+
// clear canvas
|
|
69154
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69155
|
+
this.drawingLayerMasterCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69156
|
+
this.drawSphereCore(ctx, mouseX, mouseY, radius);
|
|
69157
|
+
this.drawingLayerMasterCtx.drawImage(canvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
69158
|
+
}
|
|
68960
69159
|
// need to update
|
|
68961
69160
|
undoLastPainting() {
|
|
68962
69161
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
@@ -68974,7 +69173,9 @@ class nrrd_tools {
|
|
|
68974
69173
|
if (layerLen > 0) {
|
|
68975
69174
|
// const imageSrc = undo.undos[undo.undos.length - 1];
|
|
68976
69175
|
const image = layerUndos[layerLen - 1];
|
|
68977
|
-
|
|
69176
|
+
if (!!image) {
|
|
69177
|
+
ctx.drawImage(image, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
69178
|
+
}
|
|
68978
69179
|
}
|
|
68979
69180
|
if (undo.layers.label1.length > 0) {
|
|
68980
69181
|
const image = undo.layers.label1[undo.layers.label1.length - 1];
|
|
@@ -68998,9 +69199,29 @@ class nrrd_tools {
|
|
|
68998
69199
|
return item.sliceIndex === this.nrrd_states.currentIndex;
|
|
68999
69200
|
});
|
|
69000
69201
|
}
|
|
69001
|
-
|
|
69202
|
+
// drawing canvas mouse shpere wheel
|
|
69203
|
+
configMouseSphereWheel() {
|
|
69204
|
+
const sphereEvent = (e) => {
|
|
69205
|
+
e.preventDefault();
|
|
69206
|
+
if (e.deltaY < 0) {
|
|
69207
|
+
this.nrrd_states.sphereRadius += 1;
|
|
69208
|
+
}
|
|
69209
|
+
else {
|
|
69210
|
+
this.nrrd_states.sphereRadius -= 1;
|
|
69211
|
+
}
|
|
69212
|
+
// limited the radius max and min
|
|
69213
|
+
this.nrrd_states.sphereRadius = Math.max(1, Math.min(this.nrrd_states.sphereRadius, 50));
|
|
69214
|
+
// get mouse position
|
|
69215
|
+
const mouseX = e.offsetX;
|
|
69216
|
+
const mouseY = e.offsetY;
|
|
69217
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
69218
|
+
};
|
|
69219
|
+
return sphereEvent;
|
|
69220
|
+
}
|
|
69221
|
+
// drawing canvas mouse zoom wheel
|
|
69222
|
+
configMouseZoomWheel(controls) {
|
|
69002
69223
|
let moveDistance = 1;
|
|
69003
|
-
const
|
|
69224
|
+
const handleZoomWheelMove = (e) => {
|
|
69004
69225
|
if (this.Is_Shift_Pressed) {
|
|
69005
69226
|
return;
|
|
69006
69227
|
}
|
|
@@ -69036,7 +69257,7 @@ class nrrd_tools {
|
|
|
69036
69257
|
}
|
|
69037
69258
|
this.nrrd_states.sizeFoctor = moveDistance;
|
|
69038
69259
|
};
|
|
69039
|
-
return
|
|
69260
|
+
return handleZoomWheelMove;
|
|
69040
69261
|
}
|
|
69041
69262
|
useEraser() {
|
|
69042
69263
|
const clearArc = (x, y, radius) => {
|
|
@@ -69147,155 +69368,6 @@ class nrrd_tools {
|
|
|
69147
69368
|
}
|
|
69148
69369
|
return { ctx, canvas };
|
|
69149
69370
|
}
|
|
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
69371
|
updateSlicesContrast(value, flag) {
|
|
69300
69372
|
switch (flag) {
|
|
69301
69373
|
case "lowerThreshold":
|
|
@@ -69474,12 +69546,15 @@ class nrrd_tools {
|
|
|
69474
69546
|
delete dic[key];
|
|
69475
69547
|
}
|
|
69476
69548
|
}
|
|
69549
|
+
drawImageOnEmptyImage(canvas) {
|
|
69550
|
+
this.emptyCtx.drawImage(canvas, 0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69551
|
+
}
|
|
69477
69552
|
storeAllImages(index, label) {
|
|
69478
69553
|
// const image: HTMLImageElement = new Image();
|
|
69479
69554
|
// resize the drawing image data
|
|
69480
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
69555
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
69481
69556
|
this.setEmptyCanvasSize();
|
|
69482
|
-
this.
|
|
69557
|
+
this.drawImageOnEmptyImage(this.drawingCanvasLayerMaster);
|
|
69483
69558
|
}
|
|
69484
69559
|
let imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69485
69560
|
// 1.12.23
|
|
@@ -69549,7 +69624,7 @@ class nrrd_tools {
|
|
|
69549
69624
|
break;
|
|
69550
69625
|
}
|
|
69551
69626
|
this.storeImageToAxis(index, this.paintImages, imageData);
|
|
69552
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
69627
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
69553
69628
|
this.storeEachLayerImage(index, label);
|
|
69554
69629
|
}
|
|
69555
69630
|
}
|
|
@@ -69584,7 +69659,7 @@ class nrrd_tools {
|
|
|
69584
69659
|
storeImageToLabel(index, canvas, paintedImages) {
|
|
69585
69660
|
if (!this.nrrd_states.loadMaskJson) {
|
|
69586
69661
|
this.setEmptyCanvasSize();
|
|
69587
|
-
this.
|
|
69662
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69588
69663
|
}
|
|
69589
69664
|
const imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69590
69665
|
this.storeImageToAxis(index, paintedImages, imageData);
|
|
@@ -69806,10 +69881,189 @@ class nrrd_tools {
|
|
|
69806
69881
|
// }
|
|
69807
69882
|
// };
|
|
69808
69883
|
}
|
|
69884
|
+
configGui(modeFolder) {
|
|
69885
|
+
if (modeFolder.__controllers.length > 0)
|
|
69886
|
+
this.removeGuiFolderChilden(modeFolder);
|
|
69887
|
+
modeFolder.open();
|
|
69888
|
+
const actionsFolder = modeFolder.addFolder("Default Actions");
|
|
69889
|
+
actionsFolder
|
|
69890
|
+
.add(this.gui_states, "label", ["label1", "label2", "label3"])
|
|
69891
|
+
.onChange((val) => {
|
|
69892
|
+
if (val === "label1") {
|
|
69893
|
+
this.gui_states.fillColor = "#00ff00";
|
|
69894
|
+
this.gui_states.brushColor = "#00ff00";
|
|
69895
|
+
}
|
|
69896
|
+
else if (val === "label2") {
|
|
69897
|
+
this.gui_states.fillColor = "#ff0000";
|
|
69898
|
+
this.gui_states.brushColor = "#ff0000";
|
|
69899
|
+
}
|
|
69900
|
+
else if (val === "label3") {
|
|
69901
|
+
this.gui_states.fillColor = "#0000ff";
|
|
69902
|
+
this.gui_states.brushColor = "#0000ff";
|
|
69903
|
+
}
|
|
69904
|
+
});
|
|
69905
|
+
actionsFolder
|
|
69906
|
+
.add(this.gui_states, "cursor", ["crosshair", "pencil", "dot"])
|
|
69907
|
+
.name("cursor icons")
|
|
69908
|
+
.onChange((value) => {
|
|
69909
|
+
if (value === "crosshair") {
|
|
69910
|
+
this.nrrd_states.defaultPaintCursor = "crosshair";
|
|
69911
|
+
}
|
|
69912
|
+
if (value === "pencil") {
|
|
69913
|
+
this.nrrd_states.defaultPaintCursor =
|
|
69914
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d_icons/main/icons/pencil-black.svg), auto";
|
|
69915
|
+
}
|
|
69916
|
+
if (value === "dot") {
|
|
69917
|
+
this.nrrd_states.defaultPaintCursor =
|
|
69918
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d-datasets/main/icons/dot.svg) 12 12,auto";
|
|
69919
|
+
}
|
|
69920
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69921
|
+
});
|
|
69922
|
+
actionsFolder
|
|
69923
|
+
.add(this.gui_states, "mainAreaSize")
|
|
69924
|
+
.name("zoom")
|
|
69925
|
+
.min(1)
|
|
69926
|
+
.max(8)
|
|
69927
|
+
.onFinishChange((factor) => {
|
|
69928
|
+
this.resetPaintArea();
|
|
69929
|
+
this.nrrd_states.sizeFoctor = factor;
|
|
69930
|
+
this.resizePaintArea(factor);
|
|
69931
|
+
});
|
|
69932
|
+
actionsFolder.add(this.gui_states, "resetZoom");
|
|
69933
|
+
actionsFolder
|
|
69934
|
+
.add(this.gui_states, "globalAlpha")
|
|
69935
|
+
.name("opacity")
|
|
69936
|
+
.min(0.1)
|
|
69937
|
+
.max(1)
|
|
69938
|
+
.step(0.01);
|
|
69939
|
+
actionsFolder
|
|
69940
|
+
.add(this.gui_states, "segmentation")
|
|
69941
|
+
.name("Pencil")
|
|
69942
|
+
.onChange(() => {
|
|
69943
|
+
if (this.gui_states.segmentation) {
|
|
69944
|
+
// add canvas brush circle move event listeners
|
|
69945
|
+
this.drawingCanvas.removeEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69946
|
+
this.drawingCanvas.removeEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69947
|
+
}
|
|
69948
|
+
else {
|
|
69949
|
+
// add canvas brush circle move event listeners
|
|
69950
|
+
this.drawingCanvas.addEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69951
|
+
this.drawingCanvas.addEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69952
|
+
}
|
|
69953
|
+
});
|
|
69954
|
+
actionsFolder
|
|
69955
|
+
.add(this.gui_states, "sphere")
|
|
69956
|
+
.name("Sphere")
|
|
69957
|
+
.onChange(() => {
|
|
69958
|
+
if (this.gui_states.sphere) {
|
|
69959
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
69960
|
+
this.removeDragMode();
|
|
69961
|
+
}
|
|
69962
|
+
else {
|
|
69963
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
69964
|
+
this.configDragMode();
|
|
69965
|
+
// clear canvas
|
|
69966
|
+
this.clearPaint();
|
|
69967
|
+
this.clearStoreImages();
|
|
69968
|
+
}
|
|
69969
|
+
});
|
|
69970
|
+
actionsFolder
|
|
69971
|
+
.add(this.gui_states, "brushAndEraserSize")
|
|
69972
|
+
.min(5)
|
|
69973
|
+
.max(50)
|
|
69974
|
+
.step(1)
|
|
69975
|
+
.onChange(() => {
|
|
69976
|
+
if (this.gui_states.Eraser) {
|
|
69977
|
+
this.eraserUrls.length > 0
|
|
69978
|
+
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69979
|
+
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69980
|
+
}
|
|
69981
|
+
});
|
|
69982
|
+
actionsFolder.add(this.gui_states, "Eraser").onChange((value) => {
|
|
69983
|
+
this.gui_states.Eraser = value;
|
|
69984
|
+
if (this.gui_states.Eraser) {
|
|
69985
|
+
this.eraserUrls.length > 0
|
|
69986
|
+
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69987
|
+
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69988
|
+
}
|
|
69989
|
+
else {
|
|
69990
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69991
|
+
}
|
|
69992
|
+
});
|
|
69993
|
+
actionsFolder.add(this.gui_states, "clear");
|
|
69994
|
+
actionsFolder.add(this.gui_states, "clearAll");
|
|
69995
|
+
actionsFolder.add(this.gui_states, "undo");
|
|
69996
|
+
actionsFolder
|
|
69997
|
+
.add(this.mainPreSlice.volume, "windowHigh", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69998
|
+
.name("Image contrast")
|
|
69999
|
+
.onChange((value) => {
|
|
70000
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70001
|
+
this.updateSlicesContrast(value, "windowHigh");
|
|
70002
|
+
})
|
|
70003
|
+
.onFinishChange(() => {
|
|
70004
|
+
this.repraintAllContrastSlices();
|
|
70005
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70006
|
+
});
|
|
70007
|
+
actionsFolder.add(this.gui_states, "exportMarks");
|
|
70008
|
+
const advanceFolder = modeFolder.addFolder("Advance settings");
|
|
70009
|
+
advanceFolder
|
|
70010
|
+
.add(this.gui_states, "dragSensitivity")
|
|
70011
|
+
.min(1)
|
|
70012
|
+
.max(this.nrrd_states.Max_sensitive)
|
|
70013
|
+
.step(1);
|
|
70014
|
+
const segmentationFolder = advanceFolder.addFolder("Pencil settings");
|
|
70015
|
+
segmentationFolder
|
|
70016
|
+
.add(this.gui_states, "lineWidth")
|
|
70017
|
+
.name("outerLineWidth")
|
|
70018
|
+
.min(1.7)
|
|
70019
|
+
.max(3)
|
|
70020
|
+
.step(0.01);
|
|
70021
|
+
segmentationFolder.addColor(this.gui_states, "color");
|
|
70022
|
+
segmentationFolder.addColor(this.gui_states, "fillColor");
|
|
70023
|
+
const bushFolder = advanceFolder.addFolder("Brush settings");
|
|
70024
|
+
bushFolder.addColor(this.gui_states, "brushColor");
|
|
70025
|
+
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
|
|
70026
|
+
advanceFolder.add(this.gui_states, "downloadCurrentMask");
|
|
70027
|
+
const contrastFolder = advanceFolder.addFolder("contrast advance settings");
|
|
70028
|
+
contrastFolder
|
|
70029
|
+
.add(this.mainPreSlice.volume, "lowerThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70030
|
+
.name("Lower Threshold")
|
|
70031
|
+
.onChange((value) => {
|
|
70032
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70033
|
+
this.updateSlicesContrast(value, "lowerThreshold");
|
|
70034
|
+
})
|
|
70035
|
+
.onFinishChange(() => {
|
|
70036
|
+
this.repraintAllContrastSlices();
|
|
70037
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70038
|
+
});
|
|
70039
|
+
contrastFolder
|
|
70040
|
+
.add(this.mainPreSlice.volume, "upperThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70041
|
+
.name("Upper Threshold")
|
|
70042
|
+
.onChange((value) => {
|
|
70043
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70044
|
+
this.updateSlicesContrast(value, "upperThreshold");
|
|
70045
|
+
})
|
|
70046
|
+
.onFinishChange(() => {
|
|
70047
|
+
this.repraintAllContrastSlices();
|
|
70048
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70049
|
+
});
|
|
70050
|
+
contrastFolder
|
|
70051
|
+
.add(this.mainPreSlice.volume, "windowLow", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70052
|
+
.name("Window Low")
|
|
70053
|
+
.onChange((value) => {
|
|
70054
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70055
|
+
this.updateSlicesContrast(value, "windowLow");
|
|
70056
|
+
})
|
|
70057
|
+
.onFinishChange(() => {
|
|
70058
|
+
this.repraintAllContrastSlices();
|
|
70059
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70060
|
+
});
|
|
70061
|
+
actionsFolder.open();
|
|
70062
|
+
}
|
|
69809
70063
|
}
|
|
69810
70064
|
|
|
69811
70065
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
69812
|
-
const REVISION = "v1.15.
|
|
69813
|
-
console.log("%cCopper3D Visualisation %cBeta:v1.15.
|
|
70066
|
+
const REVISION = "v1.15.13";
|
|
70067
|
+
console.log("%cCopper3D Visualisation %cBeta:v1.15.13", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
|
|
69814
70068
|
|
|
69815
70069
|
export { CameraViewPoint, Copper3dTrackballControls, REVISION, addBoxHelper, addLabelToScene, configKiwriousHeart, convert3DPostoScreenPos, convertScreenPosto3DPos, copperMScene, copperMSceneRenderer, copperRenderer, copperRendererOnDemond, copperScene, copperSceneOnDemond, createTexture2D_NRRD, fullScreenListenner, kiwrious, loading, nrrd_tools, setHDRFilePath };
|