@cornerstonejs/adapters 0.3.0 → 0.3.2
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 +175 -196
- package/dist/@cornerstonejs/adapters.es.js.map +1 -1
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/EllipticalROI.d.ts +31 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/MeasurementReport.d.ts +5 -0
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/RectangleROI.d.ts +1 -1
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/index.d.ts +2 -1
- package/dist/@cornerstonejs/dts/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.d.ts +1 -0
- package/package.json +4 -3
- package/src/index.ts +0 -4
|
@@ -3289,6 +3289,17 @@ var __assign = function () {
|
|
|
3289
3289
|
|
|
3290
3290
|
return __assign.apply(this, arguments);
|
|
3291
3291
|
};
|
|
3292
|
+
function __spreadArray(to, from, pack) {
|
|
3293
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3294
|
+
if (ar || !(i in from)) {
|
|
3295
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3296
|
+
ar[i] = from[i];
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
var CORNERSTONE_3D_TAG = "Cornerstone3DTools@^0.1.0";
|
|
3292
3303
|
|
|
3293
3304
|
// This is a custom coding scheme defined to store some annotations from Cornerstone.
|
|
3294
3305
|
// Note: CodeMeaning is VR type LO, which means we only actually support 64 characters
|
|
@@ -3452,7 +3463,7 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3452
3463
|
// Loop through each image in the toolData
|
|
3453
3464
|
Object.keys(toolState).forEach(function (imageId) {
|
|
3454
3465
|
var sopCommonModule = metadataProvider.get("sopCommonModule", imageId);
|
|
3455
|
-
var instance = metadataProvider.
|
|
3466
|
+
var instance = metadataProvider.get("instance", imageId);
|
|
3456
3467
|
var sopInstanceUID = sopCommonModule.sopInstanceUID, sopClassUID = sopCommonModule.sopClassUID;
|
|
3457
3468
|
var seriesInstanceUID = instance.SeriesInstanceUID;
|
|
3458
3469
|
sopInstanceUIDsToSeriesInstanceUIDMap[sopInstanceUID] =
|
|
@@ -3541,12 +3552,17 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3541
3552
|
// That is up to the consumer to derive from the SOPInstanceUIDs.
|
|
3542
3553
|
return measurementData;
|
|
3543
3554
|
};
|
|
3555
|
+
/**
|
|
3556
|
+
* Register a new tool type.
|
|
3557
|
+
* @param toolClass to perform I/O to DICOM for this tool
|
|
3558
|
+
*/
|
|
3544
3559
|
MeasurementReport.registerTool = function (toolClass) {
|
|
3545
3560
|
MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE[toolClass.utilityToolType] = toolClass;
|
|
3546
3561
|
MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE[toolClass.toolType] = toolClass;
|
|
3547
3562
|
MeasurementReport.MEASUREMENT_BY_TOOLTYPE[toolClass.toolType] =
|
|
3548
3563
|
toolClass.utilityToolType;
|
|
3549
3564
|
};
|
|
3565
|
+
MeasurementReport.CORNERSTONE_3D_TAG = CORNERSTONE_3D_TAG;
|
|
3550
3566
|
MeasurementReport.MEASUREMENT_BY_TOOLTYPE = {};
|
|
3551
3567
|
MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE = {};
|
|
3552
3568
|
MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE = {};
|
|
@@ -3561,11 +3577,9 @@ var MeasurementReport = /** @class */ (function () {
|
|
|
3561
3577
|
return MeasurementReport;
|
|
3562
3578
|
}());
|
|
3563
3579
|
|
|
3564
|
-
var CORNERSTONE_3D_TAG = "Cornerstone3DTools@^0.1.0";
|
|
3565
|
-
|
|
3566
3580
|
var TID300Point$1 = utilities.TID300.Point;
|
|
3567
3581
|
var ARROW_ANNOTATE = "ArrowAnnotate";
|
|
3568
|
-
var trackingIdentifierTextValue$
|
|
3582
|
+
var trackingIdentifierTextValue$7 = "".concat(CORNERSTONE_3D_TAG, ":").concat(ARROW_ANNOTATE);
|
|
3569
3583
|
var codeValues = CodingScheme.codeValues,
|
|
3570
3584
|
CodingSchemeDesignator = CodingScheme.CodingSchemeDesignator;
|
|
3571
3585
|
|
|
@@ -3655,7 +3669,7 @@ var ArrowAnnotate = /*#__PURE__*/function () {
|
|
|
3655
3669
|
x: pointImage[0],
|
|
3656
3670
|
y: pointImage[1]
|
|
3657
3671
|
}],
|
|
3658
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
3672
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$7,
|
|
3659
3673
|
findingSites: findingSites || []
|
|
3660
3674
|
}; // If freetext finding isn't present, add it from the tool text.
|
|
3661
3675
|
|
|
@@ -3702,7 +3716,7 @@ var TID300Bidirectional = utilities.TID300.Bidirectional;
|
|
|
3702
3716
|
var BIDIRECTIONAL = "Bidirectional";
|
|
3703
3717
|
var LONG_AXIS = "Long Axis";
|
|
3704
3718
|
var SHORT_AXIS = "Short Axis";
|
|
3705
|
-
var trackingIdentifierTextValue$
|
|
3719
|
+
var trackingIdentifierTextValue$6 = "".concat(CORNERSTONE_3D_TAG, ":").concat(BIDIRECTIONAL);
|
|
3706
3720
|
var Bidirectional = /** @class */ (function () {
|
|
3707
3721
|
function Bidirectional() {
|
|
3708
3722
|
}
|
|
@@ -3805,7 +3819,7 @@ var Bidirectional = /** @class */ (function () {
|
|
|
3805
3819
|
},
|
|
3806
3820
|
longAxisLength: length,
|
|
3807
3821
|
shortAxisLength: width,
|
|
3808
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
3822
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$6,
|
|
3809
3823
|
finding: finding,
|
|
3810
3824
|
findingSites: findingSites || []
|
|
3811
3825
|
};
|
|
@@ -3829,7 +3843,7 @@ MeasurementReport.registerTool(Bidirectional);
|
|
|
3829
3843
|
|
|
3830
3844
|
var TID300CobbAngle$1 = utilities.TID300.CobbAngle;
|
|
3831
3845
|
var MEASUREMENT_TYPE$1 = "Angle";
|
|
3832
|
-
var trackingIdentifierTextValue$
|
|
3846
|
+
var trackingIdentifierTextValue$5 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE$1);
|
|
3833
3847
|
var Angle = /** @class */ (function () {
|
|
3834
3848
|
function Angle() {
|
|
3835
3849
|
}
|
|
@@ -3889,7 +3903,7 @@ var Angle = /** @class */ (function () {
|
|
|
3889
3903
|
point3: point3,
|
|
3890
3904
|
point4: point4,
|
|
3891
3905
|
rAngle: angle,
|
|
3892
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
3906
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$5,
|
|
3893
3907
|
finding: finding,
|
|
3894
3908
|
findingSites: findingSites || []
|
|
3895
3909
|
};
|
|
@@ -3913,7 +3927,7 @@ MeasurementReport.registerTool(Angle);
|
|
|
3913
3927
|
|
|
3914
3928
|
var TID300CobbAngle = utilities.TID300.CobbAngle;
|
|
3915
3929
|
var MEASUREMENT_TYPE = "CobbAngle";
|
|
3916
|
-
var trackingIdentifierTextValue$
|
|
3930
|
+
var trackingIdentifierTextValue$4 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE);
|
|
3917
3931
|
var CobbAngle = /** @class */ (function () {
|
|
3918
3932
|
function CobbAngle() {
|
|
3919
3933
|
}
|
|
@@ -3978,7 +3992,7 @@ var CobbAngle = /** @class */ (function () {
|
|
|
3978
3992
|
point3: point3,
|
|
3979
3993
|
point4: point4,
|
|
3980
3994
|
rAngle: angle,
|
|
3981
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue$
|
|
3995
|
+
trackingIdentifierTextValue: trackingIdentifierTextValue$4,
|
|
3982
3996
|
finding: finding,
|
|
3983
3997
|
findingSites: findingSites || []
|
|
3984
3998
|
};
|
|
@@ -4000,192 +4014,151 @@ var CobbAngle = /** @class */ (function () {
|
|
|
4000
4014
|
}());
|
|
4001
4015
|
MeasurementReport.registerTool(CobbAngle);
|
|
4002
4016
|
|
|
4017
|
+
function isValidCornerstoneTrackingIdentifier(trackingIdentifier) {
|
|
4018
|
+
if (!trackingIdentifier.includes(":")) {
|
|
4019
|
+
return false;
|
|
4020
|
+
}
|
|
4021
|
+
var _a = trackingIdentifier.split(":"), cornerstone3DTag = _a[0], toolType = _a[1];
|
|
4022
|
+
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
4023
|
+
return false;
|
|
4024
|
+
}
|
|
4025
|
+
// The following is needed since the new cornerstone3D has changed
|
|
4026
|
+
// case names such as EllipticalRoi to EllipticalROI
|
|
4027
|
+
return toolType.toLowerCase() === this.toolType.toLowerCase();
|
|
4028
|
+
}
|
|
4029
|
+
|
|
4003
4030
|
var TID300Ellipse = utilities.TID300.Ellipse;
|
|
4004
4031
|
var ELLIPTICALROI = "EllipticalROI";
|
|
4005
4032
|
var EPSILON = 1e-4;
|
|
4006
|
-
var
|
|
4007
|
-
|
|
4008
|
-
var EllipticalROI = /*#__PURE__*/function () {
|
|
4009
|
-
function EllipticalROI() {
|
|
4010
|
-
_classCallCheck(this, EllipticalROI);
|
|
4011
|
-
}
|
|
4012
|
-
|
|
4013
|
-
_createClass(EllipticalROI, null, [{
|
|
4014
|
-
key: "getMeasurementData",
|
|
4015
|
-
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4016
|
-
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, EllipticalROI.toolType),
|
|
4017
|
-
defaultState = _MeasurementReport$ge.defaultState,
|
|
4018
|
-
NUMGroup = _MeasurementReport$ge.NUMGroup,
|
|
4019
|
-
SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
|
|
4020
|
-
ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
|
|
4021
|
-
|
|
4022
|
-
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4023
|
-
var GraphicData = SCOORDGroup.GraphicData; // GraphicData is ordered as [majorAxisStartX, majorAxisStartY, majorAxisEndX, majorAxisEndY, minorAxisStartX, minorAxisStartY, minorAxisEndX, minorAxisEndY]
|
|
4024
|
-
// But Cornerstone3D points are ordered as top, bottom, left, right for the
|
|
4025
|
-
// ellipse so we need to identify if the majorAxis is horizontal or vertical
|
|
4026
|
-
// in the image plane and then choose the correct points to use for the ellipse.
|
|
4027
|
-
|
|
4028
|
-
var pointsWorld = [];
|
|
4029
|
-
|
|
4030
|
-
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
4031
|
-
var worldPos = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
4032
|
-
pointsWorld.push(worldPos);
|
|
4033
|
-
}
|
|
4034
|
-
|
|
4035
|
-
var majorAxisStart = vec3.fromValues.apply(vec3, _toConsumableArray(pointsWorld[0]));
|
|
4036
|
-
var majorAxisEnd = vec3.fromValues.apply(vec3, _toConsumableArray(pointsWorld[1]));
|
|
4037
|
-
var minorAxisStart = vec3.fromValues.apply(vec3, _toConsumableArray(pointsWorld[2]));
|
|
4038
|
-
var minorAxisEnd = vec3.fromValues.apply(vec3, _toConsumableArray(pointsWorld[3]));
|
|
4039
|
-
var majorAxisVec = vec3.create();
|
|
4040
|
-
vec3.sub(majorAxisVec, majorAxisEnd, majorAxisStart); // normalize majorAxisVec to avoid scaling issues
|
|
4041
|
-
|
|
4042
|
-
vec3.normalize(majorAxisVec, majorAxisVec);
|
|
4043
|
-
var minorAxisVec = vec3.create();
|
|
4044
|
-
vec3.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
|
|
4045
|
-
vec3.normalize(minorAxisVec, minorAxisVec);
|
|
4046
|
-
var imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
|
|
4047
|
-
|
|
4048
|
-
if (!imagePlaneModule) {
|
|
4049
|
-
throw new Error("imageId does not have imagePlaneModule metadata");
|
|
4050
|
-
}
|
|
4051
|
-
|
|
4052
|
-
var columnCosines = imagePlaneModule.columnCosines; // find which axis is parallel to the columnCosines
|
|
4053
|
-
|
|
4054
|
-
var columnCosinesVec = vec3.fromValues.apply(vec3, _toConsumableArray(columnCosines));
|
|
4055
|
-
var projectedMajorAxisOnColVec = vec3.dot(columnCosinesVec, majorAxisVec);
|
|
4056
|
-
var projectedMinorAxisOnColVec = vec3.dot(columnCosinesVec, minorAxisVec);
|
|
4057
|
-
var absoluteOfMajorDotProduct = Math.abs(projectedMajorAxisOnColVec);
|
|
4058
|
-
var absoluteOfMinorDotProduct = Math.abs(projectedMinorAxisOnColVec);
|
|
4059
|
-
var ellipsePoints = [];
|
|
4060
|
-
|
|
4061
|
-
if (Math.abs(absoluteOfMajorDotProduct - 1) < EPSILON) {
|
|
4062
|
-
ellipsePoints = [pointsWorld[0], pointsWorld[1], pointsWorld[2], pointsWorld[3]];
|
|
4063
|
-
} else if (Math.abs(absoluteOfMinorDotProduct - 1) < EPSILON) {
|
|
4064
|
-
ellipsePoints = [pointsWorld[2], pointsWorld[3], pointsWorld[0], pointsWorld[1]];
|
|
4065
|
-
} else {
|
|
4066
|
-
console.warn("OBLIQUE ELLIPSE NOT YET SUPPORTED");
|
|
4067
|
-
}
|
|
4068
|
-
|
|
4069
|
-
var state = defaultState;
|
|
4070
|
-
state.annotation.data = {
|
|
4071
|
-
handles: {
|
|
4072
|
-
points: _toConsumableArray(ellipsePoints),
|
|
4073
|
-
activeHandleIndex: 0,
|
|
4074
|
-
textBox: {
|
|
4075
|
-
hasMoved: false
|
|
4076
|
-
}
|
|
4077
|
-
},
|
|
4078
|
-
cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
|
|
4079
|
-
area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0
|
|
4080
|
-
}),
|
|
4081
|
-
frameNumber: ReferencedFrameNumber
|
|
4082
|
-
};
|
|
4083
|
-
return state;
|
|
4033
|
+
var EllipticalROI = /** @class */ (function () {
|
|
4034
|
+
function EllipticalROI() {
|
|
4084
4035
|
}
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4036
|
+
EllipticalROI.getMeasurementData = function (MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4037
|
+
var _a;
|
|
4038
|
+
var _b = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, EllipticalROI.toolType), defaultState = _b.defaultState, NUMGroup = _b.NUMGroup, SCOORDGroup = _b.SCOORDGroup, ReferencedFrameNumber = _b.ReferencedFrameNumber;
|
|
4039
|
+
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4040
|
+
var GraphicData = SCOORDGroup.GraphicData;
|
|
4041
|
+
// GraphicData is ordered as [majorAxisStartX, majorAxisStartY, majorAxisEndX, majorAxisEndY, minorAxisStartX, minorAxisStartY, minorAxisEndX, minorAxisEndY]
|
|
4042
|
+
// But Cornerstone3D points are ordered as top, bottom, left, right for the
|
|
4043
|
+
// ellipse so we need to identify if the majorAxis is horizontal or vertical
|
|
4044
|
+
// in the image plane and then choose the correct points to use for the ellipse.
|
|
4045
|
+
var pointsWorld = [];
|
|
4046
|
+
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
4047
|
+
var worldPos = imageToWorldCoords(referencedImageId, [
|
|
4048
|
+
GraphicData[i],
|
|
4049
|
+
GraphicData[i + 1]
|
|
4050
|
+
]);
|
|
4051
|
+
pointsWorld.push(worldPos);
|
|
4052
|
+
}
|
|
4053
|
+
var majorAxisStart = vec3.fromValues.apply(vec3, pointsWorld[0]);
|
|
4054
|
+
var majorAxisEnd = vec3.fromValues.apply(vec3, pointsWorld[1]);
|
|
4055
|
+
var minorAxisStart = vec3.fromValues.apply(vec3, pointsWorld[2]);
|
|
4056
|
+
var minorAxisEnd = vec3.fromValues.apply(vec3, pointsWorld[3]);
|
|
4057
|
+
var majorAxisVec = vec3.create();
|
|
4058
|
+
vec3.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
|
|
4059
|
+
// normalize majorAxisVec to avoid scaling issues
|
|
4060
|
+
vec3.normalize(majorAxisVec, majorAxisVec);
|
|
4061
|
+
var minorAxisVec = vec3.create();
|
|
4062
|
+
vec3.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
|
|
4063
|
+
vec3.normalize(minorAxisVec, minorAxisVec);
|
|
4064
|
+
var imagePlaneModule = metadata.get("imagePlaneModule", referencedImageId);
|
|
4065
|
+
if (!imagePlaneModule) {
|
|
4066
|
+
throw new Error("imageId does not have imagePlaneModule metadata");
|
|
4067
|
+
}
|
|
4068
|
+
var columnCosines = imagePlaneModule.columnCosines;
|
|
4069
|
+
// find which axis is parallel to the columnCosines
|
|
4070
|
+
var columnCosinesVec = vec3.fromValues.apply(vec3, columnCosines);
|
|
4071
|
+
var projectedMajorAxisOnColVec = vec3.dot(columnCosinesVec, majorAxisVec);
|
|
4072
|
+
var projectedMinorAxisOnColVec = vec3.dot(columnCosinesVec, minorAxisVec);
|
|
4073
|
+
var absoluteOfMajorDotProduct = Math.abs(projectedMajorAxisOnColVec);
|
|
4074
|
+
var absoluteOfMinorDotProduct = Math.abs(projectedMinorAxisOnColVec);
|
|
4075
|
+
var ellipsePoints = [];
|
|
4076
|
+
if (Math.abs(absoluteOfMajorDotProduct - 1) < EPSILON) {
|
|
4077
|
+
ellipsePoints = [
|
|
4078
|
+
pointsWorld[0],
|
|
4079
|
+
pointsWorld[1],
|
|
4080
|
+
pointsWorld[2],
|
|
4081
|
+
pointsWorld[3]
|
|
4082
|
+
];
|
|
4083
|
+
}
|
|
4084
|
+
else if (Math.abs(absoluteOfMinorDotProduct - 1) < EPSILON) {
|
|
4085
|
+
ellipsePoints = [
|
|
4086
|
+
pointsWorld[2],
|
|
4087
|
+
pointsWorld[3],
|
|
4088
|
+
pointsWorld[0],
|
|
4089
|
+
pointsWorld[1]
|
|
4090
|
+
];
|
|
4091
|
+
}
|
|
4092
|
+
else {
|
|
4093
|
+
console.warn("OBLIQUE ELLIPSE NOT YET SUPPORTED");
|
|
4094
|
+
}
|
|
4095
|
+
var state = defaultState;
|
|
4096
|
+
state.annotation.data = {
|
|
4097
|
+
handles: {
|
|
4098
|
+
points: __spreadArray([], ellipsePoints, true),
|
|
4099
|
+
activeHandleIndex: 0,
|
|
4100
|
+
textBox: {
|
|
4101
|
+
hasMoved: false
|
|
4102
|
+
}
|
|
4103
|
+
},
|
|
4104
|
+
cachedStats: (_a = {},
|
|
4105
|
+
_a["imageId:".concat(referencedImageId)] = {
|
|
4106
|
+
area: NUMGroup
|
|
4107
|
+
? NUMGroup.MeasuredValueSequence.NumericValue
|
|
4108
|
+
: 0
|
|
4109
|
+
},
|
|
4110
|
+
_a),
|
|
4111
|
+
frameNumber: ReferencedFrameNumber
|
|
4112
|
+
};
|
|
4113
|
+
return state;
|
|
4114
|
+
};
|
|
4115
|
+
EllipticalROI.getTID300RepresentationArguments = function (tool, worldToImageCoords) {
|
|
4116
|
+
var data = tool.data, finding = tool.finding, findingSites = tool.findingSites, metadata = tool.metadata;
|
|
4117
|
+
var _a = data.cachedStats, cachedStats = _a === void 0 ? {} : _a, handles = data.handles;
|
|
4118
|
+
var referencedImageId = metadata.referencedImageId;
|
|
4119
|
+
if (!referencedImageId) {
|
|
4120
|
+
throw new Error("EllipticalROI.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
4121
|
+
}
|
|
4122
|
+
var top = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
4123
|
+
var bottom = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
4124
|
+
var left = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
4125
|
+
var right = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
4126
|
+
// find the major axis and minor axis
|
|
4127
|
+
var topBottomLength = Math.abs(top[1] - bottom[1]);
|
|
4128
|
+
var leftRightLength = Math.abs(left[0] - right[0]);
|
|
4129
|
+
var points = [];
|
|
4130
|
+
if (topBottomLength > leftRightLength) {
|
|
4131
|
+
// major axis is bottom to top
|
|
4132
|
+
points.push({ x: top[0], y: top[1] });
|
|
4133
|
+
points.push({ x: bottom[0], y: bottom[1] });
|
|
4134
|
+
// minor axis is left to right
|
|
4135
|
+
points.push({ x: left[0], y: left[1] });
|
|
4136
|
+
points.push({ x: right[0], y: right[1] });
|
|
4137
|
+
}
|
|
4138
|
+
else {
|
|
4139
|
+
// major axis is left to right
|
|
4140
|
+
points.push({ x: left[0], y: left[1] });
|
|
4141
|
+
points.push({ x: right[0], y: right[1] });
|
|
4142
|
+
// minor axis is bottom to top
|
|
4143
|
+
points.push({ x: top[0], y: top[1] });
|
|
4144
|
+
points.push({ x: bottom[0], y: bottom[1] });
|
|
4145
|
+
}
|
|
4146
|
+
var area = (cachedStats["imageId:".concat(referencedImageId)] || {}).area;
|
|
4147
|
+
return {
|
|
4148
|
+
area: area,
|
|
4149
|
+
points: points,
|
|
4150
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
4151
|
+
finding: finding,
|
|
4152
|
+
findingSites: findingSites || []
|
|
4153
|
+
};
|
|
4154
|
+
};
|
|
4155
|
+
EllipticalROI.trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(ELLIPTICALROI);
|
|
4156
|
+
EllipticalROI.toolType = ELLIPTICALROI;
|
|
4157
|
+
EllipticalROI.utilityToolType = ELLIPTICALROI;
|
|
4158
|
+
EllipticalROI.TID300Representation = TID300Ellipse;
|
|
4159
|
+
EllipticalROI.isValidCornerstoneTrackingIdentifier = isValidCornerstoneTrackingIdentifier;
|
|
4160
|
+
return EllipticalROI;
|
|
4161
|
+
}());
|
|
4189
4162
|
MeasurementReport.registerTool(EllipticalROI);
|
|
4190
4163
|
|
|
4191
4164
|
var TID300Polyline$1 = utilities.TID300.Polyline;
|
|
@@ -4213,8 +4186,8 @@ var RectangleROI = /** @class */ (function () {
|
|
|
4213
4186
|
points: [
|
|
4214
4187
|
worldCoords[0],
|
|
4215
4188
|
worldCoords[1],
|
|
4216
|
-
worldCoords[
|
|
4217
|
-
worldCoords[
|
|
4189
|
+
worldCoords[3],
|
|
4190
|
+
worldCoords[2]
|
|
4218
4191
|
],
|
|
4219
4192
|
activeHandleIndex: 0,
|
|
4220
4193
|
textBox: {
|
|
@@ -4244,7 +4217,13 @@ var RectangleROI = /** @class */ (function () {
|
|
|
4244
4217
|
});
|
|
4245
4218
|
var area = cachedStats.area, perimeter = cachedStats.perimeter;
|
|
4246
4219
|
return {
|
|
4247
|
-
points:
|
|
4220
|
+
points: [
|
|
4221
|
+
corners[0],
|
|
4222
|
+
corners[1],
|
|
4223
|
+
corners[3],
|
|
4224
|
+
corners[2],
|
|
4225
|
+
corners[0]
|
|
4226
|
+
],
|
|
4248
4227
|
area: area,
|
|
4249
4228
|
perimeter: perimeter,
|
|
4250
4229
|
trackingIdentifierTextValue: trackingIdentifierTextValue$3,
|