@cornerstonejs/tools 3.17.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/tools/annotation/CircleROITool.js +15 -12
- package/dist/esm/tools/annotation/EllipticalROITool.js +14 -11
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +42 -38
- package/dist/esm/tools/annotation/RectangleROITool.js +23 -10
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -533,12 +533,15 @@ class CircleROITool extends AnnotationTool {
|
|
|
533
533
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
534
534
|
};
|
|
535
535
|
const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
536
|
+
let pointsInShape;
|
|
537
|
+
if (voxelManager) {
|
|
538
|
+
pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
|
|
539
|
+
isInObject: (pointLPS) => pointInEllipse(ellipseObj, pointLPS, { fast: true }),
|
|
540
|
+
boundsIJK,
|
|
541
|
+
imageData,
|
|
542
|
+
returnPoints: this.configuration.storePointData,
|
|
543
|
+
});
|
|
544
|
+
}
|
|
542
545
|
const stats = this.configuration.statsCalculator.getStatistics();
|
|
543
546
|
cachedStats[targetId] = {
|
|
544
547
|
Modality: metadata.Modality,
|
|
@@ -624,28 +627,28 @@ function defaultGetTextLines(data, targetId) {
|
|
|
624
627
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
625
628
|
const { radius, radiusUnit, area, mean, stdDev, max, min, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
|
|
626
629
|
const textLines = [];
|
|
627
|
-
if (radius) {
|
|
630
|
+
if (csUtils.isNumber(radius)) {
|
|
628
631
|
const radiusLine = isEmptyArea
|
|
629
632
|
? `Radius: Oblique not supported`
|
|
630
633
|
: `Radius: ${csUtils.roundNumber(radius)} ${radiusUnit}`;
|
|
631
634
|
textLines.push(radiusLine);
|
|
632
635
|
}
|
|
633
|
-
if (area) {
|
|
636
|
+
if (csUtils.isNumber(area)) {
|
|
634
637
|
const areaLine = isEmptyArea
|
|
635
638
|
? `Area: Oblique not supported`
|
|
636
639
|
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
637
640
|
textLines.push(areaLine);
|
|
638
641
|
}
|
|
639
|
-
if (mean) {
|
|
642
|
+
if (csUtils.isNumber(mean)) {
|
|
640
643
|
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
641
644
|
}
|
|
642
|
-
if (max) {
|
|
645
|
+
if (csUtils.isNumber(max)) {
|
|
643
646
|
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
644
647
|
}
|
|
645
|
-
if (min) {
|
|
648
|
+
if (csUtils.isNumber(min)) {
|
|
646
649
|
textLines.push(`Min: ${csUtils.roundNumber(min)} ${modalityUnit}`);
|
|
647
650
|
}
|
|
648
|
-
if (stdDev) {
|
|
651
|
+
if (csUtils.isNumber(stdDev)) {
|
|
649
652
|
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
650
653
|
}
|
|
651
654
|
return textLines;
|
|
@@ -609,12 +609,15 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
609
609
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
610
610
|
};
|
|
611
611
|
const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
612
|
+
let pointsInShape;
|
|
613
|
+
if (voxelManager) {
|
|
614
|
+
const pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
|
|
615
|
+
boundsIJK,
|
|
616
|
+
imageData,
|
|
617
|
+
isInObject: (pointLPS) => pointInEllipse(ellipseObj, pointLPS, { fast: true }),
|
|
618
|
+
returnPoints: this.configuration.storePointData,
|
|
619
|
+
});
|
|
620
|
+
}
|
|
618
621
|
const stats = this.configuration.statsCalculator.getStatistics();
|
|
619
622
|
cachedStats[targetId] = {
|
|
620
623
|
Modality: metadata.Modality,
|
|
@@ -702,22 +705,22 @@ function defaultGetTextLines(data, targetId) {
|
|
|
702
705
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
703
706
|
const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, min } = cachedVolumeStats;
|
|
704
707
|
const textLines = [];
|
|
705
|
-
if (area) {
|
|
708
|
+
if (csUtils.isNumber(area)) {
|
|
706
709
|
const areaLine = isEmptyArea
|
|
707
710
|
? `Area: Oblique not supported`
|
|
708
711
|
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
709
712
|
textLines.push(areaLine);
|
|
710
713
|
}
|
|
711
|
-
if (mean) {
|
|
714
|
+
if (csUtils.isNumber(mean)) {
|
|
712
715
|
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
713
716
|
}
|
|
714
|
-
if (max) {
|
|
717
|
+
if (csUtils.isNumber(max)) {
|
|
715
718
|
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
716
719
|
}
|
|
717
|
-
if (min) {
|
|
720
|
+
if (csUtils.isNumber(min)) {
|
|
718
721
|
textLines.push(`Min: ${csUtils.roundNumber(min)} ${modalityUnit}`);
|
|
719
722
|
}
|
|
720
|
-
if (stdDev) {
|
|
723
|
+
if (csUtils.isNumber(stdDev)) {
|
|
721
724
|
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
722
725
|
}
|
|
723
726
|
return textLines;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnnotationTool } from '../base';
|
|
1
2
|
import { CONSTANTS, getEnabledElement, VolumeViewport, utilities as csUtils, metaData, } from '@cornerstonejs/core';
|
|
2
3
|
import { vec3 } from 'gl-matrix';
|
|
3
4
|
import { getCalibratedLengthUnitsAndScale } from '../../utilities/getCalibratedUnits';
|
|
@@ -471,37 +472,40 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
471
472
|
let curRow = 0;
|
|
472
473
|
let intersections = [];
|
|
473
474
|
let intersectionCounter = 0;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
?
|
|
489
|
-
:
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
475
|
+
let pointsInShape;
|
|
476
|
+
if (voxelManager) {
|
|
477
|
+
pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
|
|
478
|
+
imageData,
|
|
479
|
+
isInObject: (pointLPS, _pointIJK) => {
|
|
480
|
+
let result = true;
|
|
481
|
+
const point = viewport.worldToCanvas(pointLPS);
|
|
482
|
+
if (point[1] != curRow) {
|
|
483
|
+
intersectionCounter = 0;
|
|
484
|
+
curRow = point[1];
|
|
485
|
+
intersections = getLineSegmentIntersectionsCoordinates(canvasCoordinates, point, [canvasPosEnd[0], point[1]]);
|
|
486
|
+
intersections.sort((function (index) {
|
|
487
|
+
return function (a, b) {
|
|
488
|
+
return a[index] === b[index]
|
|
489
|
+
? 0
|
|
490
|
+
: a[index] < b[index]
|
|
491
|
+
? -1
|
|
492
|
+
: 1;
|
|
493
|
+
};
|
|
494
|
+
})(0));
|
|
495
|
+
}
|
|
496
|
+
if (intersections.length && point[0] > intersections[0][0]) {
|
|
497
|
+
intersections.shift();
|
|
498
|
+
intersectionCounter++;
|
|
499
|
+
}
|
|
500
|
+
if (intersectionCounter % 2 === 0) {
|
|
501
|
+
result = false;
|
|
502
|
+
}
|
|
503
|
+
return result;
|
|
504
|
+
},
|
|
505
|
+
boundsIJK,
|
|
506
|
+
returnPoints: this.configuration.storePointData,
|
|
507
|
+
});
|
|
508
|
+
}
|
|
505
509
|
const stats = this.configuration.statsCalculator.getStatistics();
|
|
506
510
|
cachedStats[targetId] = {
|
|
507
511
|
Modality: metadata.Modality,
|
|
@@ -532,28 +536,28 @@ function defaultGetTextLines(data, targetId) {
|
|
|
532
536
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
533
537
|
const { area, mean, stdDev, length, perimeter, max, min, isEmptyArea, unit, areaUnit, modalityUnit, } = cachedVolumeStats || {};
|
|
534
538
|
const textLines = [];
|
|
535
|
-
if (area) {
|
|
539
|
+
if (csUtils.isNumber(area)) {
|
|
536
540
|
const areaLine = isEmptyArea
|
|
537
541
|
? `Area: Oblique not supported`
|
|
538
542
|
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
539
543
|
textLines.push(areaLine);
|
|
540
544
|
}
|
|
541
|
-
if (mean) {
|
|
545
|
+
if (csUtils.isNumber(mean)) {
|
|
542
546
|
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
543
547
|
}
|
|
544
|
-
if (
|
|
548
|
+
if (csUtils.isNumber(max)) {
|
|
545
549
|
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
546
550
|
}
|
|
547
|
-
if (
|
|
551
|
+
if (csUtils.isNumber(min)) {
|
|
548
552
|
textLines.push(`Min: ${csUtils.roundNumber(min)} ${modalityUnit}`);
|
|
549
553
|
}
|
|
550
|
-
if (stdDev) {
|
|
554
|
+
if (csUtils.isNumber(stdDev)) {
|
|
551
555
|
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
552
556
|
}
|
|
553
|
-
if (perimeter) {
|
|
557
|
+
if (csUtils.isNumber(perimeter)) {
|
|
554
558
|
textLines.push(`Perimeter: ${csUtils.roundNumber(perimeter)} ${unit}`);
|
|
555
559
|
}
|
|
556
|
-
if (length) {
|
|
560
|
+
if (csUtils.isNumber(length)) {
|
|
557
561
|
textLines.push(`${csUtils.roundNumber(length)} ${unit}`);
|
|
558
562
|
}
|
|
559
563
|
return textLines;
|
|
@@ -486,11 +486,14 @@ class RectangleROITool extends AnnotationTool {
|
|
|
486
486
|
isSuvScaled: this.isSuvScaled(viewport, targetId, annotation.metadata.referencedImageId),
|
|
487
487
|
};
|
|
488
488
|
const modalityUnit = getPixelValueUnits(metadata.Modality, annotation.metadata.referencedImageId, pixelUnitsOptions);
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
489
|
+
let pointsInShape;
|
|
490
|
+
if (voxelManager) {
|
|
491
|
+
pointsInShape = voxelManager.forEach(this.configuration.statsCalculator.statsCallback, {
|
|
492
|
+
boundsIJK,
|
|
493
|
+
imageData,
|
|
494
|
+
returnPoints: this.configuration.storePointData,
|
|
495
|
+
});
|
|
496
|
+
}
|
|
494
497
|
const stats = this.configuration.statsCalculator.getStatistics();
|
|
495
498
|
cachedStats[targetId] = {
|
|
496
499
|
Modality: metadata.Modality,
|
|
@@ -566,11 +569,21 @@ function defaultGetTextLines(data, targetId) {
|
|
|
566
569
|
return;
|
|
567
570
|
}
|
|
568
571
|
const textLines = [];
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
572
|
+
if (csUtils.isNumber(area)) {
|
|
573
|
+
textLines.push(`Area: ${csUtils.roundNumber(area)} ${areaUnit}`);
|
|
574
|
+
}
|
|
575
|
+
if (csUtils.isNumber(mean)) {
|
|
576
|
+
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
577
|
+
}
|
|
578
|
+
if (csUtils.isNumber(max)) {
|
|
579
|
+
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
580
|
+
}
|
|
581
|
+
if (csUtils.isNumber(min)) {
|
|
582
|
+
textLines.push(`Max: ${csUtils.roundNumber(min)} ${modalityUnit}`);
|
|
583
|
+
}
|
|
584
|
+
if (csUtils.isNumber(stdDev)) {
|
|
585
|
+
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
586
|
+
}
|
|
574
587
|
return textLines;
|
|
575
588
|
}
|
|
576
589
|
export default RectangleROITool;
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.
|
|
1
|
+
export declare const version = "3.18.0";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.
|
|
1
|
+
export const version = '3.18.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"types": "./dist/esm/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"canvas": "^3.1.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@cornerstonejs/core": "^3.
|
|
111
|
+
"@cornerstonejs/core": "^3.18.0",
|
|
112
112
|
"@kitware/vtk.js": "32.12.1",
|
|
113
113
|
"@types/d3-array": "^3.0.4",
|
|
114
114
|
"@types/d3-interpolate": "^3.0.1",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"type": "individual",
|
|
128
128
|
"url": "https://ohif.org/donate"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "409f2bb8fe3755f4451f884c85ddf29c7a03749c"
|
|
131
131
|
}
|