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/Utils/nrrd_tool.js
CHANGED
|
@@ -14,6 +14,7 @@ export class nrrd_tools {
|
|
|
14
14
|
label2: this.paintImagesLabel2,
|
|
15
15
|
label3: this.paintImagesLabel3,
|
|
16
16
|
};
|
|
17
|
+
// used to store display marks with multiple labels
|
|
17
18
|
this.paintImages = { x: [], y: [], z: [] };
|
|
18
19
|
// store all contrast slices, include x, y, z orientation
|
|
19
20
|
this.allSlicesArray = [];
|
|
@@ -41,7 +42,6 @@ export class nrrd_tools {
|
|
|
41
42
|
this.Is_Shift_Pressed = false;
|
|
42
43
|
this.Is_Draw = false;
|
|
43
44
|
this.sensitiveArray = [];
|
|
44
|
-
this.handleWheelMove = () => { };
|
|
45
45
|
this.start = () => { };
|
|
46
46
|
this.undoArray = [];
|
|
47
47
|
this.initState = true;
|
|
@@ -77,6 +77,10 @@ export class nrrd_tools {
|
|
|
77
77
|
isCursorSelect: false,
|
|
78
78
|
cursorPageX: 0,
|
|
79
79
|
cursorPageY: 0,
|
|
80
|
+
// x: [cursorX, cursorY, sliceIndex]
|
|
81
|
+
sphereOrigin: { x: [0, 0, 0], y: [0, 0, 0], z: [0, 0, 0] },
|
|
82
|
+
spherePlanB: false,
|
|
83
|
+
sphereRadius: 10,
|
|
80
84
|
Mouse_Over_x: 0,
|
|
81
85
|
Mouse_Over_y: 0,
|
|
82
86
|
Mouse_Over: false,
|
|
@@ -126,12 +130,9 @@ export class nrrd_tools {
|
|
|
126
130
|
brushAndEraserSize: 15,
|
|
127
131
|
cursor: "dot",
|
|
128
132
|
label: "label1",
|
|
133
|
+
sphere: false,
|
|
129
134
|
// EraserSize: 25,
|
|
130
135
|
clear: () => {
|
|
131
|
-
// const text = "Are you sure remove annotations on Current slice?";
|
|
132
|
-
// if (confirm(text) === true) {
|
|
133
|
-
// this.clearPaint();
|
|
134
|
-
// }
|
|
135
136
|
this.clearPaint();
|
|
136
137
|
},
|
|
137
138
|
clearAll: () => {
|
|
@@ -165,6 +166,36 @@ export class nrrd_tools {
|
|
|
165
166
|
this.exportData();
|
|
166
167
|
},
|
|
167
168
|
};
|
|
169
|
+
this.dragPrameters = {
|
|
170
|
+
move: 0,
|
|
171
|
+
y: 0,
|
|
172
|
+
h: 0,
|
|
173
|
+
sensivity: 1,
|
|
174
|
+
handleOnDragMouseUp: (ev) => { },
|
|
175
|
+
handleOnDragMouseDown: (ev) => { },
|
|
176
|
+
handleOnDragMouseMove: (ev) => { },
|
|
177
|
+
};
|
|
178
|
+
this.drawingPrameters = {
|
|
179
|
+
handleOnDrawingMouseDown: (ev) => { },
|
|
180
|
+
handleOnDrawingMouseMove: (ev) => { },
|
|
181
|
+
handleOnPanMouseMove: (ev) => { },
|
|
182
|
+
handleOnDrawingMouseUp: (ev) => { },
|
|
183
|
+
handleOnDrawingMouseLeave: (ev) => { },
|
|
184
|
+
handleOnDrawingBrushCricleMove: (ev) => { },
|
|
185
|
+
handleZoomWheel: (e) => { },
|
|
186
|
+
handleSphereWheel: (e) => { },
|
|
187
|
+
};
|
|
188
|
+
this.configDragMode = () => {
|
|
189
|
+
this.container.style.cursor = "pointer";
|
|
190
|
+
this.container.addEventListener("pointerdown", this.dragPrameters.handleOnDragMouseDown, true);
|
|
191
|
+
this.container.addEventListener("pointerup", this.dragPrameters.handleOnDragMouseUp, true);
|
|
192
|
+
};
|
|
193
|
+
this.removeDragMode = () => {
|
|
194
|
+
this.container.style.cursor = "";
|
|
195
|
+
this.container.removeEventListener("pointerdown", this.dragPrameters.handleOnDragMouseDown, true);
|
|
196
|
+
this.container.removeEventListener("pointerup", this.dragPrameters.handleOnDragMouseUp, true);
|
|
197
|
+
this.setIsDrawFalse(1000);
|
|
198
|
+
};
|
|
168
199
|
this.drawLine = (x1, y1, x2, y2) => {
|
|
169
200
|
this.drawingCtx.beginPath();
|
|
170
201
|
this.drawingCtx.moveTo(x1, y1);
|
|
@@ -197,7 +228,7 @@ export class nrrd_tools {
|
|
|
197
228
|
this.sensitiveArray.push((i + 1) / 20);
|
|
198
229
|
}
|
|
199
230
|
this.container.addEventListener("keydown", (ev) => {
|
|
200
|
-
if (ev.key === "Shift") {
|
|
231
|
+
if (ev.key === "Shift" && !this.gui_states.sphere) {
|
|
201
232
|
this.Is_Shift_Pressed = true;
|
|
202
233
|
this.nrrd_states.enableCursorChoose = false;
|
|
203
234
|
}
|
|
@@ -377,12 +408,94 @@ export class nrrd_tools {
|
|
|
377
408
|
paintImages.z.push(initMark_z);
|
|
378
409
|
}
|
|
379
410
|
}
|
|
411
|
+
convertCursorPoint(from, to, cursorNumX, cursorNumY, currentSliceIndex) {
|
|
412
|
+
const nrrd = this.nrrd_states;
|
|
413
|
+
const dimensions = nrrd.dimensions;
|
|
414
|
+
const ratios = nrrd.ratios;
|
|
415
|
+
const { nrrd_x_mm, nrrd_y_mm, nrrd_z_mm } = nrrd;
|
|
416
|
+
let currentIndex = 0;
|
|
417
|
+
let oldIndex = 0;
|
|
418
|
+
let convertCursorNumX = 0;
|
|
419
|
+
let convertCursorNumY = 0;
|
|
420
|
+
const convertIndex = {
|
|
421
|
+
x: {
|
|
422
|
+
y: (val) => Math.ceil((val / nrrd_x_mm) * dimensions[0]),
|
|
423
|
+
z: (val) => Math.ceil((val / nrrd_z_mm) * dimensions[2]),
|
|
424
|
+
},
|
|
425
|
+
y: {
|
|
426
|
+
x: (val) => Math.ceil((val / nrrd_y_mm) * dimensions[1]),
|
|
427
|
+
z: (val) => Math.ceil((val / nrrd_z_mm) * dimensions[2]),
|
|
428
|
+
},
|
|
429
|
+
z: {
|
|
430
|
+
x: (val) => Math.ceil((val / nrrd_x_mm) * dimensions[0]),
|
|
431
|
+
y: (val) => Math.ceil((val / nrrd_y_mm) * dimensions[1]),
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
const convertCursor = {
|
|
435
|
+
x: {
|
|
436
|
+
y: (sliceIndex) => Math.ceil((sliceIndex / dimensions[0]) * nrrd_x_mm),
|
|
437
|
+
z: (sliceIndex) => Math.ceil((sliceIndex / dimensions[0]) * nrrd_x_mm),
|
|
438
|
+
},
|
|
439
|
+
y: {
|
|
440
|
+
x: (sliceIndex) => Math.ceil((sliceIndex / dimensions[1]) * nrrd_y_mm),
|
|
441
|
+
z: (sliceIndex) => Math.ceil((sliceIndex / dimensions[1]) * nrrd_y_mm),
|
|
442
|
+
},
|
|
443
|
+
z: {
|
|
444
|
+
x: (sliceIndex) => Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm),
|
|
445
|
+
y: (sliceIndex) => Math.ceil((sliceIndex / dimensions[2]) * nrrd_z_mm),
|
|
446
|
+
},
|
|
447
|
+
};
|
|
448
|
+
if (from === to) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (from === "z" && to === "x") {
|
|
452
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
453
|
+
oldIndex = currentIndex * ratios[to];
|
|
454
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
455
|
+
convertCursorNumY = cursorNumY;
|
|
456
|
+
}
|
|
457
|
+
else if (from === "y" && to === "x") {
|
|
458
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
459
|
+
oldIndex = currentIndex * ratios.x;
|
|
460
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
461
|
+
convertCursorNumX = cursorNumY;
|
|
462
|
+
}
|
|
463
|
+
else if (from === "z" && to === "y") {
|
|
464
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
465
|
+
oldIndex = currentIndex * ratios[to];
|
|
466
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
467
|
+
convertCursorNumX = cursorNumX;
|
|
468
|
+
}
|
|
469
|
+
else if (from === "x" && to === "y") {
|
|
470
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
471
|
+
oldIndex = currentIndex * ratios[to];
|
|
472
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
473
|
+
convertCursorNumY = cursorNumX;
|
|
474
|
+
}
|
|
475
|
+
else if (from === "x" && to === "z") {
|
|
476
|
+
currentIndex = convertIndex[from][to](cursorNumX);
|
|
477
|
+
oldIndex = currentIndex * ratios[to];
|
|
478
|
+
convertCursorNumX = convertCursor[from][to](currentSliceIndex);
|
|
479
|
+
convertCursorNumY = cursorNumY;
|
|
480
|
+
}
|
|
481
|
+
else if (from === "y" && to === "z") {
|
|
482
|
+
currentIndex = convertIndex[from][to](cursorNumY);
|
|
483
|
+
oldIndex = currentIndex * ratios.z;
|
|
484
|
+
convertCursorNumY = convertCursor[from][to](currentSliceIndex);
|
|
485
|
+
convertCursorNumX = cursorNumX;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
return { currentIndex, oldIndex, convertCursorNumX, convertCursorNumY };
|
|
491
|
+
}
|
|
380
492
|
/**
|
|
381
493
|
* Switch all contrast slices' orientation
|
|
382
494
|
* @param {string} aixs:"x" | "y" | "z"
|
|
383
495
|
* */
|
|
384
|
-
setSliceOrientation(
|
|
385
|
-
|
|
496
|
+
setSliceOrientation(axisTo) {
|
|
497
|
+
let convetObj;
|
|
498
|
+
if (this.nrrd_states.enableCursorChoose || this.gui_states.sphere) {
|
|
386
499
|
if (this.axis === "z") {
|
|
387
500
|
this.cursorPage.z.index = this.nrrd_states.currentIndex;
|
|
388
501
|
this.cursorPage.z.cursorPageX = this.nrrd_states.cursorPageX;
|
|
@@ -398,27 +511,19 @@ export class nrrd_tools {
|
|
|
398
511
|
this.cursorPage.y.cursorPageX = this.nrrd_states.cursorPageX;
|
|
399
512
|
this.cursorPage.y.cursorPageY = this.nrrd_states.cursorPageY;
|
|
400
513
|
}
|
|
401
|
-
if (
|
|
514
|
+
if (axisTo === "z") {
|
|
402
515
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.z.updated) {
|
|
403
516
|
if (this.axis === "x") {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.nrrd_states.oldIndex =
|
|
407
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.z;
|
|
408
|
-
this.nrrd_states.cursorPageX = Math.ceil((this.cursorPage.x.index / this.nrrd_states.dimensions[0]) *
|
|
409
|
-
this.nrrd_states.nrrd_x_mm);
|
|
517
|
+
// convert x to z
|
|
518
|
+
convetObj = this.convertCursorPoint("x", "z", this.cursorPage.x.cursorPageX, this.cursorPage.x.cursorPageY, this.cursorPage.x.index);
|
|
410
519
|
}
|
|
411
520
|
if (this.axis === "y") {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
this.nrrd_states.oldIndex =
|
|
415
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.z;
|
|
416
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.y.index / this.nrrd_states.dimensions[1]) *
|
|
417
|
-
this.nrrd_states.nrrd_y_mm);
|
|
521
|
+
// convert y to z
|
|
522
|
+
convetObj = this.convertCursorPoint("y", "z", this.cursorPage.y.cursorPageX, this.cursorPage.y.cursorPageY, this.cursorPage.y.index);
|
|
418
523
|
}
|
|
419
|
-
this.cursorPage.z.updated = true;
|
|
420
524
|
}
|
|
421
525
|
else {
|
|
526
|
+
// not cursor select, freedom to switch x -> z or y -> z and z -> x or z -> y
|
|
422
527
|
this.nrrd_states.currentIndex = this.cursorPage.z.index;
|
|
423
528
|
this.nrrd_states.oldIndex =
|
|
424
529
|
this.cursorPage.z.index * this.nrrd_states.ratios.z;
|
|
@@ -426,28 +531,19 @@ export class nrrd_tools {
|
|
|
426
531
|
this.nrrd_states.cursorPageY = this.cursorPage.z.cursorPageY;
|
|
427
532
|
}
|
|
428
533
|
}
|
|
429
|
-
else if (
|
|
534
|
+
else if (axisTo === "x") {
|
|
430
535
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.x.updated) {
|
|
431
536
|
if (this.axis === "z") {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
this.nrrd_states.oldIndex =
|
|
435
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.x;
|
|
436
|
-
this.nrrd_states.cursorPageX = Math.floor((this.cursorPage.z.index / this.nrrd_states.dimensions[2]) *
|
|
437
|
-
this.nrrd_states.nrrd_z_mm);
|
|
537
|
+
// convert z to x
|
|
538
|
+
convetObj = this.convertCursorPoint("z", "x", this.cursorPage.z.cursorPageX, this.cursorPage.z.cursorPageY, this.cursorPage.z.index);
|
|
438
539
|
}
|
|
439
540
|
if (this.axis === "y") {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
this.nrrd_states.oldIndex =
|
|
443
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.x;
|
|
444
|
-
this.nrrd_states.cursorPageX = this.cursorPage.y.cursorPageY;
|
|
445
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.y.index / this.nrrd_states.dimensions[1]) *
|
|
446
|
-
this.nrrd_states.nrrd_y_mm);
|
|
541
|
+
// convert y to x
|
|
542
|
+
convetObj = this.convertCursorPoint("y", "x", this.cursorPage.y.cursorPageX, this.cursorPage.y.cursorPageY, this.cursorPage.y.index);
|
|
447
543
|
}
|
|
448
|
-
this.cursorPage.x.updated = true;
|
|
449
544
|
}
|
|
450
545
|
else {
|
|
546
|
+
// not cursor select, freedom to switch z -> x or y -> x and x -> z or x -> y
|
|
451
547
|
this.nrrd_states.currentIndex = this.cursorPage.x.index;
|
|
452
548
|
this.nrrd_states.oldIndex =
|
|
453
549
|
this.cursorPage.x.index * this.nrrd_states.ratios.x;
|
|
@@ -455,28 +551,19 @@ export class nrrd_tools {
|
|
|
455
551
|
this.nrrd_states.cursorPageY = this.cursorPage.x.cursorPageY;
|
|
456
552
|
}
|
|
457
553
|
}
|
|
458
|
-
else if (
|
|
554
|
+
else if (axisTo === "y") {
|
|
459
555
|
if (this.nrrd_states.isCursorSelect && !this.cursorPage.y.updated) {
|
|
460
556
|
if (this.axis === "z") {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
this.nrrd_states.oldIndex =
|
|
464
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.y;
|
|
465
|
-
this.nrrd_states.cursorPageY = Math.ceil((this.cursorPage.z.index / this.nrrd_states.dimensions[2]) *
|
|
466
|
-
this.nrrd_states.nrrd_z_mm);
|
|
557
|
+
// convert z to y
|
|
558
|
+
convetObj = this.convertCursorPoint("z", "y", this.cursorPage.z.cursorPageX, this.cursorPage.z.cursorPageY, this.cursorPage.z.index);
|
|
467
559
|
}
|
|
468
560
|
if (this.axis === "x") {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
this.nrrd_states.oldIndex =
|
|
472
|
-
this.nrrd_states.currentIndex * this.nrrd_states.ratios.y;
|
|
473
|
-
this.nrrd_states.cursorPageX = Math.ceil((this.cursorPage.x.index / this.nrrd_states.dimensions[0]) *
|
|
474
|
-
this.nrrd_states.nrrd_x_mm);
|
|
475
|
-
this.nrrd_states.cursorPageY = this.cursorPage.x.cursorPageX;
|
|
561
|
+
// convert x to y
|
|
562
|
+
convetObj = this.convertCursorPoint("x", "y", this.cursorPage.x.cursorPageX, this.cursorPage.x.cursorPageY, this.cursorPage.x.index);
|
|
476
563
|
}
|
|
477
|
-
this.cursorPage.y.updated = true;
|
|
478
564
|
}
|
|
479
565
|
else {
|
|
566
|
+
// not cursor select, freedom to switch z -> y or x -> y and y -> z or y -> x
|
|
480
567
|
this.nrrd_states.currentIndex = this.cursorPage.y.index;
|
|
481
568
|
this.nrrd_states.oldIndex =
|
|
482
569
|
this.cursorPage.y.index * this.nrrd_states.ratios.y;
|
|
@@ -484,14 +571,38 @@ export class nrrd_tools {
|
|
|
484
571
|
this.nrrd_states.cursorPageY = this.cursorPage.y.cursorPageY;
|
|
485
572
|
}
|
|
486
573
|
}
|
|
574
|
+
if (convetObj) {
|
|
575
|
+
// update convert cursor point, when cursor select
|
|
576
|
+
this.nrrd_states.currentIndex = convetObj.currentIndex;
|
|
577
|
+
this.nrrd_states.oldIndex = convetObj.oldIndex;
|
|
578
|
+
this.nrrd_states.cursorPageX = convetObj.convertCursorNumX;
|
|
579
|
+
this.nrrd_states.cursorPageY = convetObj.convertCursorNumY;
|
|
580
|
+
convetObj = undefined;
|
|
581
|
+
switch (axisTo) {
|
|
582
|
+
case "x":
|
|
583
|
+
this.cursorPage.x.updated = true;
|
|
584
|
+
break;
|
|
585
|
+
case "y":
|
|
586
|
+
this.cursorPage.y.updated = true;
|
|
587
|
+
break;
|
|
588
|
+
case "z":
|
|
589
|
+
this.cursorPage.z.updated = true;
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
487
593
|
if (this.cursorPage.x.updated &&
|
|
488
594
|
this.cursorPage.y.updated &&
|
|
489
595
|
this.cursorPage.z.updated) {
|
|
596
|
+
// one point convert to all axis, reset all updated status
|
|
490
597
|
this.nrrd_states.isCursorSelect = false;
|
|
491
598
|
}
|
|
492
599
|
}
|
|
493
|
-
this.axis =
|
|
600
|
+
this.axis = axisTo;
|
|
494
601
|
this.resetDisplaySlicesStatus();
|
|
602
|
+
// for sphere plan a
|
|
603
|
+
if (this.gui_states.sphere && !this.nrrd_states.spherePlanB) {
|
|
604
|
+
this.drawSphere(this.nrrd_states.sphereOrigin[axisTo][0], this.nrrd_states.sphereOrigin[axisTo][1], this.nrrd_states.sphereRadius);
|
|
605
|
+
}
|
|
495
606
|
}
|
|
496
607
|
addSkip(index) {
|
|
497
608
|
this.skipSlicesDic[index] = this.backUpDisplaySlices[index];
|
|
@@ -817,62 +928,51 @@ export class nrrd_tools {
|
|
|
817
928
|
this.mainAreaContainer.appendChild(loadingbar);
|
|
818
929
|
}
|
|
819
930
|
drag(opts) {
|
|
820
|
-
|
|
821
|
-
let y;
|
|
822
|
-
let h = this.container.offsetHeight;
|
|
823
|
-
let sensivity = 1;
|
|
824
|
-
let handleOnMouseUp;
|
|
825
|
-
let handleOnMouseDown;
|
|
826
|
-
let handleOnMouseMove;
|
|
931
|
+
this.dragPrameters.h = this.container.offsetHeight;
|
|
827
932
|
this.sensitiveArray.reverse();
|
|
828
933
|
if (opts === null || opts === void 0 ? void 0 : opts.showNumber) {
|
|
829
934
|
this.container.appendChild(this.showDragNumberDiv);
|
|
830
935
|
}
|
|
831
|
-
|
|
936
|
+
this.dragPrameters.handleOnDragMouseDown = (ev) => {
|
|
832
937
|
// before start drag event, remove wheel event.
|
|
833
|
-
this.drawingCanvas.removeEventListener("wheel", this.
|
|
938
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
834
939
|
if (ev.button === 0) {
|
|
835
940
|
// this.setSyncsliceNum();
|
|
836
|
-
y = ev.offsetY / h;
|
|
837
|
-
this.container.addEventListener("pointermove",
|
|
838
|
-
|
|
941
|
+
this.dragPrameters.y = ev.offsetY / this.dragPrameters.h;
|
|
942
|
+
this.container.addEventListener("pointermove", this.dragPrameters.handleOnDragMouseMove, false);
|
|
943
|
+
this.dragPrameters.sensivity =
|
|
944
|
+
this.sensitiveArray[this.gui_states.dragSensitivity - 1];
|
|
839
945
|
}
|
|
840
946
|
};
|
|
841
|
-
|
|
842
|
-
if (y - ev.offsetY / h >= 0) {
|
|
843
|
-
move = -Math.ceil(((y - ev.offsetY / h) * 10) /
|
|
947
|
+
this.dragPrameters.handleOnDragMouseMove = throttle((ev) => {
|
|
948
|
+
if (this.dragPrameters.y - ev.offsetY / this.dragPrameters.h >= 0) {
|
|
949
|
+
this.dragPrameters.move = -Math.ceil(((this.dragPrameters.y - ev.offsetY / this.dragPrameters.h) * 10) /
|
|
950
|
+
this.dragPrameters.sensivity);
|
|
844
951
|
}
|
|
845
952
|
else {
|
|
846
|
-
move = -Math.floor(((y - ev.offsetY / h) * 10) /
|
|
953
|
+
this.dragPrameters.move = -Math.floor(((this.dragPrameters.y - ev.offsetY / this.dragPrameters.h) * 10) /
|
|
954
|
+
this.dragPrameters.sensivity);
|
|
847
955
|
}
|
|
848
|
-
this.updateIndex(move);
|
|
956
|
+
this.updateIndex(this.dragPrameters.move);
|
|
849
957
|
(opts === null || opts === void 0 ? void 0 : opts.getSliceNum) &&
|
|
850
958
|
opts.getSliceNum(this.nrrd_states.currentIndex, this.nrrd_states.contrastNum);
|
|
851
|
-
y = ev.offsetY / h;
|
|
852
|
-
}, sensivity * 200);
|
|
853
|
-
|
|
959
|
+
this.dragPrameters.y = ev.offsetY / this.dragPrameters.h;
|
|
960
|
+
}, this.dragPrameters.sensivity * 200);
|
|
961
|
+
this.dragPrameters.handleOnDragMouseUp = (ev) => {
|
|
854
962
|
// after drag, add the wheel event
|
|
855
|
-
this.drawingCanvas.addEventListener("wheel", this.
|
|
963
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
856
964
|
this.setSyncsliceNum();
|
|
857
|
-
this.container.removeEventListener("pointermove",
|
|
858
|
-
};
|
|
859
|
-
const configDragMode = () => {
|
|
860
|
-
this.container.style.cursor = "pointer";
|
|
861
|
-
this.container.addEventListener("pointerdown", handleOnMouseDown, true);
|
|
862
|
-
this.container.addEventListener("pointerup", handleOnMouseUp, true);
|
|
965
|
+
this.container.removeEventListener("pointermove", this.dragPrameters.handleOnDragMouseMove, false);
|
|
863
966
|
};
|
|
864
|
-
configDragMode();
|
|
967
|
+
this.configDragMode();
|
|
865
968
|
this.container.addEventListener("keydown", (ev) => {
|
|
866
969
|
if (ev.key === "Shift") {
|
|
867
|
-
this.
|
|
868
|
-
this.container.removeEventListener("pointerdown", handleOnMouseDown, true);
|
|
869
|
-
this.container.removeEventListener("pointerup", handleOnMouseUp, false);
|
|
870
|
-
this.setIsDrawFalse(1000);
|
|
970
|
+
this.removeDragMode();
|
|
871
971
|
}
|
|
872
972
|
});
|
|
873
973
|
this.container.addEventListener("keyup", (ev) => {
|
|
874
|
-
if (ev.key === "Shift") {
|
|
875
|
-
configDragMode();
|
|
974
|
+
if (ev.key === "Shift" && !this.gui_states.sphere) {
|
|
975
|
+
this.configDragMode();
|
|
876
976
|
}
|
|
877
977
|
});
|
|
878
978
|
}
|
|
@@ -1030,6 +1130,7 @@ export class nrrd_tools {
|
|
|
1030
1130
|
// draw lines starts position
|
|
1031
1131
|
let Is_Painting = false;
|
|
1032
1132
|
let lines = [];
|
|
1133
|
+
const clearArc = this.useEraser();
|
|
1033
1134
|
this.updateOriginAndChangedWH();
|
|
1034
1135
|
this.initAllCanvas();
|
|
1035
1136
|
this.configGui(modeFolder);
|
|
@@ -1039,12 +1140,15 @@ export class nrrd_tools {
|
|
|
1039
1140
|
(_c = this.displayCtx) === null || _c === void 0 ? void 0 : _c.restore();
|
|
1040
1141
|
this.previousDrawingImage = this.drawingCtx.getImageData(0, 0, this.drawingCanvas.width, this.drawingCanvas.height);
|
|
1041
1142
|
// let a global variable to store the wheel move event
|
|
1042
|
-
this.
|
|
1143
|
+
this.drawingPrameters.handleZoomWheel = this.configMouseZoomWheel((_d = this.sceneIn) === null || _d === void 0 ? void 0 : _d.controls);
|
|
1043
1144
|
// init to add it
|
|
1044
|
-
this.drawingCanvas.addEventListener("wheel", this.
|
|
1145
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel, {
|
|
1045
1146
|
passive: false,
|
|
1046
1147
|
});
|
|
1047
|
-
|
|
1148
|
+
// sphere Wheel
|
|
1149
|
+
this.drawingPrameters.handleSphereWheel = this.configMouseSphereWheel();
|
|
1150
|
+
// pan move
|
|
1151
|
+
this.drawingPrameters.handleOnPanMouseMove = (e) => {
|
|
1048
1152
|
this.drawingCanvas.style.cursor = "grabbing";
|
|
1049
1153
|
this.nrrd_states.previousPanelL = e.clientX - panelMoveInnerX;
|
|
1050
1154
|
this.nrrd_states.previousPanelT = e.clientY - panelMoveInnerY;
|
|
@@ -1053,8 +1157,9 @@ export class nrrd_tools {
|
|
|
1053
1157
|
this.displayCanvas.style.top = this.drawingCanvas.style.top =
|
|
1054
1158
|
this.nrrd_states.previousPanelT + "px";
|
|
1055
1159
|
};
|
|
1056
|
-
//
|
|
1057
|
-
|
|
1160
|
+
// brush circle move
|
|
1161
|
+
this.drawingPrameters.handleOnDrawingBrushCricleMove = (e) => {
|
|
1162
|
+
e.preventDefault();
|
|
1058
1163
|
this.nrrd_states.Mouse_Over_x = e.offsetX;
|
|
1059
1164
|
this.nrrd_states.Mouse_Over_y = e.offsetY;
|
|
1060
1165
|
if (this.nrrd_states.Mouse_Over_x === undefined) {
|
|
@@ -1063,21 +1168,31 @@ export class nrrd_tools {
|
|
|
1063
1168
|
}
|
|
1064
1169
|
if (e.type === "mouseout") {
|
|
1065
1170
|
this.nrrd_states.Mouse_Over = false;
|
|
1066
|
-
this.drawingCanvas.removeEventListener("mousemove",
|
|
1171
|
+
this.drawingCanvas.removeEventListener("mousemove", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
1067
1172
|
}
|
|
1068
1173
|
else if (e.type === "mouseover") {
|
|
1069
1174
|
this.nrrd_states.Mouse_Over = true;
|
|
1070
|
-
this.drawingCanvas.addEventListener("mousemove",
|
|
1175
|
+
this.drawingCanvas.addEventListener("mousemove", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
1071
1176
|
}
|
|
1072
|
-
e.preventDefault();
|
|
1073
1177
|
};
|
|
1074
|
-
//
|
|
1075
|
-
this.
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1178
|
+
// drawing move
|
|
1179
|
+
this.drawingPrameters.handleOnDrawingMouseMove = (e) => {
|
|
1180
|
+
this.Is_Draw = true;
|
|
1181
|
+
if (Is_Painting) {
|
|
1182
|
+
if (this.gui_states.Eraser) {
|
|
1183
|
+
this.nrrd_states.stepClear = 1;
|
|
1184
|
+
// drawingCtx.clearRect(e.offsetX - 5, e.offsetY - 5, 25, 25);
|
|
1185
|
+
clearArc(e.offsetX, e.offsetY, this.gui_states.brushAndEraserSize);
|
|
1186
|
+
}
|
|
1187
|
+
else {
|
|
1188
|
+
lines.push({ x: e.offsetX, y: e.offsetY });
|
|
1189
|
+
this.paintOnCanvasLayer(e.offsetX, e.offsetY);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
this.drawingPrameters.handleOnDrawingMouseDown = (e) => {
|
|
1079
1194
|
if (leftclicked || rightclicked) {
|
|
1080
|
-
this.drawingCanvas.removeEventListener("pointerup",
|
|
1195
|
+
this.drawingCanvas.removeEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
1081
1196
|
this.drawingLayerMasterCtx.closePath();
|
|
1082
1197
|
return;
|
|
1083
1198
|
}
|
|
@@ -1088,7 +1203,7 @@ export class nrrd_tools {
|
|
|
1088
1203
|
currentSliceIndex = this.mainPreSlice.index;
|
|
1089
1204
|
}
|
|
1090
1205
|
// remove it when mouse click down
|
|
1091
|
-
this.drawingCanvas.removeEventListener("wheel", this.
|
|
1206
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
1092
1207
|
if (e.button === 0) {
|
|
1093
1208
|
if (this.Is_Shift_Pressed) {
|
|
1094
1209
|
leftclicked = true;
|
|
@@ -1108,32 +1223,23 @@ export class nrrd_tools {
|
|
|
1108
1223
|
}
|
|
1109
1224
|
this.nrrd_states.drawStartPos.set(e.offsetX, e.offsetY);
|
|
1110
1225
|
// this.drawingLayerMasterCtx.beginPath();
|
|
1111
|
-
this.drawingCanvas.addEventListener("pointerup",
|
|
1112
|
-
this.drawingCanvas.addEventListener("pointermove",
|
|
1226
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
1227
|
+
this.drawingCanvas.addEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
1113
1228
|
}
|
|
1114
1229
|
else if (this.nrrd_states.enableCursorChoose) {
|
|
1115
1230
|
this.nrrd_states.cursorPageX =
|
|
1116
1231
|
e.offsetX / this.nrrd_states.sizeFoctor;
|
|
1117
1232
|
this.nrrd_states.cursorPageY =
|
|
1118
1233
|
e.offsetY / this.nrrd_states.sizeFoctor;
|
|
1119
|
-
this.
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
this.cursorPage.y.updated = true;
|
|
1129
|
-
this.cursorPage.z.updated = false;
|
|
1130
|
-
break;
|
|
1131
|
-
case "z":
|
|
1132
|
-
this.cursorPage.x.updated = false;
|
|
1133
|
-
this.cursorPage.y.updated = false;
|
|
1134
|
-
this.cursorPage.z.updated = true;
|
|
1135
|
-
break;
|
|
1136
|
-
}
|
|
1234
|
+
this.enableCrosshair();
|
|
1235
|
+
}
|
|
1236
|
+
else if (this.gui_states.sphere) {
|
|
1237
|
+
let mouseX = e.offsetX;
|
|
1238
|
+
let mouseY = e.offsetY;
|
|
1239
|
+
// draw circle
|
|
1240
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
1241
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
1242
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
1137
1243
|
}
|
|
1138
1244
|
}
|
|
1139
1245
|
else if (e.button === 2) {
|
|
@@ -1145,28 +1251,15 @@ export class nrrd_tools {
|
|
|
1145
1251
|
panelMoveInnerX = e.clientX - offsetX;
|
|
1146
1252
|
panelMoveInnerY = e.clientY - offsetY;
|
|
1147
1253
|
this.drawingCanvas.style.cursor = "grab";
|
|
1148
|
-
this.drawingCanvas.addEventListener("pointerup",
|
|
1149
|
-
this.drawingCanvas.addEventListener("pointermove",
|
|
1254
|
+
this.drawingCanvas.addEventListener("pointerup", this.drawingPrameters.handleOnDrawingMouseUp);
|
|
1255
|
+
this.drawingCanvas.addEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
1150
1256
|
}
|
|
1151
1257
|
else {
|
|
1152
1258
|
return;
|
|
1153
1259
|
}
|
|
1154
|
-
}, true);
|
|
1155
|
-
const clearArc = this.useEraser();
|
|
1156
|
-
const handleOnPainterMove = (e) => {
|
|
1157
|
-
this.Is_Draw = true;
|
|
1158
|
-
if (Is_Painting) {
|
|
1159
|
-
if (this.gui_states.Eraser) {
|
|
1160
|
-
this.nrrd_states.stepClear = 1;
|
|
1161
|
-
// drawingCtx.clearRect(e.offsetX - 5, e.offsetY - 5, 25, 25);
|
|
1162
|
-
clearArc(e.offsetX, e.offsetY, this.gui_states.brushAndEraserSize);
|
|
1163
|
-
}
|
|
1164
|
-
else {
|
|
1165
|
-
lines.push({ x: e.offsetX, y: e.offsetY });
|
|
1166
|
-
this.paintOnCanvasLayer(e.offsetX, e.offsetY);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
1260
|
};
|
|
1261
|
+
// disable browser right click menu
|
|
1262
|
+
this.drawingCanvas.addEventListener("pointerdown", this.drawingPrameters.handleOnDrawingMouseDown, true);
|
|
1170
1263
|
const redrawPreviousImageToLabelCtx = (ctx, label = "default") => {
|
|
1171
1264
|
var _a;
|
|
1172
1265
|
let paintImages;
|
|
@@ -1193,13 +1286,13 @@ export class nrrd_tools {
|
|
|
1193
1286
|
// draw privous image
|
|
1194
1287
|
ctx.drawImage(this.emptyCanvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
1195
1288
|
};
|
|
1196
|
-
|
|
1289
|
+
this.drawingPrameters.handleOnDrawingMouseUp = (e) => {
|
|
1197
1290
|
if (e.button === 0) {
|
|
1198
1291
|
if (this.Is_Shift_Pressed || Is_Painting) {
|
|
1199
1292
|
leftclicked = false;
|
|
1200
1293
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
1201
1294
|
ctx.closePath();
|
|
1202
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
1295
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
1203
1296
|
if (!this.gui_states.Eraser) {
|
|
1204
1297
|
if (this.gui_states.segmentation) {
|
|
1205
1298
|
this.drawingCanvasLayerMaster.width =
|
|
@@ -1247,20 +1340,63 @@ export class nrrd_tools {
|
|
|
1247
1340
|
undoObj.layers[this.gui_states.label].push(image);
|
|
1248
1341
|
this.undoArray.push(undoObj);
|
|
1249
1342
|
}
|
|
1343
|
+
// add wheel after pointer up
|
|
1344
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel, {
|
|
1345
|
+
passive: false,
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
else if (this.gui_states.sphere &&
|
|
1349
|
+
!this.nrrd_states.enableCursorChoose) {
|
|
1350
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
1351
|
+
let mouseX = e.offsetX;
|
|
1352
|
+
let mouseY = e.offsetY;
|
|
1353
|
+
this.nrrd_states.sphereOrigin[this.axis] = [
|
|
1354
|
+
mouseX,
|
|
1355
|
+
mouseY,
|
|
1356
|
+
this.nrrd_states.currentIndex,
|
|
1357
|
+
];
|
|
1358
|
+
/************ */
|
|
1359
|
+
this.setUpSphereOrigins(mouseX, mouseY);
|
|
1360
|
+
this.nrrd_states.cursorPageX = mouseX;
|
|
1361
|
+
this.nrrd_states.cursorPageY = mouseY;
|
|
1362
|
+
this.enableCrosshair();
|
|
1363
|
+
// plan B
|
|
1364
|
+
// findout all index in the sphere radius range in Axial view
|
|
1365
|
+
if (this.nrrd_states.spherePlanB) {
|
|
1366
|
+
// clear stroe images
|
|
1367
|
+
this.clearStoreImages();
|
|
1368
|
+
for (let i = 0; i < this.nrrd_states.sphereRadius; i++) {
|
|
1369
|
+
this.setEmptyCanvasSize();
|
|
1370
|
+
const preIndex = this.nrrd_states.currentIndex - i;
|
|
1371
|
+
const nextIndex = this.nrrd_states.currentIndex + i;
|
|
1372
|
+
if (preIndex < this.nrrd_states.minIndex ||
|
|
1373
|
+
nextIndex > this.nrrd_states.maxIndex)
|
|
1374
|
+
return;
|
|
1375
|
+
if (preIndex === nextIndex) {
|
|
1376
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
1377
|
+
this.drawImageOnEmptyImage(canvas);
|
|
1378
|
+
this.storeAllImages(preIndex, "");
|
|
1379
|
+
}
|
|
1380
|
+
else {
|
|
1381
|
+
this.drawSphereCore(ctx, mouseX, mouseY, this.nrrd_states.sphereRadius - i);
|
|
1382
|
+
this.drawImageOnEmptyImage(canvas);
|
|
1383
|
+
this.storeAllImages(preIndex, "");
|
|
1384
|
+
this.storeAllImages(nextIndex, "");
|
|
1385
|
+
}
|
|
1386
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
1250
1390
|
}
|
|
1251
1391
|
}
|
|
1252
1392
|
else if (e.button === 2) {
|
|
1253
1393
|
rightclicked = false;
|
|
1254
1394
|
this.drawingCanvas.style.cursor = "grab";
|
|
1255
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
1395
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
1256
1396
|
}
|
|
1257
1397
|
else {
|
|
1258
1398
|
return;
|
|
1259
1399
|
}
|
|
1260
|
-
// add wheel after pointer up
|
|
1261
|
-
this.drawingCanvas.addEventListener("wheel", this.handleWheelMove, {
|
|
1262
|
-
passive: false,
|
|
1263
|
-
});
|
|
1264
1400
|
if (!this.gui_states.segmentation) {
|
|
1265
1401
|
this.setIsDrawFalse(100);
|
|
1266
1402
|
}
|
|
@@ -1271,12 +1407,13 @@ export class nrrd_tools {
|
|
|
1271
1407
|
if (leftclicked) {
|
|
1272
1408
|
leftclicked = false;
|
|
1273
1409
|
this.drawingLayerMasterCtx.closePath();
|
|
1274
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
1410
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnDrawingMouseMove);
|
|
1411
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleSphereWheel, true);
|
|
1275
1412
|
}
|
|
1276
1413
|
if (rightclicked) {
|
|
1277
1414
|
rightclicked = false;
|
|
1278
1415
|
this.drawingCanvas.style.cursor = "grab";
|
|
1279
|
-
this.drawingCanvas.removeEventListener("pointermove",
|
|
1416
|
+
this.drawingCanvas.removeEventListener("pointermove", this.drawingPrameters.handleOnPanMouseMove);
|
|
1280
1417
|
}
|
|
1281
1418
|
this.setIsDrawFalse(100);
|
|
1282
1419
|
if (this.gui_states.segmentation) {
|
|
@@ -1331,6 +1468,68 @@ export class nrrd_tools {
|
|
|
1331
1468
|
}
|
|
1332
1469
|
});
|
|
1333
1470
|
}
|
|
1471
|
+
enableCrosshair() {
|
|
1472
|
+
this.nrrd_states.isCursorSelect = true;
|
|
1473
|
+
switch (this.axis) {
|
|
1474
|
+
case "x":
|
|
1475
|
+
this.cursorPage.x.updated = true;
|
|
1476
|
+
this.cursorPage.y.updated = false;
|
|
1477
|
+
this.cursorPage.z.updated = false;
|
|
1478
|
+
break;
|
|
1479
|
+
case "y":
|
|
1480
|
+
this.cursorPage.x.updated = false;
|
|
1481
|
+
this.cursorPage.y.updated = true;
|
|
1482
|
+
this.cursorPage.z.updated = false;
|
|
1483
|
+
break;
|
|
1484
|
+
case "z":
|
|
1485
|
+
this.cursorPage.x.updated = false;
|
|
1486
|
+
this.cursorPage.y.updated = false;
|
|
1487
|
+
this.cursorPage.z.updated = true;
|
|
1488
|
+
break;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
setUpSphereOrigins(mouseX, mouseY) {
|
|
1492
|
+
const convertCursor = (from, to) => {
|
|
1493
|
+
const convertObj = this.convertCursorPoint(from, to, mouseX, mouseY, this.nrrd_states.currentIndex);
|
|
1494
|
+
return {
|
|
1495
|
+
convertCursorNumX: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumX,
|
|
1496
|
+
convertCursorNumY: convertObj === null || convertObj === void 0 ? void 0 : convertObj.convertCursorNumY,
|
|
1497
|
+
currentIndex: convertObj === null || convertObj === void 0 ? void 0 : convertObj.currentIndex,
|
|
1498
|
+
};
|
|
1499
|
+
};
|
|
1500
|
+
const axisConversions = {
|
|
1501
|
+
x: { axisTo1: "y", axisTo2: "z" },
|
|
1502
|
+
y: { axisTo1: "z", axisTo2: "x" },
|
|
1503
|
+
z: { axisTo1: "x", axisTo2: "y" },
|
|
1504
|
+
};
|
|
1505
|
+
const { axisTo1, axisTo2 } = axisConversions[this.axis];
|
|
1506
|
+
this.nrrd_states.sphereOrigin[axisTo1] = [
|
|
1507
|
+
convertCursor(this.axis, axisTo1).convertCursorNumX,
|
|
1508
|
+
convertCursor(this.axis, axisTo1).convertCursorNumY,
|
|
1509
|
+
convertCursor(this.axis, axisTo1).currentIndex,
|
|
1510
|
+
];
|
|
1511
|
+
this.nrrd_states.sphereOrigin[axisTo2] = [
|
|
1512
|
+
convertCursor(this.axis, axisTo2).convertCursorNumX,
|
|
1513
|
+
convertCursor(this.axis, axisTo2).convertCursorNumY,
|
|
1514
|
+
convertCursor(this.axis, axisTo2).currentIndex,
|
|
1515
|
+
];
|
|
1516
|
+
}
|
|
1517
|
+
// for sphere
|
|
1518
|
+
drawSphereCore(ctx, x, y, radius) {
|
|
1519
|
+
ctx.beginPath();
|
|
1520
|
+
ctx.arc(x, y, radius * this.nrrd_states.sizeFoctor, 0, 2 * Math.PI);
|
|
1521
|
+
ctx.fillStyle = this.gui_states.fillColor;
|
|
1522
|
+
ctx.fill();
|
|
1523
|
+
ctx.closePath();
|
|
1524
|
+
}
|
|
1525
|
+
drawSphere(mouseX, mouseY, radius) {
|
|
1526
|
+
let { ctx, canvas } = this.setCurrentLayer();
|
|
1527
|
+
// clear canvas
|
|
1528
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
1529
|
+
this.drawingLayerMasterCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
1530
|
+
this.drawSphereCore(ctx, mouseX, mouseY, radius);
|
|
1531
|
+
this.drawingLayerMasterCtx.drawImage(canvas, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
1532
|
+
}
|
|
1334
1533
|
// need to update
|
|
1335
1534
|
undoLastPainting() {
|
|
1336
1535
|
let { ctx, canvas } = this.setCurrentLayer();
|
|
@@ -1348,7 +1547,9 @@ export class nrrd_tools {
|
|
|
1348
1547
|
if (layerLen > 0) {
|
|
1349
1548
|
// const imageSrc = undo.undos[undo.undos.length - 1];
|
|
1350
1549
|
const image = layerUndos[layerLen - 1];
|
|
1351
|
-
|
|
1550
|
+
if (!!image) {
|
|
1551
|
+
ctx.drawImage(image, 0, 0, this.nrrd_states.changedWidth, this.nrrd_states.changedHeight);
|
|
1552
|
+
}
|
|
1352
1553
|
}
|
|
1353
1554
|
if (undo.layers.label1.length > 0) {
|
|
1354
1555
|
const image = undo.layers.label1[undo.layers.label1.length - 1];
|
|
@@ -1372,9 +1573,29 @@ export class nrrd_tools {
|
|
|
1372
1573
|
return item.sliceIndex === this.nrrd_states.currentIndex;
|
|
1373
1574
|
});
|
|
1374
1575
|
}
|
|
1375
|
-
|
|
1576
|
+
// drawing canvas mouse shpere wheel
|
|
1577
|
+
configMouseSphereWheel() {
|
|
1578
|
+
const sphereEvent = (e) => {
|
|
1579
|
+
e.preventDefault();
|
|
1580
|
+
if (e.deltaY < 0) {
|
|
1581
|
+
this.nrrd_states.sphereRadius += 1;
|
|
1582
|
+
}
|
|
1583
|
+
else {
|
|
1584
|
+
this.nrrd_states.sphereRadius -= 1;
|
|
1585
|
+
}
|
|
1586
|
+
// limited the radius max and min
|
|
1587
|
+
this.nrrd_states.sphereRadius = Math.max(1, Math.min(this.nrrd_states.sphereRadius, 50));
|
|
1588
|
+
// get mouse position
|
|
1589
|
+
const mouseX = e.offsetX;
|
|
1590
|
+
const mouseY = e.offsetY;
|
|
1591
|
+
this.drawSphere(mouseX, mouseY, this.nrrd_states.sphereRadius);
|
|
1592
|
+
};
|
|
1593
|
+
return sphereEvent;
|
|
1594
|
+
}
|
|
1595
|
+
// drawing canvas mouse zoom wheel
|
|
1596
|
+
configMouseZoomWheel(controls) {
|
|
1376
1597
|
let moveDistance = 1;
|
|
1377
|
-
const
|
|
1598
|
+
const handleZoomWheelMove = (e) => {
|
|
1378
1599
|
if (this.Is_Shift_Pressed) {
|
|
1379
1600
|
return;
|
|
1380
1601
|
}
|
|
@@ -1410,7 +1631,7 @@ export class nrrd_tools {
|
|
|
1410
1631
|
}
|
|
1411
1632
|
this.nrrd_states.sizeFoctor = moveDistance;
|
|
1412
1633
|
};
|
|
1413
|
-
return
|
|
1634
|
+
return handleZoomWheelMove;
|
|
1414
1635
|
}
|
|
1415
1636
|
useEraser() {
|
|
1416
1637
|
const clearArc = (x, y, radius) => {
|
|
@@ -1521,155 +1742,6 @@ export class nrrd_tools {
|
|
|
1521
1742
|
}
|
|
1522
1743
|
return { ctx, canvas };
|
|
1523
1744
|
}
|
|
1524
|
-
configGui(modeFolder) {
|
|
1525
|
-
if (modeFolder.__controllers.length > 0)
|
|
1526
|
-
this.removeGuiFolderChilden(modeFolder);
|
|
1527
|
-
modeFolder.open();
|
|
1528
|
-
const actionsFolder = modeFolder.addFolder("Default Actions");
|
|
1529
|
-
actionsFolder
|
|
1530
|
-
.add(this.gui_states, "label", ["label1", "label2", "label3"])
|
|
1531
|
-
.onChange((val) => {
|
|
1532
|
-
if (val === "label1") {
|
|
1533
|
-
this.gui_states.fillColor = "#00ff00";
|
|
1534
|
-
this.gui_states.brushColor = "#00ff00";
|
|
1535
|
-
}
|
|
1536
|
-
else if (val === "label2") {
|
|
1537
|
-
this.gui_states.fillColor = "#ff0000";
|
|
1538
|
-
this.gui_states.brushColor = "#ff0000";
|
|
1539
|
-
}
|
|
1540
|
-
else if (val === "label3") {
|
|
1541
|
-
this.gui_states.fillColor = "#0000ff";
|
|
1542
|
-
this.gui_states.brushColor = "#0000ff";
|
|
1543
|
-
}
|
|
1544
|
-
});
|
|
1545
|
-
actionsFolder
|
|
1546
|
-
.add(this.gui_states, "cursor", ["crosshair", "pencil", "dot"])
|
|
1547
|
-
.name("cursor icons")
|
|
1548
|
-
.onChange((value) => {
|
|
1549
|
-
if (value === "crosshair") {
|
|
1550
|
-
this.nrrd_states.defaultPaintCursor = "crosshair";
|
|
1551
|
-
}
|
|
1552
|
-
if (value === "pencil") {
|
|
1553
|
-
this.nrrd_states.defaultPaintCursor =
|
|
1554
|
-
"url(https://raw.githubusercontent.com/LinkunGao/copper3d_icons/main/icons/pencil-black.svg), auto";
|
|
1555
|
-
}
|
|
1556
|
-
if (value === "dot") {
|
|
1557
|
-
this.nrrd_states.defaultPaintCursor =
|
|
1558
|
-
"url(https://raw.githubusercontent.com/LinkunGao/copper3d-datasets/main/icons/dot.svg) 12 12,auto";
|
|
1559
|
-
}
|
|
1560
|
-
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
1561
|
-
});
|
|
1562
|
-
actionsFolder
|
|
1563
|
-
.add(this.gui_states, "mainAreaSize")
|
|
1564
|
-
.name("zoom")
|
|
1565
|
-
.min(1)
|
|
1566
|
-
.max(8)
|
|
1567
|
-
.onFinishChange((factor) => {
|
|
1568
|
-
this.resetPaintArea();
|
|
1569
|
-
this.nrrd_states.sizeFoctor = factor;
|
|
1570
|
-
this.resizePaintArea(factor);
|
|
1571
|
-
});
|
|
1572
|
-
actionsFolder.add(this.gui_states, "resetZoom");
|
|
1573
|
-
actionsFolder
|
|
1574
|
-
.add(this.gui_states, "globalAlpha")
|
|
1575
|
-
.name("opacity")
|
|
1576
|
-
.min(0.1)
|
|
1577
|
-
.max(1)
|
|
1578
|
-
.step(0.01);
|
|
1579
|
-
actionsFolder.add(this.gui_states, "segmentation").name("Pencil");
|
|
1580
|
-
actionsFolder
|
|
1581
|
-
.add(this.gui_states, "brushAndEraserSize")
|
|
1582
|
-
.min(5)
|
|
1583
|
-
.max(50)
|
|
1584
|
-
.step(1)
|
|
1585
|
-
.onChange(() => {
|
|
1586
|
-
if (this.gui_states.Eraser) {
|
|
1587
|
-
this.eraserUrls.length > 0
|
|
1588
|
-
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
1589
|
-
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
1590
|
-
}
|
|
1591
|
-
});
|
|
1592
|
-
actionsFolder.add(this.gui_states, "Eraser").onChange((value) => {
|
|
1593
|
-
this.gui_states.Eraser = value;
|
|
1594
|
-
if (this.gui_states.Eraser) {
|
|
1595
|
-
this.eraserUrls.length > 0
|
|
1596
|
-
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
1597
|
-
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
1598
|
-
}
|
|
1599
|
-
else {
|
|
1600
|
-
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
1601
|
-
}
|
|
1602
|
-
});
|
|
1603
|
-
actionsFolder.add(this.gui_states, "clear");
|
|
1604
|
-
actionsFolder.add(this.gui_states, "clearAll");
|
|
1605
|
-
actionsFolder.add(this.gui_states, "undo");
|
|
1606
|
-
actionsFolder
|
|
1607
|
-
.add(this.mainPreSlice.volume, "windowHigh", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
1608
|
-
.name("Image contrast")
|
|
1609
|
-
.onChange((value) => {
|
|
1610
|
-
this.nrrd_states.readyToUpdate = false;
|
|
1611
|
-
this.updateSlicesContrast(value, "windowHigh");
|
|
1612
|
-
})
|
|
1613
|
-
.onFinishChange(() => {
|
|
1614
|
-
this.repraintAllContrastSlices();
|
|
1615
|
-
this.nrrd_states.readyToUpdate = true;
|
|
1616
|
-
});
|
|
1617
|
-
actionsFolder.add(this.gui_states, "exportMarks");
|
|
1618
|
-
const advanceFolder = modeFolder.addFolder("Advance settings");
|
|
1619
|
-
advanceFolder
|
|
1620
|
-
.add(this.gui_states, "dragSensitivity")
|
|
1621
|
-
.min(1)
|
|
1622
|
-
.max(this.nrrd_states.Max_sensitive)
|
|
1623
|
-
.step(1);
|
|
1624
|
-
const segmentationFolder = advanceFolder.addFolder("Pencil settings");
|
|
1625
|
-
segmentationFolder
|
|
1626
|
-
.add(this.gui_states, "lineWidth")
|
|
1627
|
-
.name("outerLineWidth")
|
|
1628
|
-
.min(1.7)
|
|
1629
|
-
.max(3)
|
|
1630
|
-
.step(0.01);
|
|
1631
|
-
segmentationFolder.addColor(this.gui_states, "color");
|
|
1632
|
-
segmentationFolder.addColor(this.gui_states, "fillColor");
|
|
1633
|
-
const bushFolder = advanceFolder.addFolder("Brush settings");
|
|
1634
|
-
bushFolder.addColor(this.gui_states, "brushColor");
|
|
1635
|
-
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
|
|
1636
|
-
advanceFolder.add(this.gui_states, "downloadCurrentMask");
|
|
1637
|
-
const contrastFolder = advanceFolder.addFolder("contrast advance settings");
|
|
1638
|
-
contrastFolder
|
|
1639
|
-
.add(this.mainPreSlice.volume, "lowerThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
1640
|
-
.name("Lower Threshold")
|
|
1641
|
-
.onChange((value) => {
|
|
1642
|
-
this.nrrd_states.readyToUpdate = false;
|
|
1643
|
-
this.updateSlicesContrast(value, "lowerThreshold");
|
|
1644
|
-
})
|
|
1645
|
-
.onFinishChange(() => {
|
|
1646
|
-
this.repraintAllContrastSlices();
|
|
1647
|
-
this.nrrd_states.readyToUpdate = true;
|
|
1648
|
-
});
|
|
1649
|
-
contrastFolder
|
|
1650
|
-
.add(this.mainPreSlice.volume, "upperThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
1651
|
-
.name("Upper Threshold")
|
|
1652
|
-
.onChange((value) => {
|
|
1653
|
-
this.nrrd_states.readyToUpdate = false;
|
|
1654
|
-
this.updateSlicesContrast(value, "upperThreshold");
|
|
1655
|
-
})
|
|
1656
|
-
.onFinishChange(() => {
|
|
1657
|
-
this.repraintAllContrastSlices();
|
|
1658
|
-
this.nrrd_states.readyToUpdate = true;
|
|
1659
|
-
});
|
|
1660
|
-
contrastFolder
|
|
1661
|
-
.add(this.mainPreSlice.volume, "windowLow", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
1662
|
-
.name("Window Low")
|
|
1663
|
-
.onChange((value) => {
|
|
1664
|
-
this.nrrd_states.readyToUpdate = false;
|
|
1665
|
-
this.updateSlicesContrast(value, "windowLow");
|
|
1666
|
-
})
|
|
1667
|
-
.onFinishChange(() => {
|
|
1668
|
-
this.repraintAllContrastSlices();
|
|
1669
|
-
this.nrrd_states.readyToUpdate = true;
|
|
1670
|
-
});
|
|
1671
|
-
actionsFolder.open();
|
|
1672
|
-
}
|
|
1673
1745
|
updateSlicesContrast(value, flag) {
|
|
1674
1746
|
switch (flag) {
|
|
1675
1747
|
case "lowerThreshold":
|
|
@@ -1848,12 +1920,15 @@ export class nrrd_tools {
|
|
|
1848
1920
|
delete dic[key];
|
|
1849
1921
|
}
|
|
1850
1922
|
}
|
|
1923
|
+
drawImageOnEmptyImage(canvas) {
|
|
1924
|
+
this.emptyCtx.drawImage(canvas, 0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
1925
|
+
}
|
|
1851
1926
|
storeAllImages(index, label) {
|
|
1852
1927
|
// const image: HTMLImageElement = new Image();
|
|
1853
1928
|
// resize the drawing image data
|
|
1854
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
1929
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
1855
1930
|
this.setEmptyCanvasSize();
|
|
1856
|
-
this.
|
|
1931
|
+
this.drawImageOnEmptyImage(this.drawingCanvasLayerMaster);
|
|
1857
1932
|
}
|
|
1858
1933
|
let imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
1859
1934
|
// 1.12.23
|
|
@@ -1923,7 +1998,7 @@ export class nrrd_tools {
|
|
|
1923
1998
|
break;
|
|
1924
1999
|
}
|
|
1925
2000
|
this.storeImageToAxis(index, this.paintImages, imageData);
|
|
1926
|
-
if (!this.nrrd_states.loadMaskJson) {
|
|
2001
|
+
if (!this.nrrd_states.loadMaskJson && !this.gui_states.sphere) {
|
|
1927
2002
|
this.storeEachLayerImage(index, label);
|
|
1928
2003
|
}
|
|
1929
2004
|
}
|
|
@@ -1958,7 +2033,7 @@ export class nrrd_tools {
|
|
|
1958
2033
|
storeImageToLabel(index, canvas, paintedImages) {
|
|
1959
2034
|
if (!this.nrrd_states.loadMaskJson) {
|
|
1960
2035
|
this.setEmptyCanvasSize();
|
|
1961
|
-
this.
|
|
2036
|
+
this.drawImageOnEmptyImage(canvas);
|
|
1962
2037
|
}
|
|
1963
2038
|
const imageData = this.emptyCtx.getImageData(0, 0, this.emptyCanvas.width, this.emptyCanvas.height);
|
|
1964
2039
|
this.storeImageToAxis(index, paintedImages, imageData);
|
|
@@ -2181,5 +2256,184 @@ export class nrrd_tools {
|
|
|
2181
2256
|
// }
|
|
2182
2257
|
// };
|
|
2183
2258
|
}
|
|
2259
|
+
configGui(modeFolder) {
|
|
2260
|
+
if (modeFolder.__controllers.length > 0)
|
|
2261
|
+
this.removeGuiFolderChilden(modeFolder);
|
|
2262
|
+
modeFolder.open();
|
|
2263
|
+
const actionsFolder = modeFolder.addFolder("Default Actions");
|
|
2264
|
+
actionsFolder
|
|
2265
|
+
.add(this.gui_states, "label", ["label1", "label2", "label3"])
|
|
2266
|
+
.onChange((val) => {
|
|
2267
|
+
if (val === "label1") {
|
|
2268
|
+
this.gui_states.fillColor = "#00ff00";
|
|
2269
|
+
this.gui_states.brushColor = "#00ff00";
|
|
2270
|
+
}
|
|
2271
|
+
else if (val === "label2") {
|
|
2272
|
+
this.gui_states.fillColor = "#ff0000";
|
|
2273
|
+
this.gui_states.brushColor = "#ff0000";
|
|
2274
|
+
}
|
|
2275
|
+
else if (val === "label3") {
|
|
2276
|
+
this.gui_states.fillColor = "#0000ff";
|
|
2277
|
+
this.gui_states.brushColor = "#0000ff";
|
|
2278
|
+
}
|
|
2279
|
+
});
|
|
2280
|
+
actionsFolder
|
|
2281
|
+
.add(this.gui_states, "cursor", ["crosshair", "pencil", "dot"])
|
|
2282
|
+
.name("cursor icons")
|
|
2283
|
+
.onChange((value) => {
|
|
2284
|
+
if (value === "crosshair") {
|
|
2285
|
+
this.nrrd_states.defaultPaintCursor = "crosshair";
|
|
2286
|
+
}
|
|
2287
|
+
if (value === "pencil") {
|
|
2288
|
+
this.nrrd_states.defaultPaintCursor =
|
|
2289
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d_icons/main/icons/pencil-black.svg), auto";
|
|
2290
|
+
}
|
|
2291
|
+
if (value === "dot") {
|
|
2292
|
+
this.nrrd_states.defaultPaintCursor =
|
|
2293
|
+
"url(https://raw.githubusercontent.com/LinkunGao/copper3d-datasets/main/icons/dot.svg) 12 12,auto";
|
|
2294
|
+
}
|
|
2295
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
2296
|
+
});
|
|
2297
|
+
actionsFolder
|
|
2298
|
+
.add(this.gui_states, "mainAreaSize")
|
|
2299
|
+
.name("zoom")
|
|
2300
|
+
.min(1)
|
|
2301
|
+
.max(8)
|
|
2302
|
+
.onFinishChange((factor) => {
|
|
2303
|
+
this.resetPaintArea();
|
|
2304
|
+
this.nrrd_states.sizeFoctor = factor;
|
|
2305
|
+
this.resizePaintArea(factor);
|
|
2306
|
+
});
|
|
2307
|
+
actionsFolder.add(this.gui_states, "resetZoom");
|
|
2308
|
+
actionsFolder
|
|
2309
|
+
.add(this.gui_states, "globalAlpha")
|
|
2310
|
+
.name("opacity")
|
|
2311
|
+
.min(0.1)
|
|
2312
|
+
.max(1)
|
|
2313
|
+
.step(0.01);
|
|
2314
|
+
actionsFolder
|
|
2315
|
+
.add(this.gui_states, "segmentation")
|
|
2316
|
+
.name("Pencil")
|
|
2317
|
+
.onChange(() => {
|
|
2318
|
+
if (this.gui_states.segmentation) {
|
|
2319
|
+
// add canvas brush circle move event listeners
|
|
2320
|
+
this.drawingCanvas.removeEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
2321
|
+
this.drawingCanvas.removeEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
2322
|
+
}
|
|
2323
|
+
else {
|
|
2324
|
+
// add canvas brush circle move event listeners
|
|
2325
|
+
this.drawingCanvas.addEventListener("mouseover", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
2326
|
+
this.drawingCanvas.addEventListener("mouseout", this.drawingPrameters.handleOnDrawingBrushCricleMove);
|
|
2327
|
+
}
|
|
2328
|
+
});
|
|
2329
|
+
actionsFolder
|
|
2330
|
+
.add(this.gui_states, "sphere")
|
|
2331
|
+
.name("Sphere")
|
|
2332
|
+
.onChange(() => {
|
|
2333
|
+
if (this.gui_states.sphere) {
|
|
2334
|
+
this.drawingCanvas.removeEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
2335
|
+
this.removeDragMode();
|
|
2336
|
+
}
|
|
2337
|
+
else {
|
|
2338
|
+
this.drawingCanvas.addEventListener("wheel", this.drawingPrameters.handleZoomWheel);
|
|
2339
|
+
this.configDragMode();
|
|
2340
|
+
// clear canvas
|
|
2341
|
+
this.clearPaint();
|
|
2342
|
+
this.clearStoreImages();
|
|
2343
|
+
}
|
|
2344
|
+
});
|
|
2345
|
+
actionsFolder
|
|
2346
|
+
.add(this.gui_states, "brushAndEraserSize")
|
|
2347
|
+
.min(5)
|
|
2348
|
+
.max(50)
|
|
2349
|
+
.step(1)
|
|
2350
|
+
.onChange(() => {
|
|
2351
|
+
if (this.gui_states.Eraser) {
|
|
2352
|
+
this.eraserUrls.length > 0
|
|
2353
|
+
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
2354
|
+
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
actionsFolder.add(this.gui_states, "Eraser").onChange((value) => {
|
|
2358
|
+
this.gui_states.Eraser = value;
|
|
2359
|
+
if (this.gui_states.Eraser) {
|
|
2360
|
+
this.eraserUrls.length > 0
|
|
2361
|
+
? (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize, this.eraserUrls))
|
|
2362
|
+
: (this.drawingCanvas.style.cursor = switchEraserSize(this.gui_states.brushAndEraserSize));
|
|
2363
|
+
}
|
|
2364
|
+
else {
|
|
2365
|
+
this.drawingCanvas.style.cursor = this.nrrd_states.defaultPaintCursor;
|
|
2366
|
+
}
|
|
2367
|
+
});
|
|
2368
|
+
actionsFolder.add(this.gui_states, "clear");
|
|
2369
|
+
actionsFolder.add(this.gui_states, "clearAll");
|
|
2370
|
+
actionsFolder.add(this.gui_states, "undo");
|
|
2371
|
+
actionsFolder
|
|
2372
|
+
.add(this.mainPreSlice.volume, "windowHigh", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
2373
|
+
.name("Image contrast")
|
|
2374
|
+
.onChange((value) => {
|
|
2375
|
+
this.nrrd_states.readyToUpdate = false;
|
|
2376
|
+
this.updateSlicesContrast(value, "windowHigh");
|
|
2377
|
+
})
|
|
2378
|
+
.onFinishChange(() => {
|
|
2379
|
+
this.repraintAllContrastSlices();
|
|
2380
|
+
this.nrrd_states.readyToUpdate = true;
|
|
2381
|
+
});
|
|
2382
|
+
actionsFolder.add(this.gui_states, "exportMarks");
|
|
2383
|
+
const advanceFolder = modeFolder.addFolder("Advance settings");
|
|
2384
|
+
advanceFolder
|
|
2385
|
+
.add(this.gui_states, "dragSensitivity")
|
|
2386
|
+
.min(1)
|
|
2387
|
+
.max(this.nrrd_states.Max_sensitive)
|
|
2388
|
+
.step(1);
|
|
2389
|
+
const segmentationFolder = advanceFolder.addFolder("Pencil settings");
|
|
2390
|
+
segmentationFolder
|
|
2391
|
+
.add(this.gui_states, "lineWidth")
|
|
2392
|
+
.name("outerLineWidth")
|
|
2393
|
+
.min(1.7)
|
|
2394
|
+
.max(3)
|
|
2395
|
+
.step(0.01);
|
|
2396
|
+
segmentationFolder.addColor(this.gui_states, "color");
|
|
2397
|
+
segmentationFolder.addColor(this.gui_states, "fillColor");
|
|
2398
|
+
const bushFolder = advanceFolder.addFolder("Brush settings");
|
|
2399
|
+
bushFolder.addColor(this.gui_states, "brushColor");
|
|
2400
|
+
// modeFolder.add(this.stateMode, "EraserSize").min(1).max(50).step(1);
|
|
2401
|
+
advanceFolder.add(this.gui_states, "downloadCurrentMask");
|
|
2402
|
+
const contrastFolder = advanceFolder.addFolder("contrast advance settings");
|
|
2403
|
+
contrastFolder
|
|
2404
|
+
.add(this.mainPreSlice.volume, "lowerThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
2405
|
+
.name("Lower Threshold")
|
|
2406
|
+
.onChange((value) => {
|
|
2407
|
+
this.nrrd_states.readyToUpdate = false;
|
|
2408
|
+
this.updateSlicesContrast(value, "lowerThreshold");
|
|
2409
|
+
})
|
|
2410
|
+
.onFinishChange(() => {
|
|
2411
|
+
this.repraintAllContrastSlices();
|
|
2412
|
+
this.nrrd_states.readyToUpdate = true;
|
|
2413
|
+
});
|
|
2414
|
+
contrastFolder
|
|
2415
|
+
.add(this.mainPreSlice.volume, "upperThreshold", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
2416
|
+
.name("Upper Threshold")
|
|
2417
|
+
.onChange((value) => {
|
|
2418
|
+
this.nrrd_states.readyToUpdate = false;
|
|
2419
|
+
this.updateSlicesContrast(value, "upperThreshold");
|
|
2420
|
+
})
|
|
2421
|
+
.onFinishChange(() => {
|
|
2422
|
+
this.repraintAllContrastSlices();
|
|
2423
|
+
this.nrrd_states.readyToUpdate = true;
|
|
2424
|
+
});
|
|
2425
|
+
contrastFolder
|
|
2426
|
+
.add(this.mainPreSlice.volume, "windowLow", this.mainPreSlice.volume.min, this.mainPreSlice.volume.max, 1)
|
|
2427
|
+
.name("Window Low")
|
|
2428
|
+
.onChange((value) => {
|
|
2429
|
+
this.nrrd_states.readyToUpdate = false;
|
|
2430
|
+
this.updateSlicesContrast(value, "windowLow");
|
|
2431
|
+
})
|
|
2432
|
+
.onFinishChange(() => {
|
|
2433
|
+
this.repraintAllContrastSlices();
|
|
2434
|
+
this.nrrd_states.readyToUpdate = true;
|
|
2435
|
+
});
|
|
2436
|
+
actionsFolder.open();
|
|
2437
|
+
}
|
|
2184
2438
|
}
|
|
2185
2439
|
//# sourceMappingURL=nrrd_tool.js.map
|