@cornerstonejs/adapters 3.0.0-beta.5 → 3.0.0-beta.6
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/adapters/Cornerstone/Angle.js +61 -74
- package/dist/esm/adapters/Cornerstone/ArrowAnnotate.js +76 -76
- package/dist/esm/adapters/Cornerstone/Bidirectional.js +130 -146
- package/dist/esm/adapters/Cornerstone/CircleRoi.js +96 -95
- package/dist/esm/adapters/Cornerstone/CobbAngle.js +66 -79
- package/dist/esm/adapters/Cornerstone/EllipticalRoi.js +152 -152
- package/dist/esm/adapters/Cornerstone/FreehandRoi.js +68 -69
- package/dist/esm/adapters/Cornerstone/Length.js +54 -63
- package/dist/esm/adapters/Cornerstone/MeasurementReport.js +221 -224
- package/dist/esm/adapters/Cornerstone/ParametricMap.js +88 -110
- package/dist/esm/adapters/Cornerstone/RectangleRoi.js +72 -78
- package/dist/esm/adapters/Cornerstone/Segmentation.js +7 -7
- package/dist/esm/adapters/Cornerstone/Segmentation_3X.js +113 -104
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +434 -462
- package/dist/esm/adapters/Cornerstone/index.js +14 -14
- package/dist/esm/adapters/Cornerstone3D/Angle.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/Angle.js +89 -100
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +5 -11
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +106 -118
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.d.ts +43 -0
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.js +92 -0
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +118 -133
- package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +2 -7
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +85 -85
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +93 -104
- package/dist/esm/adapters/Cornerstone3D/CodingScheme.js +5 -5
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.d.ts +2 -7
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +148 -149
- package/dist/esm/adapters/Cornerstone3D/KeyImage.d.ts +24 -0
- package/dist/esm/adapters/Cornerstone3D/KeyImage.js +49 -0
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +2 -10
- package/dist/esm/adapters/Cornerstone3D/Length.js +83 -93
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +23 -4
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +259 -240
- package/dist/esm/adapters/Cornerstone3D/ParametricMap/generateToolState.js +8 -4
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +3 -5
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +99 -115
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +4 -17
- package/dist/esm/adapters/Cornerstone3D/Probe.js +38 -79
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.js +60 -52
- package/dist/esm/adapters/Cornerstone3D/RTStruct/index.js +3 -1
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getPatientModule.js +5 -5
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedFrameOfReferenceSequence.js +14 -10
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedSeriesSequence.js +17 -11
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getStructureSetModule.js +3 -1
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +73 -85
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.js +15 -13
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.js +15 -9
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.js +10 -10
- package/dist/esm/adapters/Cornerstone3D/Segmentation/labelmapImagesFromBuffer.js +134 -151
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +68 -84
- package/dist/esm/adapters/Cornerstone3D/index.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/index.js +21 -17
- package/dist/esm/adapters/VTKjs/Segmentation.js +66 -72
- package/dist/esm/adapters/VTKjs/index.js +2 -2
- package/dist/esm/adapters/helpers/checkIfPerpendicular.js +2 -2
- package/dist/esm/adapters/helpers/checkOrientation.js +8 -8
- package/dist/esm/adapters/helpers/codeMeaningEquals.js +2 -2
- package/dist/esm/adapters/helpers/compareArrays.js +4 -2
- package/dist/esm/adapters/helpers/downloadDICOMData.js +6 -4
- package/dist/esm/adapters/helpers/getDatasetsFromImages.js +20 -18
- package/dist/esm/adapters/helpers/graphicTypeEquals.js +2 -2
- package/dist/esm/adapters/helpers/toArray.js +1 -3
- package/dist/esm/adapters/index.d.ts +2 -0
- package/dist/esm/adapters/index.js +6 -5
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/defineProperty.js +18 -0
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
- package/package.json +4 -4
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +0 -493
- package/dist/esm/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.js +0 -18
|
@@ -11,22 +11,22 @@ import RectangleRoi from './RectangleRoi.js';
|
|
|
11
11
|
import * as Segmentation from './Segmentation.js';
|
|
12
12
|
import ParametricMapObj from './ParametricMap.js';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
Length
|
|
16
|
-
FreehandRoi
|
|
17
|
-
Bidirectional
|
|
18
|
-
EllipticalRoi
|
|
19
|
-
CircleRoi
|
|
20
|
-
ArrowAnnotate
|
|
21
|
-
MeasurementReport
|
|
22
|
-
CobbAngle
|
|
23
|
-
Angle
|
|
24
|
-
RectangleRoi
|
|
14
|
+
const CornerstoneSR = {
|
|
15
|
+
Length,
|
|
16
|
+
FreehandRoi,
|
|
17
|
+
Bidirectional,
|
|
18
|
+
EllipticalRoi,
|
|
19
|
+
CircleRoi,
|
|
20
|
+
ArrowAnnotate,
|
|
21
|
+
MeasurementReport,
|
|
22
|
+
CobbAngle,
|
|
23
|
+
Angle,
|
|
24
|
+
RectangleRoi
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
Segmentation
|
|
26
|
+
const CornerstoneSEG = {
|
|
27
|
+
Segmentation
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
const CornerstonePMAP = {
|
|
30
30
|
ParametricMap: ParametricMapObj
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
static utilityToolType: string;
|
|
4
|
-
static TID300Representation: any;
|
|
5
|
-
static isValidCornerstoneTrackingIdentifier: (TrackingIdentifier: any) => boolean;
|
|
1
|
+
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
|
+
declare class Angle extends BaseAdapter3D {
|
|
6
3
|
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): {
|
|
7
4
|
description: any;
|
|
8
5
|
sopInstanceUid: any;
|
|
@@ -1,109 +1,98 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray, createClass as _createClass, defineProperty as _defineProperty, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { utilities } from 'dcmjs';
|
|
3
|
-
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
4
2
|
import MeasurementReport from './MeasurementReport.js';
|
|
3
|
+
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
5
4
|
|
|
6
5
|
var _Angle;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
27
|
-
worldCoords.push(point);
|
|
28
|
-
}
|
|
29
|
-
var state = defaultState;
|
|
30
|
-
state.annotation.data = {
|
|
31
|
-
handles: {
|
|
32
|
-
points: [worldCoords[0], worldCoords[1], worldCoords[3]],
|
|
33
|
-
activeHandleIndex: 0,
|
|
34
|
-
textBox: {
|
|
35
|
-
hasMoved: false
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
|
|
39
|
-
angle: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
|
|
40
|
-
}),
|
|
41
|
-
frameNumber: ReferencedFrameNumber
|
|
42
|
-
};
|
|
43
|
-
return state;
|
|
6
|
+
const {
|
|
7
|
+
CobbAngle: TID300CobbAngle
|
|
8
|
+
} = utilities.TID300;
|
|
9
|
+
class Angle extends BaseAdapter3D {
|
|
10
|
+
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
11
|
+
const {
|
|
12
|
+
defaultState,
|
|
13
|
+
NUMGroup,
|
|
14
|
+
SCOORDGroup,
|
|
15
|
+
ReferencedFrameNumber
|
|
16
|
+
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Angle.toolType);
|
|
17
|
+
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
18
|
+
const {
|
|
19
|
+
GraphicData
|
|
20
|
+
} = SCOORDGroup;
|
|
21
|
+
const worldCoords = [];
|
|
22
|
+
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
23
|
+
const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
24
|
+
worldCoords.push(point);
|
|
44
25
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var point1 = {
|
|
63
|
-
x: start1[0],
|
|
64
|
-
y: start1[1]
|
|
65
|
-
};
|
|
66
|
-
var point2 = {
|
|
67
|
-
x: middle[0],
|
|
68
|
-
y: middle[1]
|
|
69
|
-
};
|
|
70
|
-
var point3 = point2;
|
|
71
|
-
var point4 = {
|
|
72
|
-
x: end[0],
|
|
73
|
-
y: end[1]
|
|
74
|
-
};
|
|
75
|
-
var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
|
|
76
|
-
angle = _ref.angle;
|
|
77
|
-
return {
|
|
78
|
-
point1: point1,
|
|
79
|
-
point2: point2,
|
|
80
|
-
point3: point3,
|
|
81
|
-
point4: point4,
|
|
82
|
-
rAngle: angle,
|
|
83
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
84
|
-
finding: finding,
|
|
85
|
-
findingSites: findingSites || []
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}]);
|
|
89
|
-
}();
|
|
90
|
-
_Angle = Angle;
|
|
91
|
-
_Angle.toolType = MEASUREMENT_TYPE;
|
|
92
|
-
_Angle.utilityToolType = MEASUREMENT_TYPE;
|
|
93
|
-
_Angle.TID300Representation = TID300CobbAngle;
|
|
94
|
-
_Angle.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
95
|
-
if (!TrackingIdentifier.includes(":")) {
|
|
96
|
-
return false;
|
|
26
|
+
const state = defaultState;
|
|
27
|
+
state.annotation.data = {
|
|
28
|
+
handles: {
|
|
29
|
+
points: [worldCoords[0], worldCoords[1], worldCoords[3]],
|
|
30
|
+
activeHandleIndex: 0,
|
|
31
|
+
textBox: {
|
|
32
|
+
hasMoved: false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
cachedStats: {
|
|
36
|
+
["imageId:".concat(referencedImageId)]: {
|
|
37
|
+
angle: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
frameNumber: ReferencedFrameNumber
|
|
41
|
+
};
|
|
42
|
+
return state;
|
|
97
43
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
44
|
+
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
45
|
+
const {
|
|
46
|
+
data,
|
|
47
|
+
finding,
|
|
48
|
+
findingSites,
|
|
49
|
+
metadata
|
|
50
|
+
} = tool;
|
|
51
|
+
const {
|
|
52
|
+
cachedStats = {},
|
|
53
|
+
handles
|
|
54
|
+
} = data;
|
|
55
|
+
const {
|
|
56
|
+
referencedImageId
|
|
57
|
+
} = metadata;
|
|
58
|
+
if (!referencedImageId) {
|
|
59
|
+
throw new Error("Angle.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
60
|
+
}
|
|
61
|
+
const start1 = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
62
|
+
const middle = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
63
|
+
const end = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
64
|
+
const point1 = {
|
|
65
|
+
x: start1[0],
|
|
66
|
+
y: start1[1]
|
|
67
|
+
};
|
|
68
|
+
const point2 = {
|
|
69
|
+
x: middle[0],
|
|
70
|
+
y: middle[1]
|
|
71
|
+
};
|
|
72
|
+
const point3 = point2;
|
|
73
|
+
const point4 = {
|
|
74
|
+
x: end[0],
|
|
75
|
+
y: end[1]
|
|
76
|
+
};
|
|
77
|
+
const {
|
|
78
|
+
angle
|
|
79
|
+
} = cachedStats["imageId:".concat(referencedImageId)] || {};
|
|
80
|
+
return {
|
|
81
|
+
point1,
|
|
82
|
+
point2,
|
|
83
|
+
point3,
|
|
84
|
+
point4,
|
|
85
|
+
rAngle: angle,
|
|
86
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
87
|
+
finding,
|
|
88
|
+
findingSites: findingSites || []
|
|
89
|
+
};
|
|
104
90
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
91
|
+
}
|
|
92
|
+
_Angle = Angle;
|
|
93
|
+
(() => {
|
|
94
|
+
_Angle.init("Angle", TID300CobbAngle);
|
|
95
|
+
_Angle.registerLegacy();
|
|
96
|
+
})();
|
|
108
97
|
|
|
109
98
|
export { Angle as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
declare class ArrowAnnotate {
|
|
3
|
-
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): {
|
|
1
|
+
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
|
+
declare class ArrowAnnotate extends BaseAdapter3D {
|
|
3
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any, _trackingIdentifier: any): {
|
|
4
4
|
description: any;
|
|
5
5
|
sopInstanceUid: any;
|
|
6
6
|
annotation: {
|
|
@@ -23,13 +23,7 @@ declare class ArrowAnnotate {
|
|
|
23
23
|
}[];
|
|
24
24
|
trackingIdentifierTextValue: string;
|
|
25
25
|
findingSites: any;
|
|
26
|
+
finding: any;
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
export { ARROW_ANNOTATE as toolType };
|
|
30
|
-
export { ARROW_ANNOTATE as utilityToolType };
|
|
31
|
-
export { TID300Point as TID300Representation };
|
|
32
|
-
export function isValidCornerstoneTrackingIdentifier(TrackingIdentifier: any): boolean;
|
|
33
|
-
}
|
|
34
|
-
declare const ARROW_ANNOTATE: "ArrowAnnotate";
|
|
35
|
-
declare const TID300Point: any;
|
|
29
|
+
export default ArrowAnnotate;
|
|
@@ -1,130 +1,118 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray, createClass as _createClass, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import MeasurementReport from './MeasurementReport.js';
|
|
3
2
|
import { utilities } from 'dcmjs';
|
|
4
|
-
import
|
|
3
|
+
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
5
4
|
import CodingScheme from './CodingScheme.js';
|
|
6
5
|
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
var _ArrowAnnotate;
|
|
7
|
+
const {
|
|
8
|
+
Point: TID300Point
|
|
9
|
+
} = utilities.TID300;
|
|
10
|
+
const {
|
|
11
|
+
codeValues
|
|
12
|
+
} = CodingScheme;
|
|
13
|
+
class ArrowAnnotate extends BaseAdapter3D {
|
|
14
|
+
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, _trackingIdentifier) {
|
|
15
|
+
const {
|
|
16
|
+
defaultState,
|
|
17
|
+
SCOORDGroup,
|
|
18
|
+
ReferencedFrameNumber
|
|
19
|
+
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, ArrowAnnotate.toolType);
|
|
20
|
+
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
21
|
+
const text = defaultState.annotation.metadata.label;
|
|
22
|
+
const {
|
|
23
|
+
GraphicData
|
|
24
|
+
} = SCOORDGroup;
|
|
25
|
+
const worldCoords = [];
|
|
26
|
+
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
27
|
+
const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
28
|
+
worldCoords.push(point);
|
|
29
|
+
}
|
|
30
|
+
if (worldCoords.length === 1) {
|
|
31
|
+
const imagePixelModule = metadata.get("imagePixelModule", referencedImageId);
|
|
32
|
+
let xOffset = 10;
|
|
33
|
+
let yOffset = 10;
|
|
34
|
+
if (imagePixelModule) {
|
|
35
|
+
const {
|
|
36
|
+
columns,
|
|
37
|
+
rows
|
|
38
|
+
} = imagePixelModule;
|
|
39
|
+
xOffset = columns / 10;
|
|
40
|
+
yOffset = rows / 10;
|
|
30
41
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const secondPoint = imageToWorldCoords(referencedImageId, [GraphicData[0] + xOffset, GraphicData[1] + yOffset]);
|
|
43
|
+
worldCoords.push(secondPoint);
|
|
44
|
+
}
|
|
45
|
+
const state = defaultState;
|
|
46
|
+
state.annotation.data = {
|
|
47
|
+
text,
|
|
48
|
+
handles: {
|
|
49
|
+
arrowFirst: true,
|
|
50
|
+
points: [worldCoords[0], worldCoords[1]],
|
|
51
|
+
activeHandleIndex: 0,
|
|
52
|
+
textBox: {
|
|
53
|
+
hasMoved: false
|
|
43
54
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
},
|
|
56
|
+
frameNumber: ReferencedFrameNumber
|
|
57
|
+
};
|
|
58
|
+
return state;
|
|
59
|
+
}
|
|
60
|
+
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
61
|
+
const {
|
|
62
|
+
data,
|
|
63
|
+
metadata,
|
|
64
|
+
findingSites
|
|
65
|
+
} = tool;
|
|
66
|
+
let {
|
|
67
|
+
finding
|
|
68
|
+
} = tool;
|
|
69
|
+
const {
|
|
70
|
+
referencedImageId
|
|
71
|
+
} = metadata;
|
|
72
|
+
if (!referencedImageId) {
|
|
73
|
+
throw new Error("ArrowAnnotate.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
61
74
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}],
|
|
95
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
96
|
-
findingSites: findingSites || []
|
|
75
|
+
const {
|
|
76
|
+
points,
|
|
77
|
+
arrowFirst
|
|
78
|
+
} = data.handles;
|
|
79
|
+
let point;
|
|
80
|
+
let point2;
|
|
81
|
+
if (arrowFirst) {
|
|
82
|
+
point = points[0];
|
|
83
|
+
point2 = points[1];
|
|
84
|
+
} else {
|
|
85
|
+
point = points[1];
|
|
86
|
+
point2 = points[0];
|
|
87
|
+
}
|
|
88
|
+
const pointImage = worldToImageCoords(referencedImageId, point);
|
|
89
|
+
const pointImage2 = worldToImageCoords(referencedImageId, point2);
|
|
90
|
+
const TID300RepresentationArguments = {
|
|
91
|
+
points: [{
|
|
92
|
+
x: pointImage[0],
|
|
93
|
+
y: pointImage[1]
|
|
94
|
+
}, {
|
|
95
|
+
x: pointImage2[0],
|
|
96
|
+
y: pointImage2[1]
|
|
97
|
+
}],
|
|
98
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
99
|
+
findingSites: findingSites || [],
|
|
100
|
+
finding
|
|
101
|
+
};
|
|
102
|
+
if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
|
|
103
|
+
finding = {
|
|
104
|
+
CodeValue: codeValues.CORNERSTONEFREETEXT,
|
|
105
|
+
CodingSchemeDesignator: CodingScheme.CodingSchemeDesignator,
|
|
106
|
+
CodeMeaning: data.text
|
|
97
107
|
};
|
|
98
|
-
|
|
99
|
-
// If freetext finding isn't present, add it from the tool text.
|
|
100
|
-
if (!finding || finding.CodeValue !== codeValues.CORNERSTONEFREETEXT) {
|
|
101
|
-
finding = {
|
|
102
|
-
CodeValue: codeValues.CORNERSTONEFREETEXT,
|
|
103
|
-
CodingSchemeDesignator: CodingSchemeDesignator,
|
|
104
|
-
CodeMeaning: data.text
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
TID300RepresentationArguments.finding = finding;
|
|
108
|
-
return TID300RepresentationArguments;
|
|
109
108
|
}
|
|
110
|
-
|
|
111
|
-
}();
|
|
112
|
-
ArrowAnnotate.toolType = ARROW_ANNOTATE;
|
|
113
|
-
ArrowAnnotate.utilityToolType = ARROW_ANNOTATE;
|
|
114
|
-
ArrowAnnotate.TID300Representation = TID300Point;
|
|
115
|
-
ArrowAnnotate.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
116
|
-
if (!TrackingIdentifier.includes(":")) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
var _TrackingIdentifier$s = TrackingIdentifier.split(":"),
|
|
120
|
-
_TrackingIdentifier$s2 = _slicedToArray(_TrackingIdentifier$s, 2),
|
|
121
|
-
cornerstone3DTag = _TrackingIdentifier$s2[0],
|
|
122
|
-
toolType = _TrackingIdentifier$s2[1];
|
|
123
|
-
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
124
|
-
return false;
|
|
109
|
+
return TID300RepresentationArguments;
|
|
125
110
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
111
|
+
}
|
|
112
|
+
_ArrowAnnotate = ArrowAnnotate;
|
|
113
|
+
(() => {
|
|
114
|
+
_ArrowAnnotate.init("ArrowAnnotate", TID300Point);
|
|
115
|
+
_ArrowAnnotate.registerLegacy();
|
|
116
|
+
})();
|
|
129
117
|
|
|
130
118
|
export { ArrowAnnotate as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type AdapterOptions, type MeasurementAdapter } from "./MeasurementReport";
|
|
2
|
+
export type Point = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z?: number;
|
|
6
|
+
};
|
|
7
|
+
export type TID300Arguments = {
|
|
8
|
+
points?: Point[];
|
|
9
|
+
point1?: Point;
|
|
10
|
+
point2?: Point;
|
|
11
|
+
trackingIdentifierTextValue: string;
|
|
12
|
+
findingSites: [];
|
|
13
|
+
finding: any;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
export default class BaseAdapter3D {
|
|
17
|
+
static toolType: string;
|
|
18
|
+
static TID300Representation: any;
|
|
19
|
+
static trackingIdentifierTextValue: string;
|
|
20
|
+
static trackingIdentifiers: Set<string>;
|
|
21
|
+
static parentType: string;
|
|
22
|
+
static init(toolType: string, representation: any, options?: AdapterOptions): void;
|
|
23
|
+
static registerLegacy(): void;
|
|
24
|
+
static registerSubType(adapter: MeasurementAdapter, toolType: string, replace?: any): any;
|
|
25
|
+
static isValidCornerstoneTrackingIdentifier(trackingIdentifier: string): boolean;
|
|
26
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, _imageToWorldCoords: any, metadata: any, trackingIdentifier?: string): {
|
|
27
|
+
description: any;
|
|
28
|
+
sopInstanceUid: any;
|
|
29
|
+
annotation: {
|
|
30
|
+
annotationUID: any;
|
|
31
|
+
metadata: {
|
|
32
|
+
toolName: any;
|
|
33
|
+
referencedImageId: any;
|
|
34
|
+
FrameOfReferenceUID: any;
|
|
35
|
+
label: string;
|
|
36
|
+
};
|
|
37
|
+
data: any;
|
|
38
|
+
};
|
|
39
|
+
finding: any;
|
|
40
|
+
findingSites: any[];
|
|
41
|
+
};
|
|
42
|
+
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): TID300Arguments;
|
|
43
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
2
|
+
import MeasurementReport from './MeasurementReport.js';
|
|
3
|
+
|
|
4
|
+
class BaseAdapter3D {
|
|
5
|
+
static init(toolType, representation, options) {
|
|
6
|
+
this.toolType = toolType;
|
|
7
|
+
if (BaseAdapter3D.toolType) {
|
|
8
|
+
throw new Error("Base adapter tool type set to ".concat(this.toolType, " while setting ").concat(toolType));
|
|
9
|
+
}
|
|
10
|
+
this.parentType = options === null || options === void 0 ? void 0 : options.parentType;
|
|
11
|
+
this.trackingIdentifiers = new Set();
|
|
12
|
+
this.TID300Representation = representation;
|
|
13
|
+
if (this.parentType) {
|
|
14
|
+
this.trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(this.parentType, ":").concat(this.toolType);
|
|
15
|
+
const alternateTrackingIdentifier = "".concat(CORNERSTONE_3D_TAG, ":").concat(this.toolType);
|
|
16
|
+
this.trackingIdentifiers.add(alternateTrackingIdentifier);
|
|
17
|
+
} else {
|
|
18
|
+
this.trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(toolType);
|
|
19
|
+
}
|
|
20
|
+
this.trackingIdentifiers.add(this.trackingIdentifierTextValue);
|
|
21
|
+
MeasurementReport.registerTool(this);
|
|
22
|
+
}
|
|
23
|
+
static registerLegacy() {
|
|
24
|
+
this.trackingIdentifiers.add("cornerstoneTools@^4.0.0:".concat(this.toolType));
|
|
25
|
+
}
|
|
26
|
+
static registerSubType(adapter, toolType, replace) {
|
|
27
|
+
const subAdapter = Object.create(adapter);
|
|
28
|
+
subAdapter.init(toolType, adapter.TID300Representation, {
|
|
29
|
+
parentType: adapter.parentType || adapter.toolType,
|
|
30
|
+
replace
|
|
31
|
+
});
|
|
32
|
+
return subAdapter;
|
|
33
|
+
}
|
|
34
|
+
static isValidCornerstoneTrackingIdentifier(trackingIdentifier) {
|
|
35
|
+
if (this.trackingIdentifiers.has(trackingIdentifier)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (!trackingIdentifier.includes(":")) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return trackingIdentifier.startsWith(this.trackingIdentifierTextValue);
|
|
42
|
+
}
|
|
43
|
+
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, _imageToWorldCoords, metadata, trackingIdentifier) {
|
|
44
|
+
const {
|
|
45
|
+
defaultState: state,
|
|
46
|
+
ReferencedFrameNumber
|
|
47
|
+
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
|
|
48
|
+
state.annotation.data = {
|
|
49
|
+
cachedStats: {},
|
|
50
|
+
frameNumber: ReferencedFrameNumber,
|
|
51
|
+
seriesLevel: (trackingIdentifier === null || trackingIdentifier === void 0 ? void 0 : trackingIdentifier.indexOf(":Series")) > 0
|
|
52
|
+
};
|
|
53
|
+
return state;
|
|
54
|
+
}
|
|
55
|
+
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
56
|
+
const {
|
|
57
|
+
data,
|
|
58
|
+
metadata
|
|
59
|
+
} = tool;
|
|
60
|
+
const {
|
|
61
|
+
finding,
|
|
62
|
+
findingSites
|
|
63
|
+
} = tool;
|
|
64
|
+
const {
|
|
65
|
+
referencedImageId
|
|
66
|
+
} = metadata;
|
|
67
|
+
if (!referencedImageId) {
|
|
68
|
+
throw new Error("Probe.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
69
|
+
}
|
|
70
|
+
const {
|
|
71
|
+
handles: {
|
|
72
|
+
points = []
|
|
73
|
+
}
|
|
74
|
+
} = data;
|
|
75
|
+
const pointsImage = points.map(point => {
|
|
76
|
+
const pointImage = worldToImageCoords(referencedImageId, point);
|
|
77
|
+
return {
|
|
78
|
+
x: pointImage[0],
|
|
79
|
+
y: pointImage[1]
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
const tidArguments = {
|
|
83
|
+
points: pointsImage,
|
|
84
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
85
|
+
findingSites: findingSites || [],
|
|
86
|
+
finding
|
|
87
|
+
};
|
|
88
|
+
return tidArguments;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { BaseAdapter3D as default };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
static utilityToolType: string;
|
|
4
|
-
static TID300Representation: any;
|
|
5
|
-
static isValidCornerstoneTrackingIdentifier: (TrackingIdentifier: any) => boolean;
|
|
1
|
+
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
|
+
declare class Bidirectional extends BaseAdapter3D {
|
|
6
3
|
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): {
|
|
7
4
|
description: any;
|
|
8
5
|
sopInstanceUid: any;
|