@cornerstonejs/adapters 2.0.0-beta.2 → 2.0.0-beta.21
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/_virtual/_rollupPluginBabelHelpers.js +493 -0
- package/dist/esm/adapters/Cornerstone/Angle.d.ts +45 -0
- package/dist/esm/adapters/Cornerstone/Angle.js +93 -0
- package/dist/esm/adapters/Cornerstone/ArrowAnnotate.d.ts +49 -0
- package/dist/esm/adapters/Cornerstone/ArrowAnnotate.js +97 -0
- package/dist/esm/adapters/Cornerstone/Bidirectional.d.ts +89 -0
- package/dist/esm/adapters/Cornerstone/Bidirectional.js +170 -0
- package/dist/esm/adapters/Cornerstone/CircleRoi.d.ts +65 -0
- package/dist/esm/adapters/Cornerstone/CircleRoi.js +115 -0
- package/dist/esm/adapters/Cornerstone/CobbAngle.d.ts +49 -0
- package/dist/esm/adapters/Cornerstone/CobbAngle.js +98 -0
- package/dist/esm/adapters/Cornerstone/EllipticalRoi.d.ts +57 -0
- package/dist/esm/adapters/Cornerstone/EllipticalRoi.js +178 -0
- package/dist/esm/adapters/Cornerstone/FreehandRoi.d.ts +42 -0
- package/dist/esm/adapters/Cornerstone/FreehandRoi.js +89 -0
- package/dist/esm/adapters/Cornerstone/Length.d.ts +39 -0
- package/dist/esm/adapters/Cornerstone/Length.js +82 -0
- package/dist/esm/adapters/Cornerstone/MeasurementReport.d.ts +36 -0
- package/dist/esm/adapters/Cornerstone/MeasurementReport.js +276 -0
- package/dist/esm/adapters/Cornerstone/RectangleRoi.d.ts +44 -0
- package/dist/esm/adapters/Cornerstone/RectangleRoi.js +97 -0
- package/dist/esm/adapters/Cornerstone/Segmentation.d.ts +44 -0
- package/dist/esm/adapters/Cornerstone/Segmentation.js +79 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_3X.d.ts +45 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_3X.js +428 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.d.ts +54 -0
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +1200 -0
- package/dist/esm/adapters/Cornerstone/cornerstone4Tag.d.ts +2 -0
- package/dist/esm/adapters/Cornerstone/cornerstone4Tag.js +3 -0
- package/dist/esm/adapters/Cornerstone/index.d.ts +34 -0
- package/dist/esm/adapters/Cornerstone/index.js +29 -0
- package/dist/esm/adapters/Cornerstone3D/Angle.js +110 -0
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +35 -0
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +123 -0
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +146 -0
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +103 -0
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +113 -0
- package/dist/esm/adapters/Cornerstone3D/CodingScheme.d.ts +9 -0
- package/dist/esm/adapters/Cornerstone3D/CodingScheme.js +15 -0
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +170 -0
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +41 -0
- package/dist/esm/adapters/Cornerstone3D/Length.js +101 -0
- package/dist/{types → esm}/adapters/Cornerstone3D/MeasurementReport.d.ts +1 -1
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +314 -0
- package/dist/{types → esm}/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +9 -2
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +129 -0
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +33 -0
- package/dist/esm/adapters/Cornerstone3D/Probe.js +87 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.d.ts +90 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.js +250 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/index.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/index.js +6 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getPatientModule.d.ts +13 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getPatientModule.js +22 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTROIObservationsSequence.d.ts +6 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTROIObservationsSequence.js +10 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTSeriesModule.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getRTSeriesModule.js +9 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedFrameOfReferenceSequence.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedFrameOfReferenceSequence.js +22 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedSeriesSequence.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedSeriesSequence.js +27 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getStructureSetModule.d.ts +7 -0
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getStructureSetModule.js +12 -0
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +92 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.js +45 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.js +47 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.js +25 -0
- package/dist/esm/adapters/Cornerstone3D/Segmentation/index.js +3 -0
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +36 -0
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +93 -0
- package/dist/esm/adapters/Cornerstone3D/cornerstone3DTag.d.ts +2 -0
- package/dist/esm/adapters/Cornerstone3D/cornerstone3DTag.js +3 -0
- package/dist/{types → esm}/adapters/Cornerstone3D/index.d.ts +20 -6
- package/dist/esm/adapters/Cornerstone3D/index.js +41 -0
- package/dist/esm/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.js +20 -0
- package/dist/esm/adapters/VTKjs/Segmentation.d.ts +41 -0
- package/dist/esm/adapters/VTKjs/Segmentation.js +186 -0
- package/dist/esm/adapters/VTKjs/index.d.ts +5 -0
- package/dist/esm/adapters/VTKjs/index.js +7 -0
- package/dist/esm/adapters/enums/Events.js +13 -0
- package/dist/esm/adapters/enums/index.js +1 -0
- package/dist/esm/adapters/helpers/codeMeaningEquals.js +14 -0
- package/dist/{types → esm}/adapters/helpers/downloadDICOMData.d.ts +1 -1
- package/dist/esm/adapters/helpers/downloadDICOMData.js +31 -0
- package/dist/esm/adapters/helpers/graphicTypeEquals.js +12 -0
- package/dist/esm/adapters/helpers/index.js +4 -0
- package/dist/esm/adapters/helpers/toArray.js +5 -0
- package/dist/esm/adapters/index.d.ts +62 -0
- package/dist/esm/adapters/index.js +20 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +5 -0
- package/dist/umd/adapters.umd.js +5738 -0
- package/dist/umd/adapters.umd.js.map +1 -0
- package/package.json +14 -10
- package/dist/adapters.es.js +0 -5194
- package/dist/adapters.es.js.map +0 -1
- package/dist/types/adapters/Cornerstone/index.d.ts +0 -16
- package/dist/types/adapters/VTKjs/index.d.ts +0 -4
- package/dist/types/adapters/index.d.ts +0 -43
- package/dist/types/index.d.ts +0 -2
- /package/dist/{types → esm}/adapters/Cornerstone3D/Angle.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Bidirectional.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/CircleROI.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/CobbAngle.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/EllipticalROI.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/RectangleROI.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/generateSegmentation.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/generateToolState.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/Segmentation/index.d.ts +0 -0
- /package/dist/{types → esm}/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.d.ts +0 -0
- /package/dist/{types → esm}/adapters/enums/Events.d.ts +0 -0
- /package/dist/{types → esm}/adapters/enums/index.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/codeMeaningEquals.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/graphicTypeEquals.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/index.d.ts +0 -0
- /package/dist/{types → esm}/adapters/helpers/toArray.d.ts +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare class UltrasoundDirectional {
|
|
2
|
+
static toolType: string;
|
|
3
|
+
static utilityToolType: string;
|
|
4
|
+
static TID300Representation: any;
|
|
5
|
+
static isValidCornerstoneTrackingIdentifier: (TrackingIdentifier: any) => boolean;
|
|
6
|
+
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): {
|
|
7
|
+
description: any;
|
|
8
|
+
sopInstanceUid: any;
|
|
9
|
+
annotation: {
|
|
10
|
+
annotationUID: any;
|
|
11
|
+
metadata: {
|
|
12
|
+
toolName: any;
|
|
13
|
+
referencedImageId: any;
|
|
14
|
+
FrameOfReferenceUID: any;
|
|
15
|
+
label: string;
|
|
16
|
+
};
|
|
17
|
+
data: any;
|
|
18
|
+
};
|
|
19
|
+
finding: any;
|
|
20
|
+
findingSites: any[];
|
|
21
|
+
};
|
|
22
|
+
static getTID300RepresentationArguments(tool: any, worldToImageCoords: any): {
|
|
23
|
+
point1: {
|
|
24
|
+
x: any;
|
|
25
|
+
y: any;
|
|
26
|
+
};
|
|
27
|
+
point2: {
|
|
28
|
+
x: any;
|
|
29
|
+
y: any;
|
|
30
|
+
};
|
|
31
|
+
trackingIdentifierTextValue: string;
|
|
32
|
+
finding: any;
|
|
33
|
+
findingSites: any;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export default UltrasoundDirectional;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { defineProperty as _defineProperty, createClass as _createClass, slicedToArray as _slicedToArray, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { utilities } from 'dcmjs';
|
|
3
|
+
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
4
|
+
import MeasurementReport from './MeasurementReport.js';
|
|
5
|
+
|
|
6
|
+
var TID300Length = utilities.TID300.Length;
|
|
7
|
+
var ULTRASOUND_DIRECTIONAL = "UltrasoundDirectionalTool";
|
|
8
|
+
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(ULTRASOUND_DIRECTIONAL);
|
|
9
|
+
var UltrasoundDirectional = /*#__PURE__*/function () {
|
|
10
|
+
function UltrasoundDirectional() {
|
|
11
|
+
_classCallCheck(this, UltrasoundDirectional);
|
|
12
|
+
}
|
|
13
|
+
return _createClass(UltrasoundDirectional, null, [{
|
|
14
|
+
key: "getMeasurementData",
|
|
15
|
+
value:
|
|
16
|
+
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
17
|
+
function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
18
|
+
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, UltrasoundDirectional.toolType),
|
|
19
|
+
defaultState = _MeasurementReport$ge.defaultState,
|
|
20
|
+
SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
|
|
21
|
+
ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
|
|
22
|
+
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
23
|
+
var GraphicData = SCOORDGroup.GraphicData;
|
|
24
|
+
var worldCoords = [];
|
|
25
|
+
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
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]],
|
|
33
|
+
activeHandleIndex: 0,
|
|
34
|
+
textBox: {
|
|
35
|
+
hasMoved: false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
cachedStats: {},
|
|
39
|
+
frameNumber: ReferencedFrameNumber
|
|
40
|
+
};
|
|
41
|
+
return state;
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "getTID300RepresentationArguments",
|
|
45
|
+
value: function getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
46
|
+
var data = tool.data,
|
|
47
|
+
finding = tool.finding,
|
|
48
|
+
findingSites = tool.findingSites,
|
|
49
|
+
metadata = tool.metadata;
|
|
50
|
+
var handles = data.handles;
|
|
51
|
+
var referencedImageId = metadata.referencedImageId;
|
|
52
|
+
if (!referencedImageId) {
|
|
53
|
+
throw new Error("UltrasoundDirectionalTool.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
54
|
+
}
|
|
55
|
+
var start = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
56
|
+
var end = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
57
|
+
var point1 = {
|
|
58
|
+
x: start[0],
|
|
59
|
+
y: start[1]
|
|
60
|
+
};
|
|
61
|
+
var point2 = {
|
|
62
|
+
x: end[0],
|
|
63
|
+
y: end[1]
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
point1: point1,
|
|
67
|
+
point2: point2,
|
|
68
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
69
|
+
finding: finding,
|
|
70
|
+
findingSites: findingSites || []
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}]);
|
|
74
|
+
}();
|
|
75
|
+
_defineProperty(UltrasoundDirectional, "toolType", ULTRASOUND_DIRECTIONAL);
|
|
76
|
+
_defineProperty(UltrasoundDirectional, "utilityToolType", ULTRASOUND_DIRECTIONAL);
|
|
77
|
+
_defineProperty(UltrasoundDirectional, "TID300Representation", TID300Length);
|
|
78
|
+
_defineProperty(UltrasoundDirectional, "isValidCornerstoneTrackingIdentifier", function (TrackingIdentifier) {
|
|
79
|
+
if (!TrackingIdentifier.includes(":")) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
var _TrackingIdentifier$s = TrackingIdentifier.split(":"),
|
|
83
|
+
_TrackingIdentifier$s2 = _slicedToArray(_TrackingIdentifier$s, 2),
|
|
84
|
+
cornerstone3DTag = _TrackingIdentifier$s2[0],
|
|
85
|
+
toolType = _TrackingIdentifier$s2[1];
|
|
86
|
+
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return toolType === ULTRASOUND_DIRECTIONAL;
|
|
90
|
+
});
|
|
91
|
+
MeasurementReport.registerTool(UltrasoundDirectional);
|
|
92
|
+
|
|
93
|
+
export { UltrasoundDirectional as default };
|
|
@@ -1,28 +1,42 @@
|
|
|
1
1
|
import MeasurementReport from "./MeasurementReport";
|
|
2
|
+
import ArrowAnnotate from "./ArrowAnnotate";
|
|
2
3
|
import Bidirectional from "./Bidirectional";
|
|
3
4
|
import Angle from "./Angle";
|
|
4
5
|
import CobbAngle from "./CobbAngle";
|
|
5
6
|
import CircleROI from "./CircleROI";
|
|
6
7
|
import EllipticalROI from "./EllipticalROI";
|
|
7
8
|
import RectangleROI from "./RectangleROI";
|
|
9
|
+
import Length from "./Length";
|
|
8
10
|
import PlanarFreehandROI from "./PlanarFreehandROI";
|
|
11
|
+
import Probe from "./Probe";
|
|
12
|
+
import UltrasoundDirectional from "./UltrasoundDirectional";
|
|
9
13
|
import * as Segmentation from "./Segmentation";
|
|
14
|
+
import * as RTSS from "./RTStruct";
|
|
10
15
|
declare const Cornerstone3DSR: {
|
|
11
16
|
Bidirectional: typeof Bidirectional;
|
|
12
17
|
CobbAngle: typeof CobbAngle;
|
|
13
18
|
Angle: typeof Angle;
|
|
14
|
-
Length:
|
|
19
|
+
Length: typeof Length;
|
|
15
20
|
CircleROI: typeof CircleROI;
|
|
16
21
|
EllipticalROI: typeof EllipticalROI;
|
|
17
22
|
RectangleROI: typeof RectangleROI;
|
|
18
|
-
ArrowAnnotate:
|
|
19
|
-
Probe:
|
|
23
|
+
ArrowAnnotate: typeof ArrowAnnotate;
|
|
24
|
+
Probe: typeof Probe;
|
|
20
25
|
PlanarFreehandROI: typeof PlanarFreehandROI;
|
|
26
|
+
UltrasoundDirectional: typeof UltrasoundDirectional;
|
|
21
27
|
MeasurementReport: typeof MeasurementReport;
|
|
22
|
-
CodeScheme:
|
|
23
|
-
|
|
28
|
+
CodeScheme: {
|
|
29
|
+
CodingSchemeDesignator: string;
|
|
30
|
+
codeValues: {
|
|
31
|
+
CORNERSTONEFREETEXT: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
CORNERSTONE_3D_TAG: string;
|
|
24
35
|
};
|
|
25
36
|
declare const Cornerstone3DSEG: {
|
|
26
37
|
Segmentation: typeof Segmentation;
|
|
27
38
|
};
|
|
28
|
-
|
|
39
|
+
declare const Cornerstone3DRT: {
|
|
40
|
+
RTSS: typeof RTSS;
|
|
41
|
+
};
|
|
42
|
+
export { Cornerstone3DSR, Cornerstone3DSEG, Cornerstone3DRT };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import MeasurementReport from './MeasurementReport.js';
|
|
2
|
+
import CodingScheme from './CodingScheme.js';
|
|
3
|
+
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
4
|
+
import ArrowAnnotate from './ArrowAnnotate.js';
|
|
5
|
+
import Bidirectional from './Bidirectional.js';
|
|
6
|
+
import Angle from './Angle.js';
|
|
7
|
+
import CobbAngle from './CobbAngle.js';
|
|
8
|
+
import CircleROI from './CircleROI.js';
|
|
9
|
+
import EllipticalROI from './EllipticalROI.js';
|
|
10
|
+
import RectangleROI from './RectangleROI.js';
|
|
11
|
+
import Length from './Length.js';
|
|
12
|
+
import PlanarFreehandROI from './PlanarFreehandROI.js';
|
|
13
|
+
import Probe from './Probe.js';
|
|
14
|
+
import UltrasoundDirectional from './UltrasoundDirectional.js';
|
|
15
|
+
import * as index from './Segmentation/index.js';
|
|
16
|
+
import * as index$1 from './RTStruct/index.js';
|
|
17
|
+
|
|
18
|
+
var Cornerstone3DSR = {
|
|
19
|
+
Bidirectional: Bidirectional,
|
|
20
|
+
CobbAngle: CobbAngle,
|
|
21
|
+
Angle: Angle,
|
|
22
|
+
Length: Length,
|
|
23
|
+
CircleROI: CircleROI,
|
|
24
|
+
EllipticalROI: EllipticalROI,
|
|
25
|
+
RectangleROI: RectangleROI,
|
|
26
|
+
ArrowAnnotate: ArrowAnnotate,
|
|
27
|
+
Probe: Probe,
|
|
28
|
+
PlanarFreehandROI: PlanarFreehandROI,
|
|
29
|
+
UltrasoundDirectional: UltrasoundDirectional,
|
|
30
|
+
MeasurementReport: MeasurementReport,
|
|
31
|
+
CodeScheme: CodingScheme,
|
|
32
|
+
CORNERSTONE_3D_TAG: CORNERSTONE_3D_TAG
|
|
33
|
+
};
|
|
34
|
+
var Cornerstone3DSEG = {
|
|
35
|
+
Segmentation: index
|
|
36
|
+
};
|
|
37
|
+
var Cornerstone3DRT = {
|
|
38
|
+
RTSS: index$1
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { Cornerstone3DRT, Cornerstone3DSEG, Cornerstone3DSR };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
3
|
+
|
|
4
|
+
function isValidCornerstoneTrackingIdentifier(trackingIdentifier) {
|
|
5
|
+
if (!trackingIdentifier.includes(":")) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
var _trackingIdentifier$s = trackingIdentifier.split(":"),
|
|
9
|
+
_trackingIdentifier$s2 = _slicedToArray(_trackingIdentifier$s, 2),
|
|
10
|
+
cornerstone3DTag = _trackingIdentifier$s2[0],
|
|
11
|
+
toolType = _trackingIdentifier$s2[1];
|
|
12
|
+
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
// The following is needed since the new cornerstone3D has changed
|
|
16
|
+
// case names such as EllipticalRoi to EllipticalROI
|
|
17
|
+
return toolType.toLowerCase() === this.toolType.toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { isValidCornerstoneTrackingIdentifier as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default class Segmentation {
|
|
2
|
+
/**
|
|
3
|
+
* Produces an array of Segments from an input DICOM Segmentation dataset
|
|
4
|
+
*
|
|
5
|
+
* Segments are returned with Geometry values that can be used to create
|
|
6
|
+
* VTK Image Data objects.
|
|
7
|
+
*
|
|
8
|
+
* @example Example usage to create VTK Volume actors from each segment:
|
|
9
|
+
*
|
|
10
|
+
* const actors = [];
|
|
11
|
+
* const segments = generateToolState(dataset);
|
|
12
|
+
* segments.forEach(segment => {
|
|
13
|
+
* // now make actors using the segment information
|
|
14
|
+
* const scalarArray = vtk.Common.Core.vtkDataArray.newInstance({
|
|
15
|
+
* name: "Scalars",
|
|
16
|
+
* numberOfComponents: 1,
|
|
17
|
+
* values: segment.pixelData,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const imageData = vtk.Common.DataModel.vtkImageData.newInstance();
|
|
21
|
+
* imageData.getPointData().setScalars(scalarArray);
|
|
22
|
+
* imageData.setDimensions(geometry.dimensions);
|
|
23
|
+
* imageData.setSpacing(geometry.spacing);
|
|
24
|
+
* imageData.setOrigin(geometry.origin);
|
|
25
|
+
* imageData.setDirection(geometry.direction);
|
|
26
|
+
*
|
|
27
|
+
* const mapper = vtk.Rendering.Core.vtkVolumeMapper.newInstance();
|
|
28
|
+
* mapper.setInputData(imageData);
|
|
29
|
+
* mapper.setSampleDistance(2.);
|
|
30
|
+
*
|
|
31
|
+
* const actor = vtk.Rendering.Core.vtkVolume.newInstance();
|
|
32
|
+
* actor.setMapper(mapper);
|
|
33
|
+
*
|
|
34
|
+
* actors.push(actor);
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* @param dataset
|
|
38
|
+
* @return {{}}
|
|
39
|
+
*/
|
|
40
|
+
static generateSegments(dataset: any): {};
|
|
41
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { createClass as _createClass, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { data } from 'dcmjs';
|
|
3
|
+
|
|
4
|
+
var Colors = data.Colors,
|
|
5
|
+
BitArray = data.BitArray;
|
|
6
|
+
|
|
7
|
+
// TODO: Is there a better name for this? RGBAInt?
|
|
8
|
+
// Should we move it to Colors.js
|
|
9
|
+
function dicomlab2RGBA(cielab) {
|
|
10
|
+
var rgba = Colors.dicomlab2RGB(cielab).map(function (x) {
|
|
11
|
+
return Math.round(x * 255);
|
|
12
|
+
});
|
|
13
|
+
rgba.push(255);
|
|
14
|
+
return rgba;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// TODO: Copied these functions in from VTK Math so we don't need a dependency.
|
|
18
|
+
// I guess we should put them somewhere
|
|
19
|
+
// https://github.com/Kitware/vtk-js/blob/master/Sources/Common/Core/Math/index.js
|
|
20
|
+
function cross(x, y, out) {
|
|
21
|
+
var Zx = x[1] * y[2] - x[2] * y[1];
|
|
22
|
+
var Zy = x[2] * y[0] - x[0] * y[2];
|
|
23
|
+
var Zz = x[0] * y[1] - x[1] * y[0];
|
|
24
|
+
out[0] = Zx;
|
|
25
|
+
out[1] = Zy;
|
|
26
|
+
out[2] = Zz;
|
|
27
|
+
}
|
|
28
|
+
function norm(x) {
|
|
29
|
+
var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
|
|
30
|
+
switch (n) {
|
|
31
|
+
case 1:
|
|
32
|
+
return Math.abs(x);
|
|
33
|
+
case 2:
|
|
34
|
+
return Math.sqrt(x[0] * x[0] + x[1] * x[1]);
|
|
35
|
+
case 3:
|
|
36
|
+
return Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
|
|
37
|
+
default:
|
|
38
|
+
{
|
|
39
|
+
var sum = 0;
|
|
40
|
+
for (var i = 0; i < n; i++) {
|
|
41
|
+
sum += x[i] * x[i];
|
|
42
|
+
}
|
|
43
|
+
return Math.sqrt(sum);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function normalize(x) {
|
|
48
|
+
var den = norm(x);
|
|
49
|
+
if (den !== 0.0) {
|
|
50
|
+
x[0] /= den;
|
|
51
|
+
x[1] /= den;
|
|
52
|
+
x[2] /= den;
|
|
53
|
+
}
|
|
54
|
+
return den;
|
|
55
|
+
}
|
|
56
|
+
function subtract(a, b, out) {
|
|
57
|
+
out[0] = a[0] - b[0];
|
|
58
|
+
out[1] = a[1] - b[1];
|
|
59
|
+
out[2] = a[2] - b[2];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// TODO: This is a useful utility on its own. We should move it somewhere?
|
|
63
|
+
// dcmjs.adapters.vtk.Multiframe? dcmjs.utils?
|
|
64
|
+
function geometryFromFunctionalGroups(dataset, PerFrameFunctionalGroups) {
|
|
65
|
+
var geometry = {};
|
|
66
|
+
var pixelMeasures = dataset.SharedFunctionalGroupsSequence.PixelMeasuresSequence;
|
|
67
|
+
var planeOrientation = dataset.SharedFunctionalGroupsSequence.PlaneOrientationSequence;
|
|
68
|
+
|
|
69
|
+
// Find the origin of the volume from the PerFrameFunctionalGroups' ImagePositionPatient values
|
|
70
|
+
//
|
|
71
|
+
// TODO: assumes sorted frames. This should read the ImagePositionPatient from each frame and
|
|
72
|
+
// sort them to obtain the first and last position along the acquisition axis.
|
|
73
|
+
var firstFunctionalGroup = PerFrameFunctionalGroups[0];
|
|
74
|
+
var lastFunctionalGroup = PerFrameFunctionalGroups[PerFrameFunctionalGroups.length - 1];
|
|
75
|
+
var firstPosition = firstFunctionalGroup.PlanePositionSequence.ImagePositionPatient.map(Number);
|
|
76
|
+
var lastPosition = lastFunctionalGroup.PlanePositionSequence.ImagePositionPatient.map(Number);
|
|
77
|
+
geometry.origin = firstPosition;
|
|
78
|
+
|
|
79
|
+
// NB: DICOM PixelSpacing is defined as Row then Column,
|
|
80
|
+
// unlike ImageOrientationPatient
|
|
81
|
+
geometry.spacing = [pixelMeasures.PixelSpacing[1], pixelMeasures.PixelSpacing[0], pixelMeasures.SpacingBetweenSlices].map(Number);
|
|
82
|
+
geometry.dimensions = [dataset.Columns, dataset.Rows, PerFrameFunctionalGroups.length].map(Number);
|
|
83
|
+
var orientation = planeOrientation.ImageOrientationPatient.map(Number);
|
|
84
|
+
var columnStepToPatient = orientation.slice(0, 3);
|
|
85
|
+
var rowStepToPatient = orientation.slice(3, 6);
|
|
86
|
+
geometry.planeNormal = [];
|
|
87
|
+
cross(columnStepToPatient, rowStepToPatient, geometry.planeNormal);
|
|
88
|
+
geometry.sliceStep = [];
|
|
89
|
+
subtract(lastPosition, firstPosition, geometry.sliceStep);
|
|
90
|
+
normalize(geometry.sliceStep);
|
|
91
|
+
geometry.direction = columnStepToPatient.concat(rowStepToPatient).concat(geometry.sliceStep);
|
|
92
|
+
return geometry;
|
|
93
|
+
}
|
|
94
|
+
var Segmentation = /*#__PURE__*/function () {
|
|
95
|
+
function Segmentation() {
|
|
96
|
+
_classCallCheck(this, Segmentation);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Produces an array of Segments from an input DICOM Segmentation dataset
|
|
101
|
+
*
|
|
102
|
+
* Segments are returned with Geometry values that can be used to create
|
|
103
|
+
* VTK Image Data objects.
|
|
104
|
+
*
|
|
105
|
+
* @example Example usage to create VTK Volume actors from each segment:
|
|
106
|
+
*
|
|
107
|
+
* const actors = [];
|
|
108
|
+
* const segments = generateToolState(dataset);
|
|
109
|
+
* segments.forEach(segment => {
|
|
110
|
+
* // now make actors using the segment information
|
|
111
|
+
* const scalarArray = vtk.Common.Core.vtkDataArray.newInstance({
|
|
112
|
+
* name: "Scalars",
|
|
113
|
+
* numberOfComponents: 1,
|
|
114
|
+
* values: segment.pixelData,
|
|
115
|
+
* });
|
|
116
|
+
*
|
|
117
|
+
* const imageData = vtk.Common.DataModel.vtkImageData.newInstance();
|
|
118
|
+
* imageData.getPointData().setScalars(scalarArray);
|
|
119
|
+
* imageData.setDimensions(geometry.dimensions);
|
|
120
|
+
* imageData.setSpacing(geometry.spacing);
|
|
121
|
+
* imageData.setOrigin(geometry.origin);
|
|
122
|
+
* imageData.setDirection(geometry.direction);
|
|
123
|
+
*
|
|
124
|
+
* const mapper = vtk.Rendering.Core.vtkVolumeMapper.newInstance();
|
|
125
|
+
* mapper.setInputData(imageData);
|
|
126
|
+
* mapper.setSampleDistance(2.);
|
|
127
|
+
*
|
|
128
|
+
* const actor = vtk.Rendering.Core.vtkVolume.newInstance();
|
|
129
|
+
* actor.setMapper(mapper);
|
|
130
|
+
*
|
|
131
|
+
* actors.push(actor);
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* @param dataset
|
|
135
|
+
* @return {{}}
|
|
136
|
+
*/
|
|
137
|
+
return _createClass(Segmentation, null, [{
|
|
138
|
+
key: "generateSegments",
|
|
139
|
+
value: function generateSegments(dataset) {
|
|
140
|
+
if (dataset.SegmentSequence.constructor.name !== "Array") {
|
|
141
|
+
dataset.SegmentSequence = [dataset.SegmentSequence];
|
|
142
|
+
}
|
|
143
|
+
dataset.SegmentSequence.forEach(function (segment) {
|
|
144
|
+
// TODO: other interesting fields could be extracted from the segment
|
|
145
|
+
// TODO: Read SegmentsOverlay field
|
|
146
|
+
// http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.8.20.2.html
|
|
147
|
+
|
|
148
|
+
// TODO: Looks like vtkColor only wants RGB in 0-1 values.
|
|
149
|
+
// Why was this example converting to RGBA with 0-255 values?
|
|
150
|
+
var color = dicomlab2RGBA(segment.RecommendedDisplayCIELabValue);
|
|
151
|
+
segments[segment.SegmentNumber] = {
|
|
152
|
+
color: color,
|
|
153
|
+
functionalGroups: [],
|
|
154
|
+
offset: null,
|
|
155
|
+
size: null,
|
|
156
|
+
pixelData: null
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// make a list of functional groups per segment
|
|
161
|
+
dataset.PerFrameFunctionalGroupsSequence.forEach(function (functionalGroup) {
|
|
162
|
+
var segmentNumber = functionalGroup.SegmentIdentificationSequence.ReferencedSegmentNumber;
|
|
163
|
+
segments[segmentNumber].functionalGroups.push(functionalGroup);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// determine per-segment index into the pixel data
|
|
167
|
+
// TODO: only handles one-bit-per pixel
|
|
168
|
+
var frameSize = Math.ceil(dataset.Rows * dataset.Columns / 8);
|
|
169
|
+
var nextOffset = 0;
|
|
170
|
+
Object.keys(segments).forEach(function (segmentNumber) {
|
|
171
|
+
var segment = segments[segmentNumber];
|
|
172
|
+
segment.numberOfFrames = segment.functionalGroups.length;
|
|
173
|
+
segment.size = segment.numberOfFrames * frameSize;
|
|
174
|
+
segment.offset = nextOffset;
|
|
175
|
+
nextOffset = segment.offset + segment.size;
|
|
176
|
+
var packedSegment = dataset.PixelData.slice(segment.offset, nextOffset);
|
|
177
|
+
segment.pixelData = BitArray.unpack(packedSegment);
|
|
178
|
+
var geometry = geometryFromFunctionalGroups(dataset, segment.functionalGroups);
|
|
179
|
+
segment.geometry = geometry;
|
|
180
|
+
});
|
|
181
|
+
return segments;
|
|
182
|
+
}
|
|
183
|
+
}]);
|
|
184
|
+
}();
|
|
185
|
+
|
|
186
|
+
export { Segmentation as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cornerstone adapters events
|
|
3
|
+
*/
|
|
4
|
+
var Events;
|
|
5
|
+
(function (Events) {
|
|
6
|
+
/**
|
|
7
|
+
* Cornerstone segmentation load progress event
|
|
8
|
+
*/
|
|
9
|
+
Events["SEGMENTATION_LOAD_PROGRESS"] = "CORNERSTONE_ADAPTER_SEGMENTATION_LOAD_PROGRESS";
|
|
10
|
+
})(Events || (Events = {}));
|
|
11
|
+
var Events$1 = Events;
|
|
12
|
+
|
|
13
|
+
export { Events$1 as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Events } from './Events.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that checks if a given content item's ConceptNameCodeSequence.CodeMeaning
|
|
3
|
+
* matches the provided codeMeaningName.
|
|
4
|
+
* @param codeMeaningName - The CodeMeaning to match against.
|
|
5
|
+
* @returns A function that takes a content item and returns a boolean indicating whether the
|
|
6
|
+
* content item's CodeMeaning matches the provided codeMeaningName.
|
|
7
|
+
*/
|
|
8
|
+
var codeMeaningEquals = function codeMeaningEquals(codeMeaningName) {
|
|
9
|
+
return function (contentItem) {
|
|
10
|
+
return contentItem.ConceptNameCodeSequence.CodeMeaning === codeMeaningName;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { codeMeaningEquals };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { data } from 'dcmjs';
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
3
|
+
|
|
4
|
+
var datasetToDict = data.datasetToDict;
|
|
5
|
+
/**
|
|
6
|
+
* Trigger file download from an array buffer
|
|
7
|
+
* @param bufferOrDataset - ArrayBuffer or DicomDataset
|
|
8
|
+
* @param filename - name of the file to download
|
|
9
|
+
*/
|
|
10
|
+
function downloadDICOMData(bufferOrDataset, filename) {
|
|
11
|
+
var blob;
|
|
12
|
+
if (bufferOrDataset instanceof ArrayBuffer) {
|
|
13
|
+
blob = new Blob([bufferOrDataset], {
|
|
14
|
+
type: "application/dicom"
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
if (!bufferOrDataset._meta) {
|
|
18
|
+
throw new Error("Dataset must have a _meta property");
|
|
19
|
+
}
|
|
20
|
+
var buffer = Buffer.from(datasetToDict(bufferOrDataset).write());
|
|
21
|
+
blob = new Blob([buffer], {
|
|
22
|
+
type: "application/dicom"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
var link = document.createElement("a");
|
|
26
|
+
link.href = window.URL.createObjectURL(blob);
|
|
27
|
+
link.download = filename;
|
|
28
|
+
link.click();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { downloadDICOMData };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a given content item's GraphicType property matches a specified value.
|
|
3
|
+
* @param {string} graphicType - The value to compare the content item's GraphicType property to.
|
|
4
|
+
* @returns {function} A function that takes a content item and returns a boolean indicating whether its GraphicType property matches the specified value.
|
|
5
|
+
*/
|
|
6
|
+
var graphicTypeEquals = function graphicTypeEquals(graphicType) {
|
|
7
|
+
return function (contentItem) {
|
|
8
|
+
return contentItem && contentItem.GraphicType === graphicType;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { graphicTypeEquals };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as Enums from "./enums";
|
|
2
|
+
import * as helpers from "./helpers";
|
|
3
|
+
declare const adaptersSR: {
|
|
4
|
+
Cornerstone: {
|
|
5
|
+
Length: typeof import("./Cornerstone/Length").default;
|
|
6
|
+
FreehandRoi: typeof import("./Cornerstone/FreehandRoi").default;
|
|
7
|
+
Bidirectional: typeof import("./Cornerstone/Bidirectional").default;
|
|
8
|
+
EllipticalRoi: typeof import("./Cornerstone/EllipticalRoi").default;
|
|
9
|
+
CircleRoi: typeof import("./Cornerstone/CircleRoi").default;
|
|
10
|
+
ArrowAnnotate: typeof import("./Cornerstone/ArrowAnnotate").default;
|
|
11
|
+
MeasurementReport: typeof import("./Cornerstone/MeasurementReport").default;
|
|
12
|
+
CobbAngle: typeof import("./Cornerstone/CobbAngle").default;
|
|
13
|
+
Angle: typeof import("./Cornerstone/Angle").default;
|
|
14
|
+
RectangleRoi: typeof import("./Cornerstone/RectangleRoi").default;
|
|
15
|
+
};
|
|
16
|
+
Cornerstone3D: {
|
|
17
|
+
Bidirectional: typeof import("./Cornerstone3D/Bidirectional").default;
|
|
18
|
+
CobbAngle: typeof import("./Cornerstone3D/CobbAngle").default;
|
|
19
|
+
Angle: typeof import("./Cornerstone3D/Angle").default;
|
|
20
|
+
Length: typeof import("./Cornerstone3D/Length").default;
|
|
21
|
+
CircleROI: typeof import("./Cornerstone3D/CircleROI").default;
|
|
22
|
+
EllipticalROI: typeof import("./Cornerstone3D/EllipticalROI").default;
|
|
23
|
+
RectangleROI: typeof import("./Cornerstone3D/RectangleROI").default;
|
|
24
|
+
ArrowAnnotate: typeof import("./Cornerstone3D/ArrowAnnotate").default;
|
|
25
|
+
Probe: typeof import("./Cornerstone3D/Probe").default;
|
|
26
|
+
PlanarFreehandROI: typeof import("./Cornerstone3D/PlanarFreehandROI").default;
|
|
27
|
+
UltrasoundDirectional: typeof import("./Cornerstone3D/UltrasoundDirectional").default;
|
|
28
|
+
MeasurementReport: typeof import("./Cornerstone3D/MeasurementReport").default;
|
|
29
|
+
CodeScheme: {
|
|
30
|
+
CodingSchemeDesignator: string;
|
|
31
|
+
codeValues: {
|
|
32
|
+
CORNERSTONEFREETEXT: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
CORNERSTONE_3D_TAG: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare const adaptersSEG: {
|
|
39
|
+
Cornerstone: {
|
|
40
|
+
Segmentation: {
|
|
41
|
+
generateSegmentation: (images: object[], labelmaps3DorBrushData: any | any[], options?: {
|
|
42
|
+
includeSliceSpacing: boolean;
|
|
43
|
+
}, cornerstoneToolsVersion?: number) => any;
|
|
44
|
+
generateToolState: (imageIds: string[], arrayBuffer: ArrayBuffer, metadataProvider: any, skipOverlapping?: bool, tolerance?: number, cornerstoneToolsVersion?: number) => any;
|
|
45
|
+
fillSegmentation: (segmentation: object[], inputLabelmaps3D: any | any[], options?: {
|
|
46
|
+
includeSliceSpacing: boolean;
|
|
47
|
+
}, cornerstoneToolsVersion?: number) => Blob;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
Cornerstone3D: {
|
|
51
|
+
Segmentation: typeof import("./Cornerstone3D/Segmentation");
|
|
52
|
+
};
|
|
53
|
+
VTKjs: {
|
|
54
|
+
Segmentation: typeof import("./VTKjs/Segmentation").default;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
declare const adaptersRT: {
|
|
58
|
+
Cornerstone3D: {
|
|
59
|
+
RTSS: typeof import("./Cornerstone3D/RTStruct");
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export { adaptersSR, adaptersSEG, adaptersRT, Enums, helpers };
|