@cornerstonejs/tools 0.61.2 → 0.61.4
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/cjs/tools/annotation/CircleROITool.d.ts +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +4 -3
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js +2 -1
- package/dist/cjs/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.d.ts +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +4 -3
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.d.ts +1 -1
- package/dist/cjs/tools/annotation/ProbeTool.js +6 -4
- package/dist/cjs/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.d.ts +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +4 -3
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.d.ts +1 -0
- package/dist/cjs/tools/base/AnnotationTool.js +15 -0
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/utilities/getModalityUnit.d.ts +1 -1
- package/dist/cjs/utilities/getModalityUnit.js +4 -2
- package/dist/cjs/utilities/getModalityUnit.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.d.ts +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js +4 -3
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/DragProbeTool.js +2 -1
- package/dist/esm/tools/annotation/DragProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.d.ts +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +4 -3
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/ProbeTool.d.ts +1 -1
- package/dist/esm/tools/annotation/ProbeTool.js +5 -4
- package/dist/esm/tools/annotation/ProbeTool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.d.ts +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +4 -3
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.d.ts +1 -0
- package/dist/esm/tools/base/AnnotationTool.js +15 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/utilities/getModalityUnit.d.ts +1 -1
- package/dist/esm/utilities/getModalityUnit.js +4 -2
- package/dist/esm/utilities/getModalityUnit.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/tools/annotation/CircleROITool.ts +19 -3
- package/src/tools/annotation/DragProbeTool.ts +12 -1
- package/src/tools/annotation/EllipticalROITool.ts +19 -3
- package/src/tools/annotation/ProbeTool.ts +16 -4
- package/src/tools/annotation/RectangleROITool.ts +15 -3
- package/src/tools/base/AnnotationTool.ts +32 -1
- package/src/utilities/getModalityUnit.ts +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.4",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cornerstonejs/core": "^0.
|
|
29
|
+
"@cornerstonejs/core": "^0.42.0",
|
|
30
30
|
"lodash.clonedeep": "4.5.0",
|
|
31
31
|
"lodash.get": "^4.4.2"
|
|
32
32
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "1ddefd3cf71aff541732dd6879dd282866e37217"
|
|
56
56
|
}
|
|
@@ -799,7 +799,18 @@ class CircleROITool extends AnnotationTool {
|
|
|
799
799
|
|
|
800
800
|
const isPreScaled = isViewportPreScaled(viewport, targetId);
|
|
801
801
|
|
|
802
|
-
const
|
|
802
|
+
const isSuvScaled = this.isSuvScaled(
|
|
803
|
+
viewport,
|
|
804
|
+
targetId,
|
|
805
|
+
annotation.metadata.referencedImageId
|
|
806
|
+
);
|
|
807
|
+
|
|
808
|
+
const textLines = this._getTextLines(
|
|
809
|
+
data,
|
|
810
|
+
targetId,
|
|
811
|
+
isPreScaled,
|
|
812
|
+
isSuvScaled
|
|
813
|
+
);
|
|
803
814
|
if (!textLines || textLines.length === 0) {
|
|
804
815
|
continue;
|
|
805
816
|
}
|
|
@@ -843,7 +854,12 @@ class CircleROITool extends AnnotationTool {
|
|
|
843
854
|
return renderStatus;
|
|
844
855
|
};
|
|
845
856
|
|
|
846
|
-
_getTextLines = (
|
|
857
|
+
_getTextLines = (
|
|
858
|
+
data,
|
|
859
|
+
targetId: string,
|
|
860
|
+
isPreScaled: boolean,
|
|
861
|
+
isSuvScaled: boolean
|
|
862
|
+
): string[] => {
|
|
847
863
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
848
864
|
const {
|
|
849
865
|
radius,
|
|
@@ -858,7 +874,7 @@ class CircleROITool extends AnnotationTool {
|
|
|
858
874
|
} = cachedVolumeStats;
|
|
859
875
|
|
|
860
876
|
const textLines: string[] = [];
|
|
861
|
-
const unit = getModalityUnit(Modality, isPreScaled);
|
|
877
|
+
const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
|
|
862
878
|
|
|
863
879
|
if (radius) {
|
|
864
880
|
const radiusLine = isEmptyArea
|
|
@@ -187,7 +187,18 @@ class DragProbeTool extends ProbeTool {
|
|
|
187
187
|
|
|
188
188
|
const isPreScaled = isViewportPreScaled(viewport, targetId);
|
|
189
189
|
|
|
190
|
-
const
|
|
190
|
+
const isSuvScaled = this.isSuvScaled(
|
|
191
|
+
viewport,
|
|
192
|
+
targetId,
|
|
193
|
+
annotation.metadata.referencedImageId
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
const textLines = this._getTextLines(
|
|
197
|
+
data,
|
|
198
|
+
targetId,
|
|
199
|
+
isPreScaled,
|
|
200
|
+
isSuvScaled
|
|
201
|
+
);
|
|
191
202
|
if (textLines) {
|
|
192
203
|
const textCanvasCoordinates = [
|
|
193
204
|
canvasCoordinates[0] + 6,
|
|
@@ -927,7 +927,18 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
927
927
|
|
|
928
928
|
const isPreScaled = isViewportPreScaled(viewport, targetId);
|
|
929
929
|
|
|
930
|
-
const
|
|
930
|
+
const isSuvScaled = this.isSuvScaled(
|
|
931
|
+
viewport,
|
|
932
|
+
targetId,
|
|
933
|
+
annotation.metadata.referencedImageId
|
|
934
|
+
);
|
|
935
|
+
|
|
936
|
+
const textLines = this._getTextLines(
|
|
937
|
+
data,
|
|
938
|
+
targetId,
|
|
939
|
+
isPreScaled,
|
|
940
|
+
isSuvScaled
|
|
941
|
+
);
|
|
931
942
|
if (!textLines || textLines.length === 0) {
|
|
932
943
|
continue;
|
|
933
944
|
}
|
|
@@ -971,13 +982,18 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
971
982
|
return renderStatus;
|
|
972
983
|
};
|
|
973
984
|
|
|
974
|
-
_getTextLines = (
|
|
985
|
+
_getTextLines = (
|
|
986
|
+
data,
|
|
987
|
+
targetId: string,
|
|
988
|
+
isPreScaled: boolean,
|
|
989
|
+
isSuvScaled: boolean
|
|
990
|
+
): string[] => {
|
|
975
991
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
976
992
|
const { area, mean, stdDev, max, isEmptyArea, Modality, areaUnit } =
|
|
977
993
|
cachedVolumeStats;
|
|
978
994
|
|
|
979
995
|
const textLines: string[] = [];
|
|
980
|
-
const unit = getModalityUnit(Modality, isPreScaled);
|
|
996
|
+
const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
|
|
981
997
|
|
|
982
998
|
if (area) {
|
|
983
999
|
const areaLine = isEmptyArea
|
|
@@ -504,7 +504,18 @@ class ProbeTool extends AnnotationTool {
|
|
|
504
504
|
|
|
505
505
|
const isPreScaled = isViewportPreScaled(viewport, targetId);
|
|
506
506
|
|
|
507
|
-
const
|
|
507
|
+
const isSuvScaled = this.isSuvScaled(
|
|
508
|
+
viewport,
|
|
509
|
+
targetId,
|
|
510
|
+
annotation.metadata.referencedImageId
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
const textLines = this._getTextLines(
|
|
514
|
+
data,
|
|
515
|
+
targetId,
|
|
516
|
+
isPreScaled,
|
|
517
|
+
isSuvScaled
|
|
518
|
+
);
|
|
508
519
|
if (textLines) {
|
|
509
520
|
const textCanvasCoordinates = [
|
|
510
521
|
canvasCoordinates[0] + 6,
|
|
@@ -529,7 +540,8 @@ class ProbeTool extends AnnotationTool {
|
|
|
529
540
|
_getTextLines(
|
|
530
541
|
data,
|
|
531
542
|
targetId: string,
|
|
532
|
-
isPreScaled: boolean
|
|
543
|
+
isPreScaled: boolean,
|
|
544
|
+
isSuvScaled: boolean
|
|
533
545
|
): string[] | undefined {
|
|
534
546
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
535
547
|
const { index, Modality, value, SUVBw, SUVLbm, SUVBsa } = cachedVolumeStats;
|
|
@@ -539,7 +551,7 @@ class ProbeTool extends AnnotationTool {
|
|
|
539
551
|
}
|
|
540
552
|
|
|
541
553
|
const textLines = [];
|
|
542
|
-
const unit = getModalityUnit(Modality, isPreScaled);
|
|
554
|
+
const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
|
|
543
555
|
|
|
544
556
|
textLines.push(`(${index[0]}, ${index[1]}, ${index[2]})`);
|
|
545
557
|
|
|
@@ -567,7 +579,7 @@ class ProbeTool extends AnnotationTool {
|
|
|
567
579
|
// Check if we have scaling for the other 2 SUV types for the PET.
|
|
568
580
|
if (
|
|
569
581
|
modality === 'PT' &&
|
|
570
|
-
imageVolume.scaling
|
|
582
|
+
imageVolume.scaling?.PET &&
|
|
571
583
|
(imageVolume.scaling.PET.suvbwToSuvbsa ||
|
|
572
584
|
imageVolume.scaling.PET.suvbwToSuvlbm)
|
|
573
585
|
) {
|
|
@@ -771,7 +771,18 @@ class RectangleROITool extends AnnotationTool {
|
|
|
771
771
|
|
|
772
772
|
const isPreScaled = isViewportPreScaled(viewport, targetId);
|
|
773
773
|
|
|
774
|
-
const
|
|
774
|
+
const isSuvScaled = this.isSuvScaled(
|
|
775
|
+
viewport,
|
|
776
|
+
targetId,
|
|
777
|
+
annotation.metadata.referencedImageId
|
|
778
|
+
);
|
|
779
|
+
|
|
780
|
+
const textLines = this._getTextLines(
|
|
781
|
+
data,
|
|
782
|
+
targetId,
|
|
783
|
+
isPreScaled,
|
|
784
|
+
isSuvScaled
|
|
785
|
+
);
|
|
775
786
|
if (!textLines || textLines.length === 0) {
|
|
776
787
|
continue;
|
|
777
788
|
}
|
|
@@ -841,7 +852,8 @@ class RectangleROITool extends AnnotationTool {
|
|
|
841
852
|
_getTextLines = (
|
|
842
853
|
data,
|
|
843
854
|
targetId: string,
|
|
844
|
-
isPreScaled: boolean
|
|
855
|
+
isPreScaled: boolean,
|
|
856
|
+
isSuvScaled: boolean
|
|
845
857
|
): string[] | undefined => {
|
|
846
858
|
const cachedVolumeStats = data.cachedStats[targetId];
|
|
847
859
|
const { area, mean, max, stdDev, Modality, areaUnit } = cachedVolumeStats;
|
|
@@ -851,7 +863,7 @@ class RectangleROITool extends AnnotationTool {
|
|
|
851
863
|
}
|
|
852
864
|
|
|
853
865
|
const textLines: string[] = [];
|
|
854
|
-
const unit = getModalityUnit(Modality, isPreScaled);
|
|
866
|
+
const unit = getModalityUnit(Modality, isPreScaled, isSuvScaled);
|
|
855
867
|
|
|
856
868
|
textLines.push(`Area: ${area.toFixed(2)} ${areaUnit}\xb2`);
|
|
857
869
|
textLines.push(`Mean: ${mean.toFixed(2)} ${unit}`);
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BaseVolumeViewport,
|
|
3
|
+
StackViewport,
|
|
4
|
+
cache,
|
|
5
|
+
getEnabledElement,
|
|
6
|
+
metaData,
|
|
7
|
+
} from '@cornerstonejs/core';
|
|
2
8
|
import type { Types } from '@cornerstonejs/core';
|
|
3
9
|
|
|
4
10
|
import { vec2 } from 'gl-matrix';
|
|
@@ -260,6 +266,31 @@ abstract class AnnotationTool extends AnnotationDisplayTool {
|
|
|
260
266
|
};
|
|
261
267
|
}
|
|
262
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Returns true if the viewport is scaled to SUV units
|
|
271
|
+
* @param viewport - The viewport
|
|
272
|
+
* @param targetId - The annotation targetId
|
|
273
|
+
* @param imageId - The annotation imageId
|
|
274
|
+
* @returns
|
|
275
|
+
*/
|
|
276
|
+
isSuvScaled(
|
|
277
|
+
viewport: Types.IStackViewport | Types.IVolumeViewport,
|
|
278
|
+
targetId: string,
|
|
279
|
+
imageId?: string
|
|
280
|
+
): boolean {
|
|
281
|
+
if (viewport instanceof BaseVolumeViewport) {
|
|
282
|
+
const volumeId = targetId.split('volumeId:')[1];
|
|
283
|
+
const volume = cache.getVolume(volumeId);
|
|
284
|
+
return volume.scaling?.PET !== undefined;
|
|
285
|
+
} else if (viewport instanceof StackViewport) {
|
|
286
|
+
const scalingModule: Types.ScalingParameters | undefined =
|
|
287
|
+
imageId && metaData.get('scalingModule', imageId);
|
|
288
|
+
return typeof scalingModule?.suvbw === 'number';
|
|
289
|
+
} else {
|
|
290
|
+
throw new Error('Viewport is not a valid type');
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
263
294
|
/**
|
|
264
295
|
* Returns true if the `canvasCoords` are near a handle or selectable part of the tool
|
|
265
296
|
*
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
function getModalityUnit(
|
|
1
|
+
function getModalityUnit(
|
|
2
|
+
modality: string,
|
|
3
|
+
isPreScaled: boolean,
|
|
4
|
+
isSuvScaled: boolean
|
|
5
|
+
): string {
|
|
2
6
|
if (modality === 'CT') {
|
|
3
7
|
return 'HU';
|
|
4
|
-
} else if (
|
|
8
|
+
} else if (
|
|
9
|
+
modality === 'PT' &&
|
|
10
|
+
isPreScaled === true &&
|
|
11
|
+
isSuvScaled === true
|
|
12
|
+
) {
|
|
5
13
|
return 'SUV';
|
|
6
14
|
} else {
|
|
7
15
|
return '';
|