@cornerstonejs/adapters 0.4.1 → 0.5.0
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/@cornerstonejs/adapters.es.js +106 -11
- package/dist/@cornerstonejs/adapters.es.js.map +1 -1
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/Angle.d.ts +1 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/Bidirectional.d.ts +1 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/CircleROI.d.ts +41 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/CobbAngle.d.ts +1 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/EllipticalROI.d.ts +1 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/MeasurementReport.d.ts +1 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +1 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/RectangleROI.d.ts +1 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/index.d.ts +2 -0
- package/package.json +3 -3
|
@@ -1028,8 +1028,8 @@ EllipticalRoi.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifie
|
|
|
1028
1028
|
|
|
1029
1029
|
MeasurementReport$1.registerTool(EllipticalRoi);
|
|
1030
1030
|
|
|
1031
|
-
var TID300Circle = utilities.TID300.Circle;
|
|
1032
|
-
var CIRCLEROI = "CircleRoi";
|
|
1031
|
+
var TID300Circle$1 = utilities.TID300.Circle;
|
|
1032
|
+
var CIRCLEROI$1 = "CircleRoi";
|
|
1033
1033
|
|
|
1034
1034
|
var CircleRoi = /*#__PURE__*/function () {
|
|
1035
1035
|
function CircleRoi() {
|
|
@@ -1128,9 +1128,9 @@ var CircleRoi = /*#__PURE__*/function () {
|
|
|
1128
1128
|
return CircleRoi;
|
|
1129
1129
|
}();
|
|
1130
1130
|
|
|
1131
|
-
CircleRoi.toolType = CIRCLEROI;
|
|
1132
|
-
CircleRoi.utilityToolType = CIRCLEROI;
|
|
1133
|
-
CircleRoi.TID300Representation = TID300Circle;
|
|
1131
|
+
CircleRoi.toolType = CIRCLEROI$1;
|
|
1132
|
+
CircleRoi.utilityToolType = CIRCLEROI$1;
|
|
1133
|
+
CircleRoi.TID300Representation = TID300Circle$1;
|
|
1134
1134
|
|
|
1135
1135
|
CircleRoi.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
1136
1136
|
if (!TrackingIdentifier.includes(":")) {
|
|
@@ -1146,7 +1146,7 @@ CircleRoi.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
|
1146
1146
|
return false;
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
|
-
return toolType === CIRCLEROI;
|
|
1149
|
+
return toolType === CIRCLEROI$1;
|
|
1150
1150
|
};
|
|
1151
1151
|
|
|
1152
1152
|
MeasurementReport$1.registerTool(CircleRoi);
|
|
@@ -3428,7 +3428,8 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3428
3428
|
referencedImageId: referencedImageId,
|
|
3429
3429
|
FrameOfReferenceUID: imagePlaneModule.frameOfReferenceUID,
|
|
3430
3430
|
label: ""
|
|
3431
|
-
}
|
|
3431
|
+
},
|
|
3432
|
+
data: undefined
|
|
3432
3433
|
},
|
|
3433
3434
|
finding: finding,
|
|
3434
3435
|
findingSites: findingSites
|
|
@@ -4032,6 +4033,88 @@ function isValidCornerstoneTrackingIdentifier(trackingIdentifier) {
|
|
|
4032
4033
|
return toolType.toLowerCase() === this.toolType.toLowerCase();
|
|
4033
4034
|
}
|
|
4034
4035
|
|
|
4036
|
+
var TID300Circle = utilities.TID300.Circle;
|
|
4037
|
+
var CIRCLEROI = "CircleROI";
|
|
4038
|
+
var CircleROI = /** @class */ (function () {
|
|
4039
|
+
function CircleROI() {
|
|
4040
|
+
}
|
|
4041
|
+
/** Gets the measurement data for cornerstone, given DICOM SR measurement data. */
|
|
4042
|
+
CircleROI.getMeasurementData = function (MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4043
|
+
var _a;
|
|
4044
|
+
var _b = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CircleROI.toolType), defaultState = _b.defaultState, NUMGroup = _b.NUMGroup, SCOORDGroup = _b.SCOORDGroup, ReferencedFrameNumber = _b.ReferencedFrameNumber;
|
|
4045
|
+
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4046
|
+
var GraphicData = SCOORDGroup.GraphicData;
|
|
4047
|
+
// GraphicData is ordered as [centerX, centerY, endX, endY]
|
|
4048
|
+
var pointsWorld = [];
|
|
4049
|
+
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
4050
|
+
var worldPos = imageToWorldCoords(referencedImageId, [
|
|
4051
|
+
GraphicData[i],
|
|
4052
|
+
GraphicData[i + 1]
|
|
4053
|
+
]);
|
|
4054
|
+
pointsWorld.push(worldPos);
|
|
4055
|
+
}
|
|
4056
|
+
var state = defaultState;
|
|
4057
|
+
state.annotation.data = {
|
|
4058
|
+
handles: {
|
|
4059
|
+
points: __spreadArray([], pointsWorld, true),
|
|
4060
|
+
activeHandleIndex: 0,
|
|
4061
|
+
textBox: {
|
|
4062
|
+
hasMoved: false
|
|
4063
|
+
}
|
|
4064
|
+
},
|
|
4065
|
+
cachedStats: (_a = {},
|
|
4066
|
+
_a["imageId:".concat(referencedImageId)] = {
|
|
4067
|
+
area: NUMGroup
|
|
4068
|
+
? NUMGroup.MeasuredValueSequence.NumericValue
|
|
4069
|
+
: 0,
|
|
4070
|
+
// Dummy values to be updated by cornerstone
|
|
4071
|
+
radius: 0,
|
|
4072
|
+
perimeter: 0
|
|
4073
|
+
},
|
|
4074
|
+
_a),
|
|
4075
|
+
frameNumber: ReferencedFrameNumber
|
|
4076
|
+
};
|
|
4077
|
+
return state;
|
|
4078
|
+
};
|
|
4079
|
+
/**
|
|
4080
|
+
* Gets the TID 300 representation of a circle, given the cornerstone representation.
|
|
4081
|
+
*
|
|
4082
|
+
* @param {Object} tool
|
|
4083
|
+
* @returns
|
|
4084
|
+
*/
|
|
4085
|
+
CircleROI.getTID300RepresentationArguments = function (tool, worldToImageCoords) {
|
|
4086
|
+
var data = tool.data, finding = tool.finding, findingSites = tool.findingSites, metadata = tool.metadata;
|
|
4087
|
+
var _a = data.cachedStats, cachedStats = _a === void 0 ? {} : _a, handles = data.handles;
|
|
4088
|
+
var referencedImageId = metadata.referencedImageId;
|
|
4089
|
+
if (!referencedImageId) {
|
|
4090
|
+
throw new Error("CircleROI.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
4091
|
+
}
|
|
4092
|
+
var center = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
4093
|
+
var end = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
4094
|
+
var points = [];
|
|
4095
|
+
points.push({ x: center[0], y: center[1] });
|
|
4096
|
+
points.push({ x: end[0], y: end[1] });
|
|
4097
|
+
var _b = cachedStats["imageId:".concat(referencedImageId)] || {}, area = _b.area, radius = _b.radius;
|
|
4098
|
+
var perimeter = 2 * Math.PI * radius;
|
|
4099
|
+
return {
|
|
4100
|
+
area: area,
|
|
4101
|
+
perimeter: perimeter,
|
|
4102
|
+
radius: radius,
|
|
4103
|
+
points: points,
|
|
4104
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
4105
|
+
finding: finding,
|
|
4106
|
+
findingSites: findingSites || []
|
|
4107
|
+
};
|
|
4108
|
+
};
|
|
4109
|
+
CircleROI.trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(CIRCLEROI);
|
|
4110
|
+
CircleROI.toolType = CIRCLEROI;
|
|
4111
|
+
CircleROI.utilityToolType = CIRCLEROI;
|
|
4112
|
+
CircleROI.TID300Representation = TID300Circle;
|
|
4113
|
+
CircleROI.isValidCornerstoneTrackingIdentifier = isValidCornerstoneTrackingIdentifier;
|
|
4114
|
+
return CircleROI;
|
|
4115
|
+
}());
|
|
4116
|
+
MeasurementReport.registerTool(CircleROI);
|
|
4117
|
+
|
|
4035
4118
|
var TID300Ellipse = utilities.TID300.Ellipse;
|
|
4036
4119
|
var ELLIPTICALROI = "EllipticalROI";
|
|
4037
4120
|
var EPSILON = 1e-4;
|
|
@@ -4120,14 +4203,25 @@ var EllipticalROI = /** @class */ (function () {
|
|
|
4120
4203
|
EllipticalROI.getTID300RepresentationArguments = function (tool, worldToImageCoords) {
|
|
4121
4204
|
var data = tool.data, finding = tool.finding, findingSites = tool.findingSites, metadata = tool.metadata;
|
|
4122
4205
|
var _a = data.cachedStats, cachedStats = _a === void 0 ? {} : _a, handles = data.handles;
|
|
4206
|
+
var rotation = data.initialRotation || 0;
|
|
4123
4207
|
var referencedImageId = metadata.referencedImageId;
|
|
4124
4208
|
if (!referencedImageId) {
|
|
4125
4209
|
throw new Error("EllipticalROI.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
4126
4210
|
}
|
|
4127
|
-
var top
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4211
|
+
var top, bottom, left, right;
|
|
4212
|
+
// this way when it's restored we can assume the initial rotation is 0.
|
|
4213
|
+
if (rotation == 90 || rotation == 270) {
|
|
4214
|
+
bottom = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
4215
|
+
top = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
4216
|
+
left = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
4217
|
+
right = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
4218
|
+
}
|
|
4219
|
+
else {
|
|
4220
|
+
top = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
4221
|
+
bottom = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
4222
|
+
left = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
4223
|
+
right = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
4224
|
+
}
|
|
4131
4225
|
// find the major axis and minor axis
|
|
4132
4226
|
var topBottomLength = Math.abs(top[1] - bottom[1]);
|
|
4133
4227
|
var leftRightLength = Math.abs(left[0] - right[0]);
|
|
@@ -4554,6 +4648,7 @@ var Cornerstone3D = {
|
|
|
4554
4648
|
CobbAngle: CobbAngle,
|
|
4555
4649
|
Angle: Angle,
|
|
4556
4650
|
Length: Length,
|
|
4651
|
+
CircleROI: CircleROI,
|
|
4557
4652
|
EllipticalROI: EllipticalROI,
|
|
4558
4653
|
RectangleROI: RectangleROI,
|
|
4559
4654
|
ArrowAnnotate: ArrowAnnotate,
|