@cornerstonejs/adapters 4.0.0-beta.3 → 4.0.0-beta.5
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/README.md +7 -7
- package/dist/esm/adapters/Cornerstone/Bidirectional.js +1 -0
- package/dist/esm/adapters/Cornerstone/MeasurementReport.js +8 -6
- package/dist/esm/adapters/Cornerstone/ParametricMap.js +2 -2
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +14 -11
- package/dist/esm/adapters/Cornerstone3D/Angle.d.ts +25 -62
- package/dist/esm/adapters/Cornerstone3D/Angle.js +29 -146
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +15 -27
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +31 -161
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.d.ts +12 -21
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.js +58 -43
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.d.ts +25 -80
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +36 -173
- package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +18 -33
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +27 -133
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.d.ts +25 -62
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +24 -149
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.d.ts +18 -30
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +27 -241
- package/dist/esm/adapters/Cornerstone3D/KeyImage.d.ts +17 -11
- package/dist/esm/adapters/Cornerstone3D/KeyImage.js +4 -4
- package/dist/esm/adapters/Cornerstone3D/LabelData.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/LabelData.js +102 -0
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +17 -45
- package/dist/esm/adapters/Cornerstone3D/Length.js +27 -125
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +77 -37
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +176 -51
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +18 -41
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +26 -138
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +17 -32
- package/dist/esm/adapters/Cornerstone3D/Probe.js +34 -106
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.d.ts +19 -33
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +28 -115
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +9 -15
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +12 -21
- package/dist/esm/adapters/Cornerstone3D/constants/index.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/constants/index.js +12 -1
- package/dist/esm/adapters/Cornerstone3D/index.d.ts +11 -0
- package/dist/esm/adapters/Cornerstone3D/index.js +6 -2
- package/dist/esm/adapters/helpers/checkOrientation.js +2 -2
- package/dist/esm/adapters/helpers/index.d.ts +3 -0
- package/dist/esm/adapters/helpers/index.js +3 -0
- package/dist/esm/adapters/helpers/scoordToWorld.d.ts +5 -0
- package/dist/esm/adapters/helpers/scoordToWorld.js +32 -0
- package/dist/esm/adapters/helpers/toArray.js +1 -1
- package/dist/esm/adapters/helpers/toPoint3.d.ts +3 -0
- package/dist/esm/adapters/helpers/toPoint3.js +18 -0
- package/dist/esm/adapters/helpers/toScoordType.d.ts +23 -0
- package/dist/esm/adapters/helpers/toScoordType.js +33 -0
- package/dist/esm/adapters/index.d.ts +12 -1
- package/dist/esm/adapters/index.js +1 -0
- package/dist/esm/version.d.ts +1 -1
- package/package.json +6 -7
- package/dist/esm/adapters/helpers/compareArrays.d.ts +0 -1
- package/dist/esm/adapters/helpers/compareArrays.js +0 -18
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { utilities } from 'dcmjs';
|
|
2
|
+
import 'buffer';
|
|
3
|
+
import { toScoords } from '../helpers/toScoordType.js';
|
|
4
|
+
import '@cornerstonejs/core';
|
|
2
5
|
import MeasurementReport from './MeasurementReport.js';
|
|
3
6
|
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
4
7
|
|
|
@@ -7,140 +10,51 @@ const {
|
|
|
7
10
|
Polyline: TID300Polyline
|
|
8
11
|
} = utilities.TID300;
|
|
9
12
|
class RectangleROI extends BaseAdapter3D {
|
|
10
|
-
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap,
|
|
13
|
+
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata) {
|
|
11
14
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
SCOORD3DGroup,
|
|
15
|
+
state,
|
|
16
|
+
worldCoords,
|
|
17
|
+
referencedImageId,
|
|
16
18
|
ReferencedFrameNumber
|
|
17
|
-
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
} else if (SCOORD3DGroup) {
|
|
27
|
-
return this.getMeasurementDataFromScoord3D({
|
|
28
|
-
SCOORD3DGroup,
|
|
29
|
-
defaultState
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
throw new Error("Can't get measurement data with missing SCOORD and SCOORD3D groups.");
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
static getMeasurementDataFromScoord(_ref) {
|
|
36
|
-
let {
|
|
37
|
-
defaultState,
|
|
38
|
-
SCOORDGroup,
|
|
39
|
-
imageToWorldCoords,
|
|
40
|
-
NUMGroup,
|
|
41
|
-
ReferencedFrameNumber
|
|
42
|
-
} = _ref;
|
|
43
|
-
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
44
|
-
const {
|
|
45
|
-
GraphicData
|
|
46
|
-
} = SCOORDGroup;
|
|
47
|
-
const worldCoords = [];
|
|
48
|
-
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
49
|
-
const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
50
|
-
worldCoords.push(point);
|
|
51
|
-
}
|
|
52
|
-
const state = defaultState;
|
|
19
|
+
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
|
|
20
|
+
const areaGroup = MeasurementGroup.ContentSequence.find(g => g.ValueType === "NUM" && g.ConceptNameCodeSequence[0].CodeMeaning === "Area");
|
|
21
|
+
const cachedStats = referencedImageId ? {
|
|
22
|
+
[`imageId:${referencedImageId}`]: {
|
|
23
|
+
area: areaGroup?.MeasuredValueSequence?.[0]?.NumericValue || 0,
|
|
24
|
+
areaUnit: areaGroup?.MeasuredValueSequence?.[0]?.MeasurementUnitsCodeSequence?.CodeValue
|
|
25
|
+
}
|
|
26
|
+
} : {};
|
|
53
27
|
state.annotation.data = {
|
|
28
|
+
...state.annotation.data,
|
|
54
29
|
handles: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
textBox: {
|
|
58
|
-
hasMoved: false
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
cachedStats: {
|
|
62
|
-
[`imageId:${referencedImageId}`]: {
|
|
63
|
-
area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : null
|
|
64
|
-
}
|
|
30
|
+
...state.annotation.data.handles,
|
|
31
|
+
points: [worldCoords[0], worldCoords[1], worldCoords[3], worldCoords[2]]
|
|
65
32
|
},
|
|
33
|
+
cachedStats,
|
|
66
34
|
frameNumber: ReferencedFrameNumber
|
|
67
35
|
};
|
|
68
36
|
return state;
|
|
69
37
|
}
|
|
70
|
-
static
|
|
71
|
-
let
|
|
72
|
-
SCOORD3DGroup,
|
|
73
|
-
defaultState
|
|
74
|
-
} = _ref2;
|
|
75
|
-
const {
|
|
76
|
-
GraphicData
|
|
77
|
-
} = SCOORD3DGroup;
|
|
78
|
-
const worldCoords = [];
|
|
79
|
-
for (let i = 0; i < GraphicData.length; i += 3) {
|
|
80
|
-
const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
|
|
81
|
-
worldCoords.push(point);
|
|
82
|
-
}
|
|
83
|
-
const state = defaultState;
|
|
84
|
-
state.annotation.data = {
|
|
85
|
-
handles: {
|
|
86
|
-
points: [worldCoords[0], worldCoords[1], worldCoords[3], worldCoords[2]],
|
|
87
|
-
activeHandleIndex: 0,
|
|
88
|
-
textBox: {
|
|
89
|
-
hasMoved: false
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
cachedStats: {}
|
|
93
|
-
};
|
|
94
|
-
return state;
|
|
95
|
-
}
|
|
96
|
-
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
38
|
+
static getTID300RepresentationArguments(tool) {
|
|
39
|
+
let is3DMeasurement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
97
40
|
const {
|
|
98
41
|
data,
|
|
99
42
|
finding,
|
|
100
43
|
findingSites,
|
|
101
44
|
metadata
|
|
102
45
|
} = tool;
|
|
103
|
-
const {
|
|
104
|
-
cachedStats = {},
|
|
105
|
-
handles
|
|
106
|
-
} = data;
|
|
107
46
|
const {
|
|
108
47
|
referencedImageId
|
|
109
48
|
} = metadata;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const corners = handles.points.map(point => worldToImageCoords(referencedImageId, point));
|
|
114
|
-
const {
|
|
115
|
-
area,
|
|
116
|
-
perimeter
|
|
117
|
-
} = cachedStats;
|
|
118
|
-
return {
|
|
119
|
-
points: [corners[0], corners[1], corners[3], corners[2], corners[0]],
|
|
120
|
-
area,
|
|
121
|
-
perimeter,
|
|
122
|
-
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
123
|
-
finding,
|
|
124
|
-
findingSites: findingSites || [],
|
|
125
|
-
use3DSpatialCoordinates: false
|
|
49
|
+
const scoordProps = {
|
|
50
|
+
is3DMeasurement,
|
|
51
|
+
referencedImageId
|
|
126
52
|
};
|
|
127
|
-
|
|
128
|
-
static getTID300RepresentationArgumentsSCOORD3D(tool) {
|
|
129
|
-
const {
|
|
130
|
-
data,
|
|
131
|
-
finding,
|
|
132
|
-
findingSites,
|
|
133
|
-
metadata
|
|
134
|
-
} = tool;
|
|
135
|
-
const {
|
|
136
|
-
cachedStats = {},
|
|
137
|
-
handles
|
|
138
|
-
} = data;
|
|
139
|
-
const corners = handles.points;
|
|
53
|
+
const corners = toScoords(scoordProps, data.handles.points);
|
|
140
54
|
const {
|
|
141
55
|
area,
|
|
142
56
|
perimeter
|
|
143
|
-
} = cachedStats;
|
|
57
|
+
} = data.cachedStats[`imageId:${referencedImageId}`] || {};
|
|
144
58
|
return {
|
|
145
59
|
points: [corners[0], corners[1], corners[3], corners[2], corners[0]],
|
|
146
60
|
area,
|
|
@@ -148,8 +62,7 @@ class RectangleROI extends BaseAdapter3D {
|
|
|
148
62
|
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
149
63
|
finding,
|
|
150
64
|
findingSites: findingSites || [],
|
|
151
|
-
|
|
152
|
-
use3DSpatialCoordinates: true
|
|
65
|
+
use3DSpatialCoordinates: is3DMeasurement
|
|
153
66
|
};
|
|
154
67
|
}
|
|
155
68
|
}
|
|
@@ -159,4 +72,4 @@ _RectangleROI = RectangleROI;
|
|
|
159
72
|
_RectangleROI.registerLegacy();
|
|
160
73
|
})();
|
|
161
74
|
|
|
162
|
-
export { RectangleROI as default };
|
|
75
|
+
export { RectangleROI, RectangleROI as default };
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
2
|
declare class UltrasoundDirectional extends BaseAdapter3D {
|
|
3
|
-
static getMeasurementData(
|
|
3
|
+
static getMeasurementData(measurementGroup: any, sopInstanceUIDToImageIdMap: any, metadata: any): {
|
|
4
4
|
description?: string;
|
|
5
5
|
sopInstanceUid?: string;
|
|
6
|
-
annotation:
|
|
7
|
-
annotationUID: string;
|
|
8
|
-
metadata: {
|
|
9
|
-
toolName: string;
|
|
10
|
-
referencedImageId?: string;
|
|
11
|
-
FrameOfReferenceUID: string;
|
|
12
|
-
label: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
6
|
+
annotation: import("packages/tools/dist/esm/types").Annotation;
|
|
15
7
|
finding?: unknown;
|
|
16
8
|
findingSites?: unknown;
|
|
9
|
+
commentGroup?: any;
|
|
10
|
+
commentPositionGroup?: any;
|
|
17
11
|
};
|
|
18
|
-
static getTID300RepresentationArguments(tool: any,
|
|
12
|
+
static getTID300RepresentationArguments(tool: any, is3DMeasurement: any): {
|
|
19
13
|
point1: {
|
|
20
|
-
x:
|
|
21
|
-
y:
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
22
16
|
};
|
|
23
17
|
point2: {
|
|
24
|
-
x:
|
|
25
|
-
y:
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
26
20
|
};
|
|
27
21
|
trackingIdentifierTextValue: string;
|
|
28
22
|
finding: any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { utilities } from 'dcmjs';
|
|
2
|
+
import { utilities as utilities$1 } from '@cornerstonejs/core';
|
|
2
3
|
import MeasurementReport from './MeasurementReport.js';
|
|
3
4
|
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
4
5
|
|
|
@@ -6,37 +7,27 @@ var _UltrasoundDirectional;
|
|
|
6
7
|
const {
|
|
7
8
|
Length: TID300Length
|
|
8
9
|
} = utilities.TID300;
|
|
10
|
+
const {
|
|
11
|
+
worldToImageCoords
|
|
12
|
+
} = utilities$1;
|
|
9
13
|
class UltrasoundDirectional extends BaseAdapter3D {
|
|
10
|
-
static getMeasurementData(
|
|
14
|
+
static getMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, metadata) {
|
|
11
15
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
state,
|
|
17
|
+
worldCoords,
|
|
14
18
|
ReferencedFrameNumber
|
|
15
|
-
} = MeasurementReport.getSetupMeasurementData(
|
|
16
|
-
const referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
17
|
-
const {
|
|
18
|
-
GraphicData
|
|
19
|
-
} = SCOORDGroup;
|
|
20
|
-
const worldCoords = [];
|
|
21
|
-
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
22
|
-
const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
23
|
-
worldCoords.push(point);
|
|
24
|
-
}
|
|
25
|
-
const state = defaultState;
|
|
19
|
+
} = MeasurementReport.getSetupMeasurementData(measurementGroup, sopInstanceUIDToImageIdMap, metadata, this.toolType);
|
|
26
20
|
state.annotation.data = {
|
|
21
|
+
...state.annotation.data,
|
|
27
22
|
handles: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
textBox: {
|
|
31
|
-
hasMoved: false
|
|
32
|
-
}
|
|
23
|
+
...state.annotation.data.handles,
|
|
24
|
+
points: worldCoords
|
|
33
25
|
},
|
|
34
|
-
cachedStats: {},
|
|
35
26
|
frameNumber: ReferencedFrameNumber
|
|
36
27
|
};
|
|
37
28
|
return state;
|
|
38
29
|
}
|
|
39
|
-
static getTID300RepresentationArguments(tool,
|
|
30
|
+
static getTID300RepresentationArguments(tool, is3DMeasurement) {
|
|
40
31
|
const {
|
|
41
32
|
data,
|
|
42
33
|
finding,
|
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export declare const NO_IMAGE_ID = "none";
|
|
2
|
+
export declare const CS3D_DESIGNATOR = "99CS3D";
|
|
3
|
+
export declare const TEXT_ANNOTATION_POSITION: {
|
|
4
|
+
schemeDesignator: string;
|
|
5
|
+
meaning: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const COMMENT_CODE: {
|
|
9
|
+
schemeDesignator: string;
|
|
10
|
+
meaning: string;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
const NO_IMAGE_ID = "none";
|
|
2
|
+
const CS3D_DESIGNATOR = "99CS3D";
|
|
3
|
+
const TEXT_ANNOTATION_POSITION = {
|
|
4
|
+
schemeDesignator: CS3D_DESIGNATOR,
|
|
5
|
+
meaning: "Text Annotation Position",
|
|
6
|
+
value: "TextPosition"
|
|
7
|
+
};
|
|
8
|
+
const COMMENT_CODE = {
|
|
9
|
+
schemeDesignator: "DCM",
|
|
10
|
+
meaning: "Comment",
|
|
11
|
+
value: "121106"
|
|
12
|
+
};
|
|
2
13
|
|
|
3
|
-
export { NO_IMAGE_ID };
|
|
14
|
+
export { COMMENT_CODE, CS3D_DESIGNATOR, NO_IMAGE_ID, TEXT_ANNOTATION_POSITION };
|
|
@@ -37,6 +37,17 @@ declare const Cornerstone3DSR: {
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
CORNERSTONE_3D_TAG: string;
|
|
40
|
+
COMMENT_CODE: {
|
|
41
|
+
schemeDesignator: string;
|
|
42
|
+
meaning: string;
|
|
43
|
+
value: string;
|
|
44
|
+
};
|
|
45
|
+
NO_IMAGE_ID: string;
|
|
46
|
+
TEXT_ANNOTATION_POSITION: {
|
|
47
|
+
schemeDesignator: string;
|
|
48
|
+
meaning: string;
|
|
49
|
+
value: string;
|
|
50
|
+
};
|
|
40
51
|
};
|
|
41
52
|
declare const Cornerstone3DSEG: {
|
|
42
53
|
Segmentation: typeof Segmentation;
|
|
@@ -7,7 +7,7 @@ import Angle from './Angle.js';
|
|
|
7
7
|
import CobbAngle from './CobbAngle.js';
|
|
8
8
|
import CircleROI from './CircleROI.js';
|
|
9
9
|
import EllipticalROI from './EllipticalROI.js';
|
|
10
|
-
import RectangleROI from './RectangleROI.js';
|
|
10
|
+
import { RectangleROI } from './RectangleROI.js';
|
|
11
11
|
import Length from './Length.js';
|
|
12
12
|
import PlanarFreehandROI from './PlanarFreehandROI.js';
|
|
13
13
|
import Probe from './Probe.js';
|
|
@@ -17,6 +17,7 @@ import * as index from './Segmentation/index.js';
|
|
|
17
17
|
import * as index$1 from './ParametricMap/index.js';
|
|
18
18
|
import * as index$2 from './RTStruct/index.js';
|
|
19
19
|
import KeyImage from './KeyImage.js';
|
|
20
|
+
import { COMMENT_CODE, NO_IMAGE_ID, TEXT_ANNOTATION_POSITION } from './constants/index.js';
|
|
20
21
|
|
|
21
22
|
const Cornerstone3DSR = {
|
|
22
23
|
BaseAdapter3D,
|
|
@@ -34,7 +35,10 @@ const Cornerstone3DSR = {
|
|
|
34
35
|
KeyImage,
|
|
35
36
|
MeasurementReport,
|
|
36
37
|
CodeScheme: CodingScheme,
|
|
37
|
-
CORNERSTONE_3D_TAG
|
|
38
|
+
CORNERSTONE_3D_TAG,
|
|
39
|
+
COMMENT_CODE,
|
|
40
|
+
NO_IMAGE_ID,
|
|
41
|
+
TEXT_ANNOTATION_POSITION
|
|
38
42
|
};
|
|
39
43
|
const Cornerstone3DSEG = {
|
|
40
44
|
Segmentation: index
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import checkIfPerpendicular from './checkIfPerpendicular.js';
|
|
2
|
-
import
|
|
2
|
+
import { utilities } from '@cornerstonejs/core';
|
|
3
3
|
|
|
4
4
|
function checkOrientation(multiframe, validOrientations, sourceDataDimensions, tolerance) {
|
|
5
5
|
const {
|
|
@@ -9,7 +9,7 @@ function checkOrientation(multiframe, validOrientations, sourceDataDimensions, t
|
|
|
9
9
|
const sharedImageOrientationPatient = SharedFunctionalGroupsSequence.PlaneOrientationSequence ? SharedFunctionalGroupsSequence.PlaneOrientationSequence.ImageOrientationPatient : undefined;
|
|
10
10
|
const PerFrameFunctionalGroups = PerFrameFunctionalGroupsSequence[0];
|
|
11
11
|
const iop = sharedImageOrientationPatient || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
|
|
12
|
-
const inPlane = validOrientations.some(operation =>
|
|
12
|
+
const inPlane = validOrientations.some(operation => utilities.isEqual(iop, operation, tolerance));
|
|
13
13
|
if (inPlane) {
|
|
14
14
|
return "Planar";
|
|
15
15
|
}
|
|
@@ -4,4 +4,7 @@ import { graphicTypeEquals } from "./graphicTypeEquals";
|
|
|
4
4
|
import { downloadDICOMData } from "./downloadDICOMData";
|
|
5
5
|
export { copyStudyTags } from "./copyStudyTags";
|
|
6
6
|
export { copySeriesTags } from "./copySeriesTags";
|
|
7
|
+
export * from "./toScoordType";
|
|
8
|
+
export * from "./scoordToWorld";
|
|
9
|
+
export * from "./toPoint3";
|
|
7
10
|
export { toArray, codeMeaningEquals, graphicTypeEquals, downloadDICOMData };
|
|
@@ -4,3 +4,6 @@ export { graphicTypeEquals } from './graphicTypeEquals.js';
|
|
|
4
4
|
export { downloadDICOMData } from './downloadDICOMData.js';
|
|
5
5
|
export { copyStudyTags } from './copyStudyTags.js';
|
|
6
6
|
export { copySeriesTags } from './copySeriesTags.js';
|
|
7
|
+
export { setWorldToImageCoords, toScoord, toScoords } from './toScoordType.js';
|
|
8
|
+
export { scoordToWorld } from './scoordToWorld.js';
|
|
9
|
+
export { toPoint3 } from './toPoint3.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
imageToWorldCoords
|
|
5
|
+
} = utilities;
|
|
6
|
+
function scoordToWorld(_ref, scoord) {
|
|
7
|
+
let {
|
|
8
|
+
is3DMeasurement,
|
|
9
|
+
referencedImageId
|
|
10
|
+
} = _ref;
|
|
11
|
+
const worldCoords = [];
|
|
12
|
+
if (is3DMeasurement) {
|
|
13
|
+
const {
|
|
14
|
+
GraphicData
|
|
15
|
+
} = scoord;
|
|
16
|
+
for (let i = 0; i < GraphicData.length; i += 3) {
|
|
17
|
+
const point = [GraphicData[i], GraphicData[i + 1], GraphicData[i + 2]];
|
|
18
|
+
worldCoords.push(point);
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
const {
|
|
22
|
+
GraphicData
|
|
23
|
+
} = scoord;
|
|
24
|
+
for (let i = 0; i < GraphicData.length; i += 2) {
|
|
25
|
+
const point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
26
|
+
worldCoords.push(point);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return worldCoords;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { scoordToWorld };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function toPoint3(flatPoints) {
|
|
2
|
+
const points = [];
|
|
3
|
+
if (!flatPoints?.length) {
|
|
4
|
+
return points;
|
|
5
|
+
}
|
|
6
|
+
const {
|
|
7
|
+
length: n
|
|
8
|
+
} = flatPoints;
|
|
9
|
+
if (n % 3 !== 0) {
|
|
10
|
+
throw new Error(`Points array should be divisible by 3 for SCOORD3D, but contents are: ${JSON.stringify(flatPoints)} of length ${n}`);
|
|
11
|
+
}
|
|
12
|
+
for (let i = 0; i < n; i += 3) {
|
|
13
|
+
points.push([flatPoints[i], flatPoints[i + 1], flatPoints[i + 2]]);
|
|
14
|
+
}
|
|
15
|
+
return points;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { toPoint3 as default, toPoint3 };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Types, utilities } from "@cornerstonejs/core";
|
|
2
|
+
export declare function toScoord({ is3DMeasurement, referencedImageId }: {
|
|
3
|
+
is3DMeasurement: any;
|
|
4
|
+
referencedImageId: any;
|
|
5
|
+
}, point: any): {
|
|
6
|
+
x: any;
|
|
7
|
+
y: any;
|
|
8
|
+
z: any;
|
|
9
|
+
} | {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z?: undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare function toScoords(scoordArgs: any, points: Array<Types.Point3>): ({
|
|
15
|
+
x: any;
|
|
16
|
+
y: any;
|
|
17
|
+
z: any;
|
|
18
|
+
} | {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
z?: undefined;
|
|
22
|
+
})[];
|
|
23
|
+
export declare function setWorldToImageCoords(worldToImage?: typeof utilities.worldToImageCoords): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
worldToImageCoords: globalWorldToImageCoords
|
|
5
|
+
} = utilities;
|
|
6
|
+
let useWorldToImageCoords = globalWorldToImageCoords;
|
|
7
|
+
function toScoord(_ref, point) {
|
|
8
|
+
let {
|
|
9
|
+
is3DMeasurement,
|
|
10
|
+
referencedImageId
|
|
11
|
+
} = _ref;
|
|
12
|
+
if (is3DMeasurement) {
|
|
13
|
+
return {
|
|
14
|
+
x: point[0],
|
|
15
|
+
y: point[1],
|
|
16
|
+
z: point[2]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const point2 = useWorldToImageCoords(referencedImageId, point);
|
|
20
|
+
return {
|
|
21
|
+
x: point2[0],
|
|
22
|
+
y: point2[1]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function toScoords(scoordArgs, points) {
|
|
26
|
+
return points.map(point => toScoord(scoordArgs, point));
|
|
27
|
+
}
|
|
28
|
+
function setWorldToImageCoords() {
|
|
29
|
+
let worldToImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalWorldToImageCoords;
|
|
30
|
+
useWorldToImageCoords = worldToImage;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { setWorldToImageCoords, toScoord, toScoords };
|
|
@@ -22,7 +22,7 @@ declare const adaptersSR: {
|
|
|
22
22
|
Length: typeof import("./Cornerstone3D/Length").default;
|
|
23
23
|
CircleROI: typeof import("./Cornerstone3D/CircleROI").default;
|
|
24
24
|
EllipticalROI: typeof import("./Cornerstone3D/EllipticalROI").default;
|
|
25
|
-
RectangleROI: typeof import("./Cornerstone3D/RectangleROI").
|
|
25
|
+
RectangleROI: typeof import("./Cornerstone3D/RectangleROI").RectangleROI;
|
|
26
26
|
ArrowAnnotate: typeof import("./Cornerstone3D/ArrowAnnotate").default;
|
|
27
27
|
Probe: typeof import("./Cornerstone3D/Probe").default;
|
|
28
28
|
PlanarFreehandROI: typeof import("./Cornerstone3D/PlanarFreehandROI").default;
|
|
@@ -36,6 +36,17 @@ declare const adaptersSR: {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
CORNERSTONE_3D_TAG: string;
|
|
39
|
+
COMMENT_CODE: {
|
|
40
|
+
schemeDesignator: string;
|
|
41
|
+
meaning: string;
|
|
42
|
+
value: string;
|
|
43
|
+
};
|
|
44
|
+
NO_IMAGE_ID: string;
|
|
45
|
+
TEXT_ANNOTATION_POSITION: {
|
|
46
|
+
schemeDesignator: string;
|
|
47
|
+
meaning: string;
|
|
48
|
+
value: string;
|
|
49
|
+
};
|
|
39
50
|
};
|
|
40
51
|
};
|
|
41
52
|
declare const adaptersSEG: {
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.0.0-beta.
|
|
1
|
+
export declare const version = "4.0.0-beta.5";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/adapters",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.5",
|
|
4
4
|
"description": "Adapters for Cornerstone3D to/from formats including DICOM SR and others",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -65,11 +65,10 @@
|
|
|
65
65
|
"clean:deep": "yarn run clean && shx rm -rf node_modules",
|
|
66
66
|
"dev": "rollup --watch -c rollup.config.mjs",
|
|
67
67
|
"build:all": "yarn build",
|
|
68
|
-
"format-check": "npx eslint ./src --quiet",
|
|
69
68
|
"api-check": "echo 'No API check for this package'",
|
|
70
69
|
"start": "rollup --watch -c rollup.config.mjs",
|
|
71
70
|
"format": "prettier --write 'src/**/*.js' 'test/**/*.js'",
|
|
72
|
-
"lint": "
|
|
71
|
+
"lint": "oxlint .",
|
|
73
72
|
"prebuild": "node ../../scripts/generate-version.js ./"
|
|
74
73
|
},
|
|
75
74
|
"repository": {
|
|
@@ -85,13 +84,13 @@
|
|
|
85
84
|
"dependencies": {
|
|
86
85
|
"@babel/runtime-corejs2": "^7.17.8",
|
|
87
86
|
"buffer": "^6.0.3",
|
|
88
|
-
"dcmjs": "^0.
|
|
87
|
+
"dcmjs": "^0.43.1",
|
|
89
88
|
"gl-matrix": "^3.4.3",
|
|
90
89
|
"ndarray": "^1.0.19"
|
|
91
90
|
},
|
|
92
91
|
"peerDependencies": {
|
|
93
|
-
"@cornerstonejs/core": "^4.0.0-beta.
|
|
94
|
-
"@cornerstonejs/tools": "^4.0.0-beta.
|
|
92
|
+
"@cornerstonejs/core": "^4.0.0-beta.5",
|
|
93
|
+
"@cornerstonejs/tools": "^4.0.0-beta.5"
|
|
95
94
|
},
|
|
96
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "c983ea46160362885b27f3c72cc84731cfe86b99"
|
|
97
96
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function compareArrays(array1: number[], array2: number[], tolerance: number): boolean;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { utilities } from 'dcmjs';
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
nearlyEqual
|
|
5
|
-
} = utilities.orientation;
|
|
6
|
-
function compareArrays(array1, array2, tolerance) {
|
|
7
|
-
if (array1.length !== array2.length) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
for (let i = 0; i < array1.length; ++i) {
|
|
11
|
-
if (!nearlyEqual(array1[i], array2[i], tolerance)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { compareArrays as default };
|