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.umd.js
CHANGED
|
@@ -67648,6 +67648,7 @@
|
|
|
67648
67648
|
label2: this.paintImagesLabel2,
|
|
67649
67649
|
label3: this.paintImagesLabel3,
|
|
67650
67650
|
};
|
|
67651
|
+
// used to store display marks with multiple labels
|
|
67651
67652
|
this.paintImages = { x: [], y: [], z: [] };
|
|
67652
67653
|
// store all contrast slices, include x, y, z orientation
|
|
67653
67654
|
this.allSlicesArray = [];
|
|
@@ -67675,7 +67676,6 @@
|
|
|
67675
67676
|
this.Is_Shift_Pressed = false;
|
|
67676
67677
|
this.Is_Draw = false;
|
|
67677
67678
|
this.sensitiveArray = [];
|
|
67678
|
-
this.handleWheelMove = () => { };
|
|
67679
67679
|
this.start = () => { };
|
|
67680
67680
|
this.undoArray = [];
|
|
67681
67681
|
this.initState = true;
|
|
@@ -67711,6 +67711,10 @@
|
|
|
67711
67711
|
isCursorSelect: false,
|
|
67712
67712
|
cursorPageX: 0,
|
|
67713
67713
|
cursorPageY: 0,
|
|
67714
|
+
// x: [cursorX, cursorY, sliceIndex]
|
|
67715
|
+
sphereOrigin: { x: [0, 0, 0], y: [0, 0, 0], z: [0, 0, 0] },
|
|
67716
|
+
spherePlanB: false,
|
|
67717
|
+
sphereRadius: 10,
|
|
67714
67718
|
Mouse_Over_x: 0,
|
|
67715
67719
|
Mouse_Over_y: 0,
|
|
67716
67720
|
Mouse_Over: false,
|
|
@@ -67760,12 +67764,9 @@
|
|
|
67760
67764
|
brushAndEraserSize: 15,
|
|
67761
67765
|
cursor: "dot",
|
|
67762
67766
|
label: "label1",
|
|
67767
|
+
sphere: false,
|
|
67763
67768
|
// EraserSize: 25,
|
|
67764
67769
|
clear: () => {
|
|
67765
|
-
// const text = "Are you sure remove annotations on Current slice?";
|
|
67766
|
-
// if (confirm(text) === true) {
|
|
67767
|
-
// this.clearPaint();
|
|
67768
|
-
// }
|
|
67769
67770
|
this.clearPaint();
|
|
67770
67771
|
},
|
|
67771
67772
|
clearAll: () => {
|
|
@@ -67799,6 +67800,36 @@
|
|
|
67799
67800
|
this.exportData();
|
|
67800
67801
|
},
|
|
67801
67802
|
};
|
|
67803
|
+
this.dragPrameters = {
|
|
67804
|
+
move: 0,
|
|
67805
|
+
y: 0,
|
|
67806
|
+
h: 0,
|
|
67807
|
+
sensivity: 1,
|
|
67808
|
+
handleOnDragMouseUp: (ev) => { },
|
|
67809
|
+
handleOnDragMouseDown: (ev) => { },
|
|
67810
|
+
handleOnDragMouseMove: (ev) => { },
|
|
67811
|
+
};
|
|
67812
|
+
this.drawingPrameters = {
|
|
67813
|
+
handleOnDrawingMouseDown: (ev) => { },
|
|
67814
|
+
handleOnDrawingMouseMove: (ev) => { },
|
|
67815
|
+
handleOnPanMouseMove: (ev) => { },
|
|
67816
|
+
handleOnDrawingMouseUp: (ev) => { },
|
|
67817
|
+
handleOnDrawingMouseLeave: (ev) => { },
|
|
67818
|
+
handleOnDrawingBrushCricleMove: (ev) => { },
|
|
67819
|
+
handleZoomWheel: (e) => { },
|
|
67820
|
+
handleSphereWheel: (e) => { },
|
|
67821
|
+
};
|
|
67822
|
+
this.configDragMode = () => {
|
|
67823
|
+
this.container.style.cursor = "pointer";
|
|
67824
|
+
this.container.addEventListener("pointerdown", this.dragPrameters.handleOnDragMouseDown, true);
|
|
67825
|
+
this.container.addEventListener("pointerup", this.dragPrameters.handleOnDragMouseUp, true);
|
|
67826
|
+
};
|
|
67827
|
+
this.removeDragMode = () => {
|
|
67828
|
+
this.container.style.cursor = "";
|
|
67829
|
+
this.container.removeEventListener("pointerdown", this.dragPrameters.handleOnDragMouseDown, true);
|
|
67830
|
+
this.container.removeEventListener("pointerup", this.dragPrameters.handleOnDragMouseUp, true);
|
|
67831
|
+
this.setIsDrawFalse(1000);
|
|
67832
|
+
};
|
|
67802
67833
|
this.drawLine = (x1, y1, x2, y2) => {
|
|
67803
67834
|
this.drawingCtx.beginPath();
|
|
67804
67835
|
this.drawingCtx.moveTo(x1, y1);
|
|
@@ -67831,7 +67862,7 @@
|
|
|
67831
67862
|
this.sensitiveArray.push((i + 1) / 20);
|
|
67832
67863
|
}
|
|
67833
67864
|
this.container.addEventListener("keydown", (ev) => {
|
|
67834
|
-
if (ev.key === "Shift") {
|
|
67865
|
+
if (ev.key === "Shift" && !this.gui_states.sphere) {
|
|
67835
67866
|
this.Is_Shift_Pressed = true;
|
|
67836
67867
|
this.nrrd_states.enableCursorChoose = false;
|
|
67837
67868
|
}
|
|
@@ -68011,12 +68042,94 @@
|
|
|
68011
68042
|
paintImages.z.push(initMark_z);
|
|
68012
68043
|
}
|
|
68013
68044
|
}
|
|
68045
|
+
convertCursorPoint(from, to, cursorNumX, cursorNumY, currentSliceIndex) {
|
|
68046
|
+
const nrrd = this.nrrd_states;
|
|
68047
|
+
const dimensions = nrrd.dimensions;
|
|
68048
|
+
const ratios = nrrd.ratios;
|
|
68049
|
+
const { nrrd_x_mm, nrrd_y_mm, nrrd_z_mm } = nrrd;
|
|
68050
|
+
let currentIndex = 0;
|
|
68051
|
+
let oldIndex = 0;
|
|
68052
|
+
let convertCursorNumX = 0;
|
|
68053
|
+
let convertCursorNumY = 0;
|
|
68054
|
+
const convertIndex = {
|
|
68055
|
+
x: {
|
|
68056
|
+
y: (val) => Math.ceil((val / nrrd_x_mm) * dimensions[0]),
|
|
68057
|
+
z: (val) => Math.ceil((val / nrrd_z_mm) * dimensions[2]),
|
|
68058
|
+
},
|
|
68059
|
+
y: {
|
|
68060
|
+
x: (val) => Math.ceil((val / nrrd_y_mm) * dimensions[1]),
|
|
68061
|
+
z: (val) => Math.ceil((val / nrrd_z_mm) * dimensions[2]),
|
|
68062
|
+
},
|
|
68063
|
+
z: {
|
|
68064
|
+
x: (val) => Math.ceil((val / nrrd_x_mm) * dimensions[0]),
|
|
68065
|
+
y: (val) => Math.ceil((val / nrrd_y_mm) * dimensions[1]),
|
|
68066
|
+
},
|
|
68067
|
+
};
|
|
68068
|
+
const convertCursor = {
|
|
68069
|
+
x: {
|
|
68070
|
+
y: (sliceIndex) => Math.ceil((sliceIndex / dimensions[0]) * nrrd_x_mm),
|
|
68071
|
+
z: (sliceIndex) => Math.ceil((sliceIndex / dimensions[0]) * nrrd_x_mm),
|
|
68072
|
+
},
|
|
68073
|
+
y: {
|
|
68074
|
+
x: (sliceIndex) => Math.ceil((sliceIndex / dimensions[1]) * nrrd_y_mm),
|
|
68075
|
+
z: (sliceIndex) => Math.ceil((sliceIndex / dimensions[1]) * nrrd_y_mm),
|
|
68076
|
+
},
|
|
68077
|
+
z: {
|
|
68078
|
+
x: (sliceIndex) => Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm),
|
|
68079
|
+
y: (sliceIndex) => Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm),
|
|
68080
|
+
},
|
|
68081
|
+
};
|
|
68082
|
+
if (from === to) {
|
|
68083
|
+
return;
|
|
68084
|
+
}
|
|
68085
|
+
if (from === "z" && to === "x") {
|
|
68086
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
68087
|
+
oldIndex = currentIndex * ratios[to];
|
|
68088
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
68089
|
+
convertCursorNumY = cursorNumY;
|
|
68090
|
+
}
|
|
68091
|
+
else if (from === "y" && to === "x") {
|
|
68092
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
68093
|
+
oldIndex = currentIndex * ratios.x;
|
|
68094
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
68095
|
+
convertCursorNumX = cursorNumY;
|
|
68096
|
+
}
|
|
68097
|
+
else if (from === "z" && to === "y") {
|
|
68098
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
68099
|
+
oldIndex = currentIndex * ratios[to];
|
|
68100
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
68101
|
+
convertCursorNumX = cursorNumX;
|
|
68102
|
+
}
|
|
68103
|
+
else if (from === "x" && to === "y") {
|
|
68104
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
68105
|
+
oldIndex = currentIndex * ratios[to];
|
|
68106
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
68107
|
+
convertCursorNumY = cursorNumX;
|
|
68108
|
+
}
|
|
68109
|
+
else if (from === "x" && to === "z") {
|
|
68110
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
68111
|
+
oldIndex = currentIndex * ratios[to];
|
|
68112
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
68113
|
+
convertCursorNumY = cursorNumY;
|
|
68114
|
+
}
|
|
68115
|
+
else if (from === "y" && to === "z") {
|
|
68116
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
68117
|
+
oldIndex = currentIndex * ratios.z;
|
|
68118
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
68119
|
+
convertCursorNumX = cursorNumX;
|
|
68120
|
+
}
|
|
68121
|
+
else {
|
|
68122
|
+
return;
|
|
68123
|
+
}
|
|
68124
|
+
return { currentIndex, oldIndex, convertCursorNumX, convertCursorNumY };
|
|
68125
|
+
}
|
|
68014
68126
|
/**
|
|
68015
68127
|
* Switch all contrast slices' orientation
|
|
68016
68128
|
* @param {string} aixs:"x" | "y" | "z"
|
|
68017
68129
|
* */
|
|
68018
|
-
setSliceOrientation(
|
|
68019
|
-
|
|
68130
|
+
setSliceOrientation(axisTo) {
|
|
68131
|
+
let convetObj;
|
|
68132
|
+
if (this.nrrd_states.enableCursorChoose || this.gui_states.sphere) {
|
|
68020
68133
|
if (this.axis === "z") {
|
|
68021
68134
|
this.cursorPage.z.index = this.nrrd_states.currentIndex;
|
|
68022
68135
|
this.cursorPage.z.cursorPageX = this.nrrd_states.cursorPageX;
|
|
@@ -68032,27 +68145,19 @@
|
|
|
68032
68145
|
this.cursorPage.y.cursorPageX = this.nrrd_states.cursorPageX;
|
|
68033
68146
|
this.cursorPage.y.cursorPageY = this.nrrd_states.cursorPageY;
|
|
68034
68147
|
}
|
|
68035
|
-
if (
|
|
68148
|
+
if (axisTo === "z") {
|
|
68036
68149
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.z.updated) {
|
|
68037
68150
|
if (this.axis === "x") {
|
|
68038
|
-
|
|
68039
|
-
|
|
68040
|
-
this.nrrd_states.oldIndex =
|
|
68041
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.z;
|
|
68042
|
-
this.nrrd_states.cursorPageX = Math.ceil((this.cursorPage.x.index / this.nrrd_states.dimensions[0]) *
|
|
68043
|
-
this.nrrd_states.nrrd_x_mm);
|
|
68151
|
+
// convert x to z
|
|
68152
|
+
convetObj = this.convertCursorPoint("x", "z", this.cursorPage.x.cursorPageX, this.cursorPage.x.cursorPageY, this.cursorPage.x.index);
|
|
68044
68153
|
}
|
|
68045
68154
|
if (this.axis === "y") {
|
|
68046
|
-
|
|
68047
|
-
|
|
68048
|
-
this.nrrd_states.oldIndex =
|
|
68049
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.z;
|
|
68050
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.y.index / this.nrrd_states.dimensions[1]) *
|
|
68051
|
-
this.nrrd_states.nrrd_y_mm);
|
|
68155
|
+
// convert y to z
|
|
68156
|
+
convetObj = this.convertCursorPoint("y", "z", this.cursorPage.y.cursorPageX, this.cursorPage.y.cursorPageY, this.cursorPage.y.index);
|
|
68052
68157
|
}
|
|
68053
|
-
this.cursorPage.z.updated = true;
|
|
68054
68158
|
}
|
|
68055
68159
|
else {
|
|
68160
|
+
// not cursor select, freedom to switch x -> z or y -> z and z -> x or z -> y
|
|
68056
68161
|
this.nrrd_states.currentIndex = this.cursorPage.z.index;
|
|
68057
68162
|
this.nrrd_states.oldIndex =
|
|
68058
68163
|
this.cursorPage.z.index * this.nrrd_states.ratios.z;
|
|
@@ -68060,28 +68165,19 @@
|
|
|
68060
68165
|
this.nrrd_states.cursorPageY = this.cursorPage.z.cursorPageY;
|
|
68061
68166
|
}
|
|
68062
68167
|
}
|
|
68063
|
-
else if (
|
|
68168
|
+
else if (axisTo === "x") {
|
|
68064
68169
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.x.updated) {
|
|
68065
68170
|
if (this.axis === "z") {
|
|
68066
|
-
|
|
68067
|
-
|
|
68068
|
-
this.nrrd_states.oldIndex =
|
|
68069
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.x;
|
|
68070
|
-
this.nrrd_states.cursorPageX = Math.floor((this.cursorPage.z.index / this.nrrd_states.dimensions[2]) *
|
|
68071
|
-
this.nrrd_states.nrrd_z_mm);
|
|
68171
|
+
// convert z to x
|
|
68172
|
+
convetObj = this.convertCursorPoint("z", "x", this.cursorPage.z.cursorPageX, this.cursorPage.z.cursorPageY, this.cursorPage.z.index);
|
|
68072
68173
|
}
|
|
68073
68174
|
if (this.axis === "y") {
|
|
68074
|
-
|
|
68075
|
-
|
|
68076
|
-
this.nrrd_states.oldIndex =
|
|
68077
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.x;
|
|
68078
|
-
this.nrrd_states.cursorPageX = this.cursorPage.y.cursorPageY;
|
|
68079
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.y.index / this.nrrd_states.dimensions[1]) *
|
|
68080
|
-
this.nrrd_states.nrrd_y_mm);
|
|
68175
|
+
// convert y to x
|
|
68176
|
+
convetObj = this.convertCursorPoint("y", "x", this.cursorPage.y.cursorPageX, this.cursorPage.y.cursorPageY, this.cursorPage.y.index);
|
|
68081
68177
|
}
|
|
68082
|
-
this.cursorPage.x.updated = true;
|
|
68083
68178
|
}
|
|
68084
68179
|
else {
|
|
68180
|
+
// not cursor select, freedom to switch z -> x or y -> x and x -> z or x -> y
|
|
68085
68181
|
this.nrrd_states.currentIndex = this.cursorPage.x.index;
|
|
68086
68182
|
this.nrrd_states.oldIndex =
|
|
68087
68183
|
this.cursorPage.x.index * this.nrrd_states.ratios.x;
|
|
@@ -68089,28 +68185,19 @@
|
|
|
68089
68185
|
this.nrrd_states.cursorPageY = this.cursorPage.x.cursorPageY;
|
|
68090
68186
|
}
|
|
68091
68187
|
}
|
|
68092
|
-
else if (
|
|
68188
|
+
else if (axisTo === "y") {
|
|
68093
68189
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.y.updated) {
|
|
68094
68190
|
if (this.axis === "z") {
|
|
68095
|
-
|
|
68096
|
-
|
|
68097
|
-
this.nrrd_states.oldIndex =
|
|
68098
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.y;
|
|
68099
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.z.index / this.nrrd_states.dimensions[2]) *
|
|
68100
|
-
this.nrrd_states.nrrd_z_mm);
|
|
68191
|
+
// convert z to y
|
|
68192
|
+
convetObj = this.convertCursorPoint("z", "y", this.cursorPage.z.cursorPageX, this.cursorPage.z.cursorPageY, this.cursorPage.z.index);
|
|
68101
68193
|
}
|
|
68102
68194
|
if (this.axis === "x") {
|
|
68103
|
-
|
|
68104
|
-
|
|
68105
|
-
this.nrrd_states.oldIndex =
|
|
68106
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.y;
|
|
68107
|
-
this.nrrd_states.cursorPageX = Math.ceil((this.cursorPage.x.index / this.nrrd_states.dimensions[0]) *
|
|
68108
|
-
this.nrrd_states.nrrd_x_mm);
|
|
68109
|
-
this.nrrd_states.cursorPageY = this.cursorPage.x.cursorPageX;
|
|
68195
|
+
// convert x to y
|
|
68196
|
+
convetObj = this.convertCursorPoint("x", "y", this.cursorPage.x.cursorPageX, this.cursorPage.x.cursorPageY, this.cursorPage.x.index);
|
|
68110
68197
|
}
|
|
68111
|
-
this.cursorPage.y.updated = true;
|
|
68112
68198
|
}
|
|
68113
68199
|
else {
|
|
68200
|
+
// not cursor select, freedom to switch z -> y or x -> y and y -> z or y -> x
|
|
68114
68201
|
this.nrrd_states.currentIndex = this.cursorPage.y.index;
|
|
68115
68202
|
this.nrrd_states.oldIndex =
|
|
68116
68203
|
this.cursorPage.y.index * this.nrrd_states.ratios.y;
|
|
@@ -68118,14 +68205,38 @@
|
|
|
68118
68205
|
this.nrrd_states.cursorPageY = this.cursorPage.y.cursorPageY;
|
|
68119
68206
|
}
|
|
68120
68207
|
}
|
|
68208
|
+
if (convetObj) {
|
|
68209
|
+
// update convert cursor point, when cursor select
|
|
68210
|
+
this.nrrd_states.currentIndex = convetObj.currentIndex;
|
|
68211
|
+
this.nrrd_states.oldIndex = convetObj.oldIndex;
|
|
68212
|
+
this.nrrd_states.cursorPageX = convetObj.convertCursorNumX;
|
|
68213
|
+
this.nrrd_states.cursorPageY = convetObj.convertCursorNumY;
|
|
68214
|
+
convetObj = undefined;
|
|
68215
|
+
switch (axisTo) {
|
|
68216
|
+
case "x":
|
|
68217
|
+
this.cursorPage.x.updated = true;
|
|
68218
|
+
break;
|
|
68219
|
+
case "y":
|
|
68220
|
+
this.cursorPage.y.updated = true;
|
|
68221
|
+
break;
|
|
68222
|
+
case "z":
|
|
68223
|
+
this.cursorPage.z.updated = true;
|
|
68224
|
+
break;
|
|
68225
|
+
}
|
|
68226
|
+
}
|
|
68121
68227
|
if (this.cursorPage.x.updated &&
|
|
68122
68228
|
this.cursorPage.y.updated &&
|
|
68123
68229
|
this.cursorPage.z.updated) {
|
|
68230
|
+
// one point convert to all axis, reset all updated status
|
|
68124
68231
|
this.nrrd_states.isCursorSelect = false;
|
|
68125
68232
|
}
|
|
68126
68233
|
}
|
|
68127
|
-
this.axis =
|
|
68234
|
+
this.axis = axisTo;
|
|
68128
68235
|
this.resetDisplaySlicesStatus();
|
|
68236
|
+
// for sphere plan a
|
|
68237
|
+
if (this.gui_states.sphere && !this.nrrd_states.spherePlanB) {
|
|
68238
|
+
this.drawSphere(this.nrrd_states.sphereOrigin[axisTo][0], this.nrrd_states.sphereOrigin[axisTo][1], this.nrrd_states.sphereRadius);
|
|
68239
|
+
}
|
|
68129
68240
|
}
|
|
68130
68241
|
addSkip(index) {
|
|
68131
68242
|
this.skipSlicesDic[index] = this.backUpDisplaySlices[index];
|
|
@@ -68451,62 +68562,51 @@
|
|
|
68451
68562
|
this.mainAreaContainer.appendChild(loadingbar);
|
|
68452
68563
|
}
|
|
68453
68564
|
drag(opts) {
|
|
68454
|
-
|
|
68455
|
-
let y;
|
|
68456
|
-
let h = this.container.offsetHeight;
|
|
68457
|
-
let sensivity = 1;
|
|
68458
|
-
let handleOnMouseUp;
|
|
68459
|
-
let handleOnMouseDown;
|
|
68460
|
-
let handleOnMouseMove;
|
|
68565
|
+
this.dragPrameters.h = this.container.offsetHeight;
|
|
68461
68566
|
this.sensitiveArray.reverse();
|
|
68462
68567
|
if (opts === null || opts === void 0 ? void 0 : opts.showNumber) {
|
|
68463
68568
|
this.container.appendChild(this.showDragNumberDiv);
|
|
68464
68569
|
}
|
|
68465
|
-
|
|
68570
|
+
this.dragPrameters.handleOnDragMouseDown = (ev) => {
|
|
68466
68571
|
// before start drag event, remove wheel event.
|
|
68467
|
-
this.drawingCanvas.removeEventListener("wheel", this.
|
|
68572
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
68468
68573
|
if (ev.button === 0) {
|
|
68469
68574
|
// this.setSyncsliceNum();
|
|
68470
|
-
y = ev.offsetY / h;
|
|
68471
|
-
this.container.addEventListener("pointermove",
|
|
68472
|
-
|
|
68575
|
+
this.dragPrameters.y = ev.offsetY / this.dragPrameters.h;
|
|
68576
|
+
this.container.addEventListener("pointermove", this.dragPrameters.handleOnDragMouseMove, false);
|
|
68577
|
+
this.dragPrameters.sensivity =
|
|
68578
|
+
this.sensitiveArray[this.gui_states.dragSensitivity - 1];
|
|
68473
68579
|
}
|
|
68474
68580
|
};
|
|
68475
|
-
|
|
68476
|
-
if (y - ev.offsetY / h >= 0) {
|
|
68477
|
-
move = -Math.ceil(((y - ev.offsetY / h) * 10) /
|
|
68581
|
+
this.dragPrameters.handleOnDragMouseMove = throttle((ev) => {
|
|
68582
|
+
if (this.dragPrameters.y - ev.offsetY / this.dragPrameters.h >= 0) {
|
|
68583
|
+
this.dragPrameters.move = -Math.ceil(((this.dragPrameters.y - ev.offsetY / this.dragPrameters.h) * 10) /
|
|
68584
|
+
this.dragPrameters.sensivity);
|
|
68478
68585
|
}
|
|
68479
68586
|
else {
|
|
68480
|
-
move = -Math.floor(((y - ev.offsetY / h) * 10) /
|
|
68587
|
+
this.dragPrameters.move = -Math.floor(((this.dragPrameters.y - ev.offsetY / this.dragPrameters.h) * 10) /
|
|
68588
|
+
this.dragPrameters.sensivity);
|
|
68481
68589
|
}
|
|
68482
|
-
this.updateIndex(move);
|
|
68590
|
+
this.updateIndex(this.dragPrameters.move);
|
|
68483
68591
|
(opts === null || opts === void 0 ? void 0 : opts.getSliceNum) &&
|
|
68484
68592
|
opts.getSliceNum(this.nrrd_states.currentIndex, this.nrrd_states.contrastNum);
|
|
68485
|
-
y = ev.offsetY / h;
|
|
68486
|
-
}, sensivity * 200);
|
|
68487
|
-
|
|
68593
|
+
this.dragPrameters.y = ev.offsetY / this.dragPrameters.h;
|
|
68594
|
+
}, this.dragPrameters.sensivity * 200);
|
|
68595
|
+
this.dragPrameters.handleOnDragMouseUp = (ev) => {
|
|
68488
68596
|
// after drag, add the wheel event
|
|
68489
|
-
this.drawingCanvas.addEventListener("wheel", this.
|
|
68597
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
68490
68598
|
this.setSyncsliceNum();
|
|
68491
|
-
this.container.removeEventListener("pointermove",
|
|
68492
|
-
};
|
|
68493
|
-
const configDragMode = () => {
|
|
68494
|
-
this.container.style.cursor = "pointer";
|
|
68495
|
-
this.container.addEventListener("pointerdown", handleOnMouseDown, true);
|
|
68496
|
-
this.container.addEventListener("pointerup", handleOnMouseUp, true);
|
|
68599
|
+
this.container.removeEventListener("pointermove", this.dragPrameters.handleOnDragMouseMove, false);
|
|
68497
68600
|
};
|
|
68498
|
-
configDragMode();
|
|
68601
|
+
this.configDragMode();
|
|
68499
68602
|
this.container.addEventListener("keydown", (ev) => {
|
|
68500
68603
|
if (ev.key === "Shift") {
|
|
68501
|
-
this.
|
|
68502
|
-
this.container.removeEventListener("pointerdown", handleOnMouseDown, true);
|
|
68503
|
-
this.container.removeEventListener("pointerup", handleOnMouseUp, false);
|
|
68504
|
-
this.setIsDrawFalse(1000);
|
|
68604
|
+
this.removeDragMode();
|
|
68505
68605
|
}
|
|
68506
68606
|
});
|
|
68507
68607
|
this.container.addEventListener("keyup", (ev) => {
|
|
68508
|
-
if (ev.key === "Shift") {
|
|
68509
|
-
configDragMode();
|
|
68608
|
+
if (ev.key === "Shift" && !this.gui_states.sphere) {
|
|
68609
|
+
this.configDragMode();
|
|
68510
68610
|
}
|
|
68511
68611
|
});
|
|
68512
68612
|
}
|
|
@@ -68664,6 +68764,7 @@
|
|
|
68664
68764
|
// draw lines starts position
|
|
68665
68765
|
let Is_Painting = false;
|
|
68666
68766
|
let lines = [];
|
|
68767
|
+
const clearArc = this.useEraser();
|
|
68667
68768
|
this.updateOriginAndChangedWH();
|
|
68668
68769
|
this.initAllCanvas();
|
|
68669
68770
|
this.configGui(modeFolder);
|
|
@@ -68673,12 +68774,15 @@
|
|
|
68673
68774
|
(_c = this.displayCtx) === null || _c === void 0 ? void 0 : _c.restore();
|
|
68674
68775
|
this.previousDrawingImage = this.drawingCtx.getImageData(0, 0, this.drawingCanvas.width, this.drawingCanvas.height);
|
|
68675
68776
|
// let a global variable to store the wheel move event
|
|
68676
|
-
this.
|
|
68777
|
+
this.drawingPrameters.handleZoomWheel = this.configMouseZoomWheel((_d = this.sceneIn) === null || _d === void 0 ? void 0 : _d.controls);
|
|
68677
68778
|
// init to add it
|
|
68678
|
-
this.drawingCanvas.addEventListener("wheel", this.
|
|
68779
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel, {
|
|
68679
68780
|
passive: false,
|
|
68680
68781
|
});
|
|
68681
|
-
|
|
68782
|
+
// sphere Wheel
|
|
68783
|
+
this.drawingPrameters.handleSphereWheel = this.configMouseSphereWheel();
|
|
68784
|
+
// pan move
|
|
68785
|
+
this.drawingPrameters.handleOnPanMouseMove = (e) => {
|
|
68682
68786
|
this.drawingCanvas.style.cursor = "grabbing";
|
|
68683
68787
|
this.nrrd_states.previousPanelL = e.clientX - panelMoveInnerX;
|
|
68684
68788
|
this.nrrd_states.previousPanelT = e.clientY - panelMoveInnerY;
|
|
@@ -68687,8 +68791,9 @@
|
|
|
68687
68791
|
this.displayCanvas.style.top = this.drawingCanvas.style.top =
|
|
68688
68792
|
this.nrrd_states.previousPanelT + "px";
|
|
68689
68793
|
};
|
|
68690
|
-
//
|
|
68691
|
-
|
|
68794
|
+
// brush circle move
|
|
68795
|
+
this.drawingPrameters.handleOnDrawingBrushCricleMove = (e) => {
|
|
68796
|
+
e.preventDefault();
|
|
68692
68797
|
this.nrrd_states.Mouse_Over_x = e.offsetX;
|
|
68693
68798
|
this.nrrd_states.Mouse_Over_y = e.offsetY;
|
|
68694
68799
|
if (this.nrrd_states.Mouse_Over_x === undefined) {
|
|
@@ -68697,21 +68802,31 @@
|
|
|
68697
68802
|
}
|
|
68698
68803
|
if (e.type === "mouseout") {
|
|
68699
68804
|
this.nrrd_states.Mouse_Over = false;
|
|
68700
|
-
this.drawingCanvas.removeEventListener("mousemove",
|
|
68805
|
+
this.drawingCanvas.removeEventListener("mousemove", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
68701
68806
|
}
|
|
68702
68807
|
else if (e.type === "mouseover") {
|
|
68703
68808
|
this.nrrd_states.Mouse_Over = true;
|
|
68704
|
-
this.drawingCanvas.addEventListener("mousemove",
|
|
68809
|
+
this.drawingCanvas.addEventListener("mousemove", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
68705
68810
|
}
|
|
68706
|
-
e.preventDefault();
|
|
68707
68811
|
};
|
|
68708
|
-
//
|
|
68709
|
-
this.
|
|
68710
|
-
|
|
68711
|
-
|
|
68712
|
-
|
|
68812
|
+
// drawing move
|
|
68813
|
+
this.drawingPrameters.handleOnDrawingMouseMove = (e) => {
|
|
68814
|
+
this.Is_Draw = true;
|
|
68815
|
+
if (Is_Painting) {
|
|
68816
|
+
if (this.gui_states.Eraser) {
|
|
68817
|
+
this.nrrd_states.stepClear = 1;
|
|
68818
|
+
// drawingCtx.clearRect(e.offsetX - 5, e.offsetY - 5, 25, 25);
|
|
68819
|
+
clearArc(e.offsetX, e.offsetY, this.gui_states.brushAndEraserSize);
|
|
68820
|
+
}
|
|
68821
|
+
else {
|
|
68822
|
+
lines.push({ x: e.offsetX, y: e.offsetY });
|
|
68823
|
+
this.paintOnCanvasLayer(e.offsetX, e.offsetY);
|
|
68824
|
+
}
|
|
68825
|
+
}
|
|
68826
|
+
};
|
|
68827
|
+
this.drawingPrameters.handleOnDrawingMouseDown = (e) => {
|
|
68713
68828
|
if (leftclicked || rightclicked) {
|
|
68714
|
-
this.drawingCanvas.removeEventListener("pointerup",
|
|
68829
|
+
this.drawingCanvas.removeEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68715
68830
|
this.drawingLayerMasterCtx.closePath();
|
|
68716
68831
|
return;
|
|
68717
68832
|
}
|
|
@@ -68722,7 +68837,7 @@
|
|
|
68722
68837
|
currentSliceIndex = this.mainPreSlice.index;
|
|
68723
68838
|
}
|
|
68724
68839
|
// remove it when mouse click down
|
|
68725
|
-
this.drawingCanvas.removeEventListener("wheel", this.
|
|
68840
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
68726
68841
|
if (e.button === 0) {
|
|
68727
68842
|
if (this.Is_Shift_Pressed) {
|
|
68728
68843
|
leftclicked = true;
|
|
@@ -68742,32 +68857,24 @@
|
|
|
68742
68857
|
}
|
|
68743
68858
|
this.nrrd_states.drawStartPos.set(e.offsetX, e.offsetY);
|
|
68744
68859
|
// this.drawingLayerMasterCtx.beginPath();
|
|
68745
|
-
this.drawingCanvas.addEventListener("pointerup",
|
|
68746
|
-
this.drawingCanvas.addEventListener("pointermove",
|
|
68860
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68861
|
+
this.drawingCanvas.addEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
68747
68862
|
}
|
|
68748
68863
|
else if (this.nrrd_states.enableCursorChoose) {
|
|
68749
68864
|
this.nrrd_states.cursorPageX =
|
|
68750
68865
|
e.offsetX / this.nrrd_states.sizeFoctor;
|
|
68751
68866
|
this.nrrd_states.cursorPageY =
|
|
68752
68867
|
e.offsetY / this.nrrd_states.sizeFoctor;
|
|
68753
|
-
this.
|
|
68754
|
-
|
|
68755
|
-
|
|
68756
|
-
|
|
68757
|
-
|
|
68758
|
-
|
|
68759
|
-
|
|
68760
|
-
|
|
68761
|
-
|
|
68762
|
-
|
|
68763
|
-
this.cursorPage.z.updated = false;
|
|
68764
|
-
break;
|
|
68765
|
-
case "z":
|
|
68766
|
-
this.cursorPage.x.updated = false;
|
|
68767
|
-
this.cursorPage.y.updated = false;
|
|
68768
|
-
this.cursorPage.z.updated = true;
|
|
68769
|
-
break;
|
|
68770
|
-
}
|
|
68868
|
+
this.enableCrosshair();
|
|
68869
|
+
}
|
|
68870
|
+
else if (this.gui_states.sphere) {
|
|
68871
|
+
console.log("sphere down");
|
|
68872
|
+
let mouseX = e.offsetX;
|
|
68873
|
+
let mouseY = e.offsetY;
|
|
68874
|
+
// draw circle
|
|
68875
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
68876
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68877
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68771
68878
|
}
|
|
68772
68879
|
}
|
|
68773
68880
|
else if (e.button === 2) {
|
|
@@ -68779,28 +68886,15 @@
|
|
|
68779
68886
|
panelMoveInnerX = e.clientX - offsetX;
|
|
68780
68887
|
panelMoveInnerY = e.clientY - offsetY;
|
|
68781
68888
|
this.drawingCanvas.style.cursor = "grab";
|
|
68782
|
-
this.drawingCanvas.addEventListener("pointerup",
|
|
68783
|
-
this.drawingCanvas.addEventListener("pointermove",
|
|
68889
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
68890
|
+
this.drawingCanvas.addEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68784
68891
|
}
|
|
68785
68892
|
else {
|
|
68786
68893
|
return;
|
|
68787
68894
|
}
|
|
68788
|
-
}, true);
|
|
68789
|
-
const clearArc = this.useEraser();
|
|
68790
|
-
const handleOnPainterMove = (e) => {
|
|
68791
|
-
this.Is_Draw = true;
|
|
68792
|
-
if (Is_Painting) {
|
|
68793
|
-
if (this.gui_states.Eraser) {
|
|
68794
|
-
this.nrrd_states.stepClear = 1;
|
|
68795
|
-
// drawingCtx.clearRect(e.offsetX - 5, e.offsetY - 5, 25, 25);
|
|
68796
|
-
clearArc(e.offsetX, e.offsetY, this.gui_states.brushAndEraserSize);
|
|
68797
|
-
}
|
|
68798
|
-
else {
|
|
68799
|
-
lines.push({ x: e.offsetX, y: e.offsetY });
|
|
68800
|
-
this.paintOnCanvasLayer(e.offsetX, e.offsetY);
|
|
68801
|
-
}
|
|
68802
|
-
}
|
|
68803
68895
|
};
|
|
68896
|
+
// disable browser right click menu
|
|
68897
|
+
this.drawingCanvas.addEventListener("pointerdown", this.drawingPrameters.handleOnDrawingMouseDown, true);
|
|
68804
68898
|
const redrawPreviousImageToLabelCtx = (ctx, label = "default") => {
|
|
68805
68899
|
var _a;
|
|
68806
68900
|
let paintImages;
|
|
@@ -68827,13 +68921,13 @@
|
|
|
68827
68921
|
// draw privous image
|
|
68828
68922
|
ctx.drawImage(this.emptyCanvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
68829
68923
|
};
|
|
68830
|
-
|
|
68924
|
+
this.drawingPrameters.handleOnDrawingMouseUp = (e) => {
|
|
68831
68925
|
if (e.button === 0) {
|
|
68832
68926
|
if (this.Is_Shift_Pressed || Is_Painting) {
|
|
68833
68927
|
leftclicked = false;
|
|
68834
68928
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
68835
68929
|
ctx.closePath();
|
|
68836
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
68930
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
68837
68931
|
if (!this.gui_states.Eraser) {
|
|
68838
68932
|
if (this.gui_states.segmentation) {
|
|
68839
68933
|
this.drawingCanvasLayerMaster.width =
|
|
@@ -68881,20 +68975,66 @@
|
|
|
68881
68975
|
undoObj.layers[this.gui_states.label].push(image);
|
|
68882
68976
|
this.undoArray.push(undoObj);
|
|
68883
68977
|
}
|
|
68978
|
+
// add wheel after pointer up
|
|
68979
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel, {
|
|
68980
|
+
passive: false,
|
|
68981
|
+
});
|
|
68982
|
+
}
|
|
68983
|
+
else if (this.gui_states.sphere &&
|
|
68984
|
+
!this.nrrd_states.enableCursorChoose) {
|
|
68985
|
+
console.log("sphere up");
|
|
68986
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
68987
|
+
let mouseX = e.offsetX;
|
|
68988
|
+
let mouseY = e.offsetY;
|
|
68989
|
+
this.nrrd_states.sphereOrigin[this.axis] = [
|
|
68990
|
+
mouseX,
|
|
68991
|
+
mouseY,
|
|
68992
|
+
this.nrrd_states.currentIndex,
|
|
68993
|
+
];
|
|
68994
|
+
/************ */
|
|
68995
|
+
this.setUpSphereOrigins(mouseX, mouseY);
|
|
68996
|
+
console.log(this.nrrd_states.sphereOrigin);
|
|
68997
|
+
this.nrrd_states.cursorPageX = mouseX;
|
|
68998
|
+
this.nrrd_states.cursorPageY = mouseY;
|
|
68999
|
+
this.enableCrosshair();
|
|
69000
|
+
// plan B
|
|
69001
|
+
// findout all index in the sphere radius range in Axial view
|
|
69002
|
+
if (this.nrrd_states.spherePlanB) {
|
|
69003
|
+
// clear stroe images
|
|
69004
|
+
this.clearStoreImages();
|
|
69005
|
+
for (let i = 0; i < this.nrrd_states.sphereRadius; i++) {
|
|
69006
|
+
this.setEmptyCanvasSize();
|
|
69007
|
+
const preIndex = this.nrrd_states.currentIndex - i;
|
|
69008
|
+
const nextIndex = this.nrrd_states.currentIndex + i;
|
|
69009
|
+
if (preIndex < this.nrrd_states.minIndex ||
|
|
69010
|
+
nextIndex > this.nrrd_states.maxIndex)
|
|
69011
|
+
return;
|
|
69012
|
+
if (preIndex === nextIndex) {
|
|
69013
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
69014
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69015
|
+
this.storeAllImages(preIndex, "");
|
|
69016
|
+
}
|
|
69017
|
+
else {
|
|
69018
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius - i);
|
|
69019
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69020
|
+
this.storeAllImages(preIndex, "");
|
|
69021
|
+
this.storeAllImages(nextIndex, "");
|
|
69022
|
+
}
|
|
69023
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69024
|
+
}
|
|
69025
|
+
}
|
|
69026
|
+
console.log(this.nrrd_states.sphereRadius);
|
|
69027
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68884
69028
|
}
|
|
68885
69029
|
}
|
|
68886
69030
|
else if (e.button === 2) {
|
|
68887
69031
|
rightclicked = false;
|
|
68888
69032
|
this.drawingCanvas.style.cursor = "grab";
|
|
68889
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69033
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68890
69034
|
}
|
|
68891
69035
|
else {
|
|
68892
69036
|
return;
|
|
68893
69037
|
}
|
|
68894
|
-
// add wheel after pointer up
|
|
68895
|
-
this.drawingCanvas.addEventListener("wheel", this.handleWheelMove, {
|
|
68896
|
-
passive: false,
|
|
68897
|
-
});
|
|
68898
69038
|
if (!this.gui_states.segmentation) {
|
|
68899
69039
|
this.setIsDrawFalse(100);
|
|
68900
69040
|
}
|
|
@@ -68905,12 +69045,13 @@
|
|
|
68905
69045
|
if (leftclicked) {
|
|
68906
69046
|
leftclicked = false;
|
|
68907
69047
|
this.drawingLayerMasterCtx.closePath();
|
|
68908
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69048
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
69049
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
68909
69050
|
}
|
|
68910
69051
|
if (rightclicked) {
|
|
68911
69052
|
rightclicked = false;
|
|
68912
69053
|
this.drawingCanvas.style.cursor = "grab";
|
|
68913
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
69054
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
68914
69055
|
}
|
|
68915
69056
|
this.setIsDrawFalse(100);
|
|
68916
69057
|
if (this.gui_states.segmentation) {
|
|
@@ -68965,6 +69106,68 @@
|
|
|
68965
69106
|
}
|
|
68966
69107
|
});
|
|
68967
69108
|
}
|
|
69109
|
+
enableCrosshair() {
|
|
69110
|
+
this.nrrd_states.isCursorSelect = true;
|
|
69111
|
+
switch (this.axis) {
|
|
69112
|
+
case "x":
|
|
69113
|
+
this.cursorPage.x.updated = true;
|
|
69114
|
+
this.cursorPage.y.updated = false;
|
|
69115
|
+
this.cursorPage.z.updated = false;
|
|
69116
|
+
break;
|
|
69117
|
+
case "y":
|
|
69118
|
+
this.cursorPage.x.updated = false;
|
|
69119
|
+
this.cursorPage.y.updated = true;
|
|
69120
|
+
this.cursorPage.z.updated = false;
|
|
69121
|
+
break;
|
|
69122
|
+
case "z":
|
|
69123
|
+
this.cursorPage.x.updated = false;
|
|
69124
|
+
this.cursorPage.y.updated = false;
|
|
69125
|
+
this.cursorPage.z.updated = true;
|
|
69126
|
+
break;
|
|
69127
|
+
}
|
|
69128
|
+
}
|
|
69129
|
+
setUpSphereOrigins(mouseX, mouseY) {
|
|
69130
|
+
const convertCursor = (from, to) => {
|
|
69131
|
+
const convertObj = this.convertCursorPoint(from, to, mouseX, mouseY, this.nrrd_states.currentIndex);
|
|
69132
|
+
return {
|
|
69133
|
+
convertCursorNumX: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumX,
|
|
69134
|
+
convertCursorNumY: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumY,
|
|
69135
|
+
currentIndex: convertObj === null || convertObj === void 0 ? void 0 : convertObj.currentIndex,
|
|
69136
|
+
};
|
|
69137
|
+
};
|
|
69138
|
+
const axisConversions = {
|
|
69139
|
+
x: { axisTo1: "y", axisTo2: "z" },
|
|
69140
|
+
y: { axisTo1: "z", axisTo2: "x" },
|
|
69141
|
+
z: { axisTo1: "x", axisTo2: "y" },
|
|
69142
|
+
};
|
|
69143
|
+
const { axisTo1, axisTo2 } = axisConversions[this.axis];
|
|
69144
|
+
this.nrrd_states.sphereOrigin[axisTo1] = [
|
|
69145
|
+
convertCursor(this.axis, axisTo1).convertCursorNumX,
|
|
69146
|
+
convertCursor(this.axis, axisTo1).convertCursorNumY,
|
|
69147
|
+
convertCursor(this.axis, axisTo1).currentIndex,
|
|
69148
|
+
];
|
|
69149
|
+
this.nrrd_states.sphereOrigin[axisTo2] = [
|
|
69150
|
+
convertCursor(this.axis, axisTo2).convertCursorNumX,
|
|
69151
|
+
convertCursor(this.axis, axisTo2).convertCursorNumY,
|
|
69152
|
+
convertCursor(this.axis, axisTo2).currentIndex,
|
|
69153
|
+
];
|
|
69154
|
+
}
|
|
69155
|
+
// for sphere
|
|
69156
|
+
drawSphereCore(ctx, x, y, radius) {
|
|
69157
|
+
ctx.beginPath();
|
|
69158
|
+
ctx.arc(x, y, radius * this.nrrd_states.sizeFoctor, 0, 2 * Math.PI);
|
|
69159
|
+
ctx.fillStyle = this.gui_states.fillColor;
|
|
69160
|
+
ctx.fill();
|
|
69161
|
+
ctx.closePath();
|
|
69162
|
+
}
|
|
69163
|
+
drawSphere(mouseX, mouseY, radius) {
|
|
69164
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
69165
|
+
// clear canvas
|
|
69166
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69167
|
+
this.drawingLayerMasterCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
69168
|
+
this.drawSphereCore(ctx, mouseX, mouseY, radius);
|
|
69169
|
+
this.drawingLayerMasterCtx.drawImage(canvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
69170
|
+
}
|
|
68968
69171
|
// need to update
|
|
68969
69172
|
undoLastPainting() {
|
|
68970
69173
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
@@ -68982,7 +69185,9 @@
|
|
|
68982
69185
|
if (layerLen > 0) {
|
|
68983
69186
|
// const imageSrc = undo.undos[undo.undos.length - 1];
|
|
68984
69187
|
const image = layerUndos[layerLen - 1];
|
|
68985
|
-
|
|
69188
|
+
if (!!image) {
|
|
69189
|
+
ctx.drawImage(image, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
69190
|
+
}
|
|
68986
69191
|
}
|
|
68987
69192
|
if (undo.layers.label1.length > 0) {
|
|
68988
69193
|
const image = undo.layers.label1[undo.layers.label1.length - 1];
|
|
@@ -69006,9 +69211,29 @@
|
|
|
69006
69211
|
return item.sliceIndex === this.nrrd_states.currentIndex;
|
|
69007
69212
|
});
|
|
69008
69213
|
}
|
|
69009
|
-
|
|
69214
|
+
// drawing canvas mouse shpere wheel
|
|
69215
|
+
configMouseSphereWheel() {
|
|
69216
|
+
const sphereEvent = (e) => {
|
|
69217
|
+
e.preventDefault();
|
|
69218
|
+
if (e.deltaY < 0) {
|
|
69219
|
+
this.nrrd_states.sphereRadius += 1;
|
|
69220
|
+
}
|
|
69221
|
+
else {
|
|
69222
|
+
this.nrrd_states.sphereRadius -= 1;
|
|
69223
|
+
}
|
|
69224
|
+
// limited the radius max and min
|
|
69225
|
+
this.nrrd_states.sphereRadius = Math.max(1, Math.min(this.nrrd_states.sphereRadius, 50));
|
|
69226
|
+
// get mouse position
|
|
69227
|
+
const mouseX = e.offsetX;
|
|
69228
|
+
const mouseY = e.offsetY;
|
|
69229
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
69230
|
+
};
|
|
69231
|
+
return sphereEvent;
|
|
69232
|
+
}
|
|
69233
|
+
// drawing canvas mouse zoom wheel
|
|
69234
|
+
configMouseZoomWheel(controls) {
|
|
69010
69235
|
let moveDistance = 1;
|
|
69011
|
-
const
|
|
69236
|
+
const handleZoomWheelMove = (e) => {
|
|
69012
69237
|
if (this.Is_Shift_Pressed) {
|
|
69013
69238
|
return;
|
|
69014
69239
|
}
|
|
@@ -69044,7 +69269,7 @@
|
|
|
69044
69269
|
}
|
|
69045
69270
|
this.nrrd_states.sizeFoctor = moveDistance;
|
|
69046
69271
|
};
|
|
69047
|
-
return
|
|
69272
|
+
return handleZoomWheelMove;
|
|
69048
69273
|
}
|
|
69049
69274
|
useEraser() {
|
|
69050
69275
|
const clearArc = (x, y, radius) => {
|
|
@@ -69155,155 +69380,6 @@
|
|
|
69155
69380
|
}
|
|
69156
69381
|
return { ctx, canvas };
|
|
69157
69382
|
}
|
|
69158
|
-
configGui(modeFolder) {
|
|
69159
|
-
if (modeFolder.__controllers.length > 0)
|
|
69160
|
-
this.removeGuiFolderChilden(modeFolder);
|
|
69161
|
-
modeFolder.open();
|
|
69162
|
-
const actionsFolder = modeFolder.addFolder("Default Actions");
|
|
69163
|
-
actionsFolder
|
|
69164
|
-
.add(this.gui_states, "label", ["label1", "label2", "label3"])
|
|
69165
|
-
.onChange((val) => {
|
|
69166
|
-
if (val === "label1") {
|
|
69167
|
-
this.gui_states.fillColor = "#00ff00";
|
|
69168
|
-
this.gui_states.brushColor = "#00ff00";
|
|
69169
|
-
}
|
|
69170
|
-
else if (val === "label2") {
|
|
69171
|
-
this.gui_states.fillColor = "#ff0000";
|
|
69172
|
-
this.gui_states.brushColor = "#ff0000";
|
|
69173
|
-
}
|
|
69174
|
-
else if (val === "label3") {
|
|
69175
|
-
this.gui_states.fillColor = "#0000ff";
|
|
69176
|
-
this.gui_states.brushColor = "#0000ff";
|
|
69177
|
-
}
|
|
69178
|
-
});
|
|
69179
|
-
actionsFolder
|
|
69180
|
-
.add(this.gui_states, "cursor", ["crosshair", "pencil", "dot"])
|
|
69181
|
-
.name("cursor icons")
|
|
69182
|
-
.onChange((value) => {
|
|
69183
|
-
if (value === "crosshair") {
|
|
69184
|
-
this.nrrd_states.defaultPaintCursor = "crosshair";
|
|
69185
|
-
}
|
|
69186
|
-
if (value === "pencil") {
|
|
69187
|
-
this.nrrd_states.defaultPaintCursor =
|
|
69188
|
-
"url(https://raw.githubusercontent.com/LinkunGao/copper3d_icons/main/icons/pencil-black.svg), auto";
|
|
69189
|
-
}
|
|
69190
|
-
if (value === "dot") {
|
|
69191
|
-
this.nrrd_states.defaultPaintCursor =
|
|
69192
|
-
"url(https://raw.githubusercontent.com/LinkunGao/copper3d-datasets/main/icons/dot.svg) 12 12,auto";
|
|
69193
|
-
}
|
|
69194
|
-
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69195
|
-
});
|
|
69196
|
-
actionsFolder
|
|
69197
|
-
.add(this.gui_states, "mainAreaSize")
|
|
69198
|
-
.name("zoom")
|
|
69199
|
-
.min(1)
|
|
69200
|
-
.max(8)
|
|
69201
|
-
.onFinishChange((factor) => {
|
|
69202
|
-
this.resetPaintArea();
|
|
69203
|
-
this.nrrd_states.sizeFoctor = factor;
|
|
69204
|
-
this.resizePaintArea(factor);
|
|
69205
|
-
});
|
|
69206
|
-
actionsFolder.add(this.gui_states, "resetZoom");
|
|
69207
|
-
actionsFolder
|
|
69208
|
-
.add(this.gui_states, "globalAlpha")
|
|
69209
|
-
.name("opacity")
|
|
69210
|
-
.min(0.1)
|
|
69211
|
-
.max(1)
|
|
69212
|
-
.step(0.01);
|
|
69213
|
-
actionsFolder.add(this.gui_states, "segmentation").name("Pencil");
|
|
69214
|
-
actionsFolder
|
|
69215
|
-
.add(this.gui_states, "brushAndEraserSize")
|
|
69216
|
-
.min(5)
|
|
69217
|
-
.max(50)
|
|
69218
|
-
.step(1)
|
|
69219
|
-
.onChange(() => {
|
|
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
|
-
});
|
|
69226
|
-
actionsFolder.add(this.gui_states, "Eraser").onChange((value) => {
|
|
69227
|
-
this.gui_states.Eraser = value;
|
|
69228
|
-
if (this.gui_states.Eraser) {
|
|
69229
|
-
this.eraserUrls.length > 0
|
|
69230
|
-
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69231
|
-
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69232
|
-
}
|
|
69233
|
-
else {
|
|
69234
|
-
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69235
|
-
}
|
|
69236
|
-
});
|
|
69237
|
-
actionsFolder.add(this.gui_states, "clear");
|
|
69238
|
-
actionsFolder.add(this.gui_states, "clearAll");
|
|
69239
|
-
actionsFolder.add(this.gui_states, "undo");
|
|
69240
|
-
actionsFolder
|
|
69241
|
-
.add(this.mainPreSlice.volume, "windowHigh", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69242
|
-
.name("Image contrast")
|
|
69243
|
-
.onChange((value) => {
|
|
69244
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69245
|
-
this.updateSlicesContrast(value, "windowHigh");
|
|
69246
|
-
})
|
|
69247
|
-
.onFinishChange(() => {
|
|
69248
|
-
this.repraintAllContrastSlices();
|
|
69249
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69250
|
-
});
|
|
69251
|
-
actionsFolder.add(this.gui_states, "exportMarks");
|
|
69252
|
-
const advanceFolder = modeFolder.addFolder("Advance settings");
|
|
69253
|
-
advanceFolder
|
|
69254
|
-
.add(this.gui_states, "dragSensitivity")
|
|
69255
|
-
.min(1)
|
|
69256
|
-
.max(this.nrrd_states.Max_sensitive)
|
|
69257
|
-
.step(1);
|
|
69258
|
-
const segmentationFolder = advanceFolder.addFolder("Pencil settings");
|
|
69259
|
-
segmentationFolder
|
|
69260
|
-
.add(this.gui_states, "lineWidth")
|
|
69261
|
-
.name("outerLineWidth")
|
|
69262
|
-
.min(1.7)
|
|
69263
|
-
.max(3)
|
|
69264
|
-
.step(0.01);
|
|
69265
|
-
segmentationFolder.addColor(this.gui_states, "color");
|
|
69266
|
-
segmentationFolder.addColor(this.gui_states, "fillColor");
|
|
69267
|
-
const bushFolder = advanceFolder.addFolder("Brush settings");
|
|
69268
|
-
bushFolder.addColor(this.gui_states, "brushColor");
|
|
69269
|
-
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
|
|
69270
|
-
advanceFolder.add(this.gui_states, "downloadCurrentMask");
|
|
69271
|
-
const contrastFolder = advanceFolder.addFolder("contrast advance settings");
|
|
69272
|
-
contrastFolder
|
|
69273
|
-
.add(this.mainPreSlice.volume, "lowerThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69274
|
-
.name("Lower Threshold")
|
|
69275
|
-
.onChange((value) => {
|
|
69276
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69277
|
-
this.updateSlicesContrast(value, "lowerThreshold");
|
|
69278
|
-
})
|
|
69279
|
-
.onFinishChange(() => {
|
|
69280
|
-
this.repraintAllContrastSlices();
|
|
69281
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69282
|
-
});
|
|
69283
|
-
contrastFolder
|
|
69284
|
-
.add(this.mainPreSlice.volume, "upperThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69285
|
-
.name("Upper Threshold")
|
|
69286
|
-
.onChange((value) => {
|
|
69287
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69288
|
-
this.updateSlicesContrast(value, "upperThreshold");
|
|
69289
|
-
})
|
|
69290
|
-
.onFinishChange(() => {
|
|
69291
|
-
this.repraintAllContrastSlices();
|
|
69292
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69293
|
-
});
|
|
69294
|
-
contrastFolder
|
|
69295
|
-
.add(this.mainPreSlice.volume, "windowLow", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
69296
|
-
.name("Window Low")
|
|
69297
|
-
.onChange((value) => {
|
|
69298
|
-
this.nrrd_states.readyToUpdate = false;
|
|
69299
|
-
this.updateSlicesContrast(value, "windowLow");
|
|
69300
|
-
})
|
|
69301
|
-
.onFinishChange(() => {
|
|
69302
|
-
this.repraintAllContrastSlices();
|
|
69303
|
-
this.nrrd_states.readyToUpdate = true;
|
|
69304
|
-
});
|
|
69305
|
-
actionsFolder.open();
|
|
69306
|
-
}
|
|
69307
69383
|
updateSlicesContrast(value, flag) {
|
|
69308
69384
|
switch (flag) {
|
|
69309
69385
|
case "lowerThreshold":
|
|
@@ -69482,12 +69558,15 @@
|
|
|
69482
69558
|
delete dic[key];
|
|
69483
69559
|
}
|
|
69484
69560
|
}
|
|
69561
|
+
drawImageOnEmptyImage(canvas) {
|
|
69562
|
+
this.emptyCtx.drawImage(canvas, 0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69563
|
+
}
|
|
69485
69564
|
storeAllImages(index, label) {
|
|
69486
69565
|
// const image: HTMLImageElement = new Image();
|
|
69487
69566
|
// resize the drawing image data
|
|
69488
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
69567
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
69489
69568
|
this.setEmptyCanvasSize();
|
|
69490
|
-
this.
|
|
69569
|
+
this.drawImageOnEmptyImage(this.drawingCanvasLayerMaster);
|
|
69491
69570
|
}
|
|
69492
69571
|
let imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69493
69572
|
// 1.12.23
|
|
@@ -69557,7 +69636,7 @@
|
|
|
69557
69636
|
break;
|
|
69558
69637
|
}
|
|
69559
69638
|
this.storeImageToAxis(index, this.paintImages, imageData);
|
|
69560
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
69639
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
69561
69640
|
this.storeEachLayerImage(index, label);
|
|
69562
69641
|
}
|
|
69563
69642
|
}
|
|
@@ -69592,7 +69671,7 @@
|
|
|
69592
69671
|
storeImageToLabel(index, canvas, paintedImages) {
|
|
69593
69672
|
if (!this.nrrd_states.loadMaskJson) {
|
|
69594
69673
|
this.setEmptyCanvasSize();
|
|
69595
|
-
this.
|
|
69674
|
+
this.drawImageOnEmptyImage(canvas);
|
|
69596
69675
|
}
|
|
69597
69676
|
const imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
69598
69677
|
this.storeImageToAxis(index, paintedImages, imageData);
|
|
@@ -69814,11 +69893,187 @@
|
|
|
69814
69893
|
// }
|
|
69815
69894
|
// };
|
|
69816
69895
|
}
|
|
69896
|
+
configGui(modeFolder) {
|
|
69897
|
+
if (modeFolder.__controllers.length > 0)
|
|
69898
|
+
this.removeGuiFolderChilden(modeFolder);
|
|
69899
|
+
modeFolder.open();
|
|
69900
|
+
const actionsFolder = modeFolder.addFolder("Default Actions");
|
|
69901
|
+
actionsFolder
|
|
69902
|
+
.add(this.gui_states, "label", ["label1", "label2", "label3"])
|
|
69903
|
+
.onChange((val) => {
|
|
69904
|
+
if (val === "label1") {
|
|
69905
|
+
this.gui_states.fillColor = "#00ff00";
|
|
69906
|
+
this.gui_states.brushColor = "#00ff00";
|
|
69907
|
+
}
|
|
69908
|
+
else if (val === "label2") {
|
|
69909
|
+
this.gui_states.fillColor = "#ff0000";
|
|
69910
|
+
this.gui_states.brushColor = "#ff0000";
|
|
69911
|
+
}
|
|
69912
|
+
else if (val === "label3") {
|
|
69913
|
+
this.gui_states.fillColor = "#0000ff";
|
|
69914
|
+
this.gui_states.brushColor = "#0000ff";
|
|
69915
|
+
}
|
|
69916
|
+
});
|
|
69917
|
+
actionsFolder
|
|
69918
|
+
.add(this.gui_states, "cursor", ["crosshair", "pencil", "dot"])
|
|
69919
|
+
.name("cursor icons")
|
|
69920
|
+
.onChange((value) => {
|
|
69921
|
+
if (value === "crosshair") {
|
|
69922
|
+
this.nrrd_states.defaultPaintCursor = "crosshair";
|
|
69923
|
+
}
|
|
69924
|
+
if (value === "pencil") {
|
|
69925
|
+
this.nrrd_states.defaultPaintCursor =
|
|
69926
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d_icons/main/icons/pencil-black.svg), auto";
|
|
69927
|
+
}
|
|
69928
|
+
if (value === "dot") {
|
|
69929
|
+
this.nrrd_states.defaultPaintCursor =
|
|
69930
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d-datasets/main/icons/dot.svg) 12 12,auto";
|
|
69931
|
+
}
|
|
69932
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
69933
|
+
});
|
|
69934
|
+
actionsFolder
|
|
69935
|
+
.add(this.gui_states, "mainAreaSize")
|
|
69936
|
+
.name("zoom")
|
|
69937
|
+
.min(1)
|
|
69938
|
+
.max(8)
|
|
69939
|
+
.onFinishChange((factor) => {
|
|
69940
|
+
this.resetPaintArea();
|
|
69941
|
+
this.nrrd_states.sizeFoctor = factor;
|
|
69942
|
+
this.resizePaintArea(factor);
|
|
69943
|
+
});
|
|
69944
|
+
actionsFolder.add(this.gui_states, "resetZoom");
|
|
69945
|
+
actionsFolder
|
|
69946
|
+
.add(this.gui_states, "globalAlpha")
|
|
69947
|
+
.name("opacity")
|
|
69948
|
+
.min(0.1)
|
|
69949
|
+
.max(1)
|
|
69950
|
+
.step(0.01);
|
|
69951
|
+
actionsFolder
|
|
69952
|
+
.add(this.gui_states, "segmentation")
|
|
69953
|
+
.name("Pencil")
|
|
69954
|
+
.onChange(() => {
|
|
69955
|
+
if (this.gui_states.segmentation) {
|
|
69956
|
+
// add canvas brush circle move event listeners
|
|
69957
|
+
this.drawingCanvas.removeEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69958
|
+
this.drawingCanvas.removeEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69959
|
+
}
|
|
69960
|
+
else {
|
|
69961
|
+
// add canvas brush circle move event listeners
|
|
69962
|
+
this.drawingCanvas.addEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69963
|
+
this.drawingCanvas.addEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
69964
|
+
}
|
|
69965
|
+
});
|
|
69966
|
+
actionsFolder
|
|
69967
|
+
.add(this.gui_states, "sphere")
|
|
69968
|
+
.name("Sphere")
|
|
69969
|
+
.onChange(() => {
|
|
69970
|
+
if (this.gui_states.sphere) {
|
|
69971
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
69972
|
+
this.removeDragMode();
|
|
69973
|
+
}
|
|
69974
|
+
else {
|
|
69975
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
69976
|
+
this.configDragMode();
|
|
69977
|
+
}
|
|
69978
|
+
});
|
|
69979
|
+
actionsFolder
|
|
69980
|
+
.add(this.gui_states, "brushAndEraserSize")
|
|
69981
|
+
.min(5)
|
|
69982
|
+
.max(50)
|
|
69983
|
+
.step(1)
|
|
69984
|
+
.onChange(() => {
|
|
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
|
+
});
|
|
69991
|
+
actionsFolder.add(this.gui_states, "Eraser").onChange((value) => {
|
|
69992
|
+
this.gui_states.Eraser = value;
|
|
69993
|
+
if (this.gui_states.Eraser) {
|
|
69994
|
+
this.eraserUrls.length > 0
|
|
69995
|
+
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
69996
|
+
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
69997
|
+
}
|
|
69998
|
+
else {
|
|
69999
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
70000
|
+
}
|
|
70001
|
+
});
|
|
70002
|
+
actionsFolder.add(this.gui_states, "clear");
|
|
70003
|
+
actionsFolder.add(this.gui_states, "clearAll");
|
|
70004
|
+
actionsFolder.add(this.gui_states, "undo");
|
|
70005
|
+
actionsFolder
|
|
70006
|
+
.add(this.mainPreSlice.volume, "windowHigh", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70007
|
+
.name("Image contrast")
|
|
70008
|
+
.onChange((value) => {
|
|
70009
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70010
|
+
this.updateSlicesContrast(value, "windowHigh");
|
|
70011
|
+
})
|
|
70012
|
+
.onFinishChange(() => {
|
|
70013
|
+
this.repraintAllContrastSlices();
|
|
70014
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70015
|
+
});
|
|
70016
|
+
actionsFolder.add(this.gui_states, "exportMarks");
|
|
70017
|
+
const advanceFolder = modeFolder.addFolder("Advance settings");
|
|
70018
|
+
advanceFolder
|
|
70019
|
+
.add(this.gui_states, "dragSensitivity")
|
|
70020
|
+
.min(1)
|
|
70021
|
+
.max(this.nrrd_states.Max_sensitive)
|
|
70022
|
+
.step(1);
|
|
70023
|
+
const segmentationFolder = advanceFolder.addFolder("Pencil settings");
|
|
70024
|
+
segmentationFolder
|
|
70025
|
+
.add(this.gui_states, "lineWidth")
|
|
70026
|
+
.name("outerLineWidth")
|
|
70027
|
+
.min(1.7)
|
|
70028
|
+
.max(3)
|
|
70029
|
+
.step(0.01);
|
|
70030
|
+
segmentationFolder.addColor(this.gui_states, "color");
|
|
70031
|
+
segmentationFolder.addColor(this.gui_states, "fillColor");
|
|
70032
|
+
const bushFolder = advanceFolder.addFolder("Brush settings");
|
|
70033
|
+
bushFolder.addColor(this.gui_states, "brushColor");
|
|
70034
|
+
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
|
|
70035
|
+
advanceFolder.add(this.gui_states, "downloadCurrentMask");
|
|
70036
|
+
const contrastFolder = advanceFolder.addFolder("contrast advance settings");
|
|
70037
|
+
contrastFolder
|
|
70038
|
+
.add(this.mainPreSlice.volume, "lowerThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70039
|
+
.name("Lower Threshold")
|
|
70040
|
+
.onChange((value) => {
|
|
70041
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70042
|
+
this.updateSlicesContrast(value, "lowerThreshold");
|
|
70043
|
+
})
|
|
70044
|
+
.onFinishChange(() => {
|
|
70045
|
+
this.repraintAllContrastSlices();
|
|
70046
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70047
|
+
});
|
|
70048
|
+
contrastFolder
|
|
70049
|
+
.add(this.mainPreSlice.volume, "upperThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70050
|
+
.name("Upper Threshold")
|
|
70051
|
+
.onChange((value) => {
|
|
70052
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70053
|
+
this.updateSlicesContrast(value, "upperThreshold");
|
|
70054
|
+
})
|
|
70055
|
+
.onFinishChange(() => {
|
|
70056
|
+
this.repraintAllContrastSlices();
|
|
70057
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70058
|
+
});
|
|
70059
|
+
contrastFolder
|
|
70060
|
+
.add(this.mainPreSlice.volume, "windowLow", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
70061
|
+
.name("Window Low")
|
|
70062
|
+
.onChange((value) => {
|
|
70063
|
+
this.nrrd_states.readyToUpdate = false;
|
|
70064
|
+
this.updateSlicesContrast(value, "windowLow");
|
|
70065
|
+
})
|
|
70066
|
+
.onFinishChange(() => {
|
|
70067
|
+
this.repraintAllContrastSlices();
|
|
70068
|
+
this.nrrd_states.readyToUpdate = true;
|
|
70069
|
+
});
|
|
70070
|
+
actionsFolder.open();
|
|
70071
|
+
}
|
|
69817
70072
|
}
|
|
69818
70073
|
|
|
69819
70074
|
// import * as kiwrious from "copper3d_plugin_heart_k";
|
|
69820
|
-
const REVISION = "v1.15.
|
|
69821
|
-
console.log("%cCopper3D Visualisation %cBeta:v1.15.
|
|
70075
|
+
const REVISION = "v1.15.12";
|
|
70076
|
+
console.log("%cCopper3D Visualisation %cBeta:v1.15.12", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
|
|
69822
70077
|
|
|
69823
70078
|
exports.CameraViewPoint = CameraViewPoint;
|
|
69824
70079
|
exports.Copper3dTrackballControls = Copper3dTrackballControls;
|