@cornerstonejs/tools 3.16.5 → 3.17.1
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 +19 -12
- package/dist/esm/tools/annotation/EllipticalROITool.js +18 -11
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +46 -38
- package/dist/esm/tools/annotation/RectangleROITool.js +25 -10
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -533,18 +533,22 @@ 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,
|
|
545
548
|
area,
|
|
546
549
|
mean: stats.mean?.value,
|
|
547
550
|
max: stats.max?.value,
|
|
551
|
+
min: stats.min?.value,
|
|
548
552
|
pointsInShape,
|
|
549
553
|
stdDev: stats.stdDev?.value,
|
|
550
554
|
statsArray: stats.array,
|
|
@@ -621,27 +625,30 @@ class CircleROITool extends AnnotationTool {
|
|
|
621
625
|
}
|
|
622
626
|
function defaultGetTextLines(data, targetId) {
|
|
623
627
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
624
|
-
const { radius, radiusUnit, area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
|
|
628
|
+
const { radius, radiusUnit, area, mean, stdDev, max, min, isEmptyArea, areaUnit, modalityUnit, } = cachedVolumeStats;
|
|
625
629
|
const textLines = [];
|
|
626
|
-
if (radius) {
|
|
630
|
+
if (csUtils.isNumber(radius)) {
|
|
627
631
|
const radiusLine = isEmptyArea
|
|
628
632
|
? `Radius: Oblique not supported`
|
|
629
633
|
: `Radius: ${csUtils.roundNumber(radius)} ${radiusUnit}`;
|
|
630
634
|
textLines.push(radiusLine);
|
|
631
635
|
}
|
|
632
|
-
if (area) {
|
|
636
|
+
if (csUtils.isNumber(area)) {
|
|
633
637
|
const areaLine = isEmptyArea
|
|
634
638
|
? `Area: Oblique not supported`
|
|
635
639
|
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
636
640
|
textLines.push(areaLine);
|
|
637
641
|
}
|
|
638
|
-
if (mean) {
|
|
642
|
+
if (csUtils.isNumber(mean)) {
|
|
639
643
|
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
640
644
|
}
|
|
641
|
-
if (max) {
|
|
645
|
+
if (csUtils.isNumber(max)) {
|
|
642
646
|
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
643
647
|
}
|
|
644
|
-
if (
|
|
648
|
+
if (csUtils.isNumber(min)) {
|
|
649
|
+
textLines.push(`Min: ${csUtils.roundNumber(min)} ${modalityUnit}`);
|
|
650
|
+
}
|
|
651
|
+
if (csUtils.isNumber(stdDev)) {
|
|
645
652
|
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
646
653
|
}
|
|
647
654
|
return textLines;
|
|
@@ -609,18 +609,22 @@ 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,
|
|
621
624
|
area,
|
|
622
625
|
mean: stats.mean?.value,
|
|
623
626
|
max: stats.max?.value,
|
|
627
|
+
min: stats.min?.value,
|
|
624
628
|
stdDev: stats.stdDev?.value,
|
|
625
629
|
statsArray: stats.array,
|
|
626
630
|
pointsInShape,
|
|
@@ -699,21 +703,24 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
699
703
|
}
|
|
700
704
|
function defaultGetTextLines(data, targetId) {
|
|
701
705
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
702
|
-
const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit } = cachedVolumeStats;
|
|
706
|
+
const { area, mean, stdDev, max, isEmptyArea, areaUnit, modalityUnit, min } = cachedVolumeStats;
|
|
703
707
|
const textLines = [];
|
|
704
|
-
if (area) {
|
|
708
|
+
if (csUtils.isNumber(area)) {
|
|
705
709
|
const areaLine = isEmptyArea
|
|
706
710
|
? `Area: Oblique not supported`
|
|
707
711
|
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
708
712
|
textLines.push(areaLine);
|
|
709
713
|
}
|
|
710
|
-
if (mean) {
|
|
714
|
+
if (csUtils.isNumber(mean)) {
|
|
711
715
|
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
712
716
|
}
|
|
713
|
-
if (max) {
|
|
717
|
+
if (csUtils.isNumber(max)) {
|
|
714
718
|
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
715
719
|
}
|
|
716
|
-
if (
|
|
720
|
+
if (csUtils.isNumber(min)) {
|
|
721
|
+
textLines.push(`Min: ${csUtils.roundNumber(min)} ${modalityUnit}`);
|
|
722
|
+
}
|
|
723
|
+
if (csUtils.isNumber(stdDev)) {
|
|
717
724
|
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
718
725
|
}
|
|
719
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,
|
|
@@ -509,6 +513,7 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
509
513
|
perimeter: calculatePerimeter(canvasCoordinates, closed) / scale,
|
|
510
514
|
mean: stats.mean?.value,
|
|
511
515
|
max: stats.max?.value,
|
|
516
|
+
min: stats.min?.value,
|
|
512
517
|
stdDev: stats.stdDev?.value,
|
|
513
518
|
statsArray: stats.array,
|
|
514
519
|
pointsInShape: pointsInShape,
|
|
@@ -529,27 +534,30 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
529
534
|
}
|
|
530
535
|
function defaultGetTextLines(data, targetId) {
|
|
531
536
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
532
|
-
const { area, mean, stdDev, length, perimeter, max, isEmptyArea, unit, areaUnit, modalityUnit, } = cachedVolumeStats || {};
|
|
537
|
+
const { area, mean, stdDev, length, perimeter, max, min, isEmptyArea, unit, areaUnit, modalityUnit, } = cachedVolumeStats || {};
|
|
533
538
|
const textLines = [];
|
|
534
|
-
if (area) {
|
|
539
|
+
if (csUtils.isNumber(area)) {
|
|
535
540
|
const areaLine = isEmptyArea
|
|
536
541
|
? `Area: Oblique not supported`
|
|
537
542
|
: `Area: ${csUtils.roundNumber(area)} ${areaUnit}`;
|
|
538
543
|
textLines.push(areaLine);
|
|
539
544
|
}
|
|
540
|
-
if (mean) {
|
|
545
|
+
if (csUtils.isNumber(mean)) {
|
|
541
546
|
textLines.push(`Mean: ${csUtils.roundNumber(mean)} ${modalityUnit}`);
|
|
542
547
|
}
|
|
543
|
-
if (
|
|
548
|
+
if (csUtils.isNumber(max)) {
|
|
544
549
|
textLines.push(`Max: ${csUtils.roundNumber(max)} ${modalityUnit}`);
|
|
545
550
|
}
|
|
546
|
-
if (
|
|
551
|
+
if (csUtils.isNumber(min)) {
|
|
552
|
+
textLines.push(`Min: ${csUtils.roundNumber(min)} ${modalityUnit}`);
|
|
553
|
+
}
|
|
554
|
+
if (csUtils.isNumber(stdDev)) {
|
|
547
555
|
textLines.push(`Std Dev: ${csUtils.roundNumber(stdDev)} ${modalityUnit}`);
|
|
548
556
|
}
|
|
549
|
-
if (perimeter) {
|
|
557
|
+
if (csUtils.isNumber(perimeter)) {
|
|
550
558
|
textLines.push(`Perimeter: ${csUtils.roundNumber(perimeter)} ${unit}`);
|
|
551
559
|
}
|
|
552
|
-
if (length) {
|
|
560
|
+
if (csUtils.isNumber(length)) {
|
|
553
561
|
textLines.push(`${csUtils.roundNumber(length)} ${unit}`);
|
|
554
562
|
}
|
|
555
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,
|
|
@@ -498,6 +501,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
498
501
|
mean: stats.mean?.value,
|
|
499
502
|
stdDev: stats.stdDev?.value,
|
|
500
503
|
max: stats.max?.value,
|
|
504
|
+
min: stats.min?.value,
|
|
501
505
|
statsArray: stats.array,
|
|
502
506
|
pointsInShape: pointsInShape,
|
|
503
507
|
areaUnit,
|
|
@@ -560,15 +564,26 @@ class RectangleROITool extends AnnotationTool {
|
|
|
560
564
|
}
|
|
561
565
|
function defaultGetTextLines(data, targetId) {
|
|
562
566
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
563
|
-
const { area, mean, max, stdDev, areaUnit, modalityUnit } = cachedVolumeStats;
|
|
567
|
+
const { area, mean, max, stdDev, areaUnit, modalityUnit, min } = cachedVolumeStats;
|
|
564
568
|
if (mean === undefined || mean === null) {
|
|
565
569
|
return;
|
|
566
570
|
}
|
|
567
571
|
const textLines = [];
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
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
|
+
}
|
|
572
587
|
return textLines;
|
|
573
588
|
}
|
|
574
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.17.1";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.
|
|
1
|
+
export const version = '3.17.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.1",
|
|
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.17.1",
|
|
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": "6d5e8d3352bc78d14d058149efe7324de61ea41b"
|
|
131
131
|
}
|