@cornerstonejs/adapters 2.0.0-beta.25 → 2.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/adapters/Cornerstone/Angle.d.ts +0 -3
- package/dist/esm/adapters/Cornerstone/CircleRoi.d.ts +0 -7
- package/dist/esm/adapters/Cornerstone/MeasurementReport.d.ts +0 -7
- package/dist/esm/adapters/Cornerstone/ParametricMap.js +2 -8
- package/dist/esm/adapters/Cornerstone/Segmentation.d.ts +0 -31
- package/dist/esm/adapters/Cornerstone/Segmentation_3X.d.ts +0 -32
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.d.ts +0 -41
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +0 -1
- package/dist/esm/adapters/Cornerstone3D/Angle.js +9 -10
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +8 -7
- package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +0 -7
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +9 -16
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +9 -9
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +8 -18
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +0 -7
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +7 -40
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +0 -2
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +9 -12
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.d.ts +0 -23
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.js +1 -76
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +8 -6
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.d.ts +0 -6
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.js +0 -11
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.d.ts +0 -6
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.js +0 -18
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.d.ts +0 -14
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.js +0 -14
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +9 -9
- package/dist/esm/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.js +0 -2
- package/dist/esm/adapters/VTKjs/Segmentation.d.ts +0 -38
- package/dist/esm/adapters/enums/Events.d.ts +0 -6
- package/dist/esm/adapters/enums/Events.js +0 -6
- package/dist/esm/adapters/helpers/checkIfPerpendicular.d.ts +0 -8
- package/dist/esm/adapters/helpers/checkIfPerpendicular.js +0 -8
- package/dist/esm/adapters/helpers/checkOrientation.js +0 -2
- package/dist/esm/adapters/helpers/codeMeaningEquals.d.ts +0 -7
- package/dist/esm/adapters/helpers/codeMeaningEquals.js +0 -7
- package/dist/esm/adapters/helpers/compareArrays.d.ts +0 -8
- package/dist/esm/adapters/helpers/compareArrays.js +0 -8
- package/dist/esm/adapters/helpers/downloadDICOMData.d.ts +0 -5
- package/dist/esm/adapters/helpers/downloadDICOMData.js +0 -5
- package/dist/esm/adapters/helpers/getDatasetsFromImages.d.ts +0 -8
- package/dist/esm/adapters/helpers/getDatasetsFromImages.js +0 -8
- package/dist/esm/adapters/helpers/graphicTypeEquals.d.ts +0 -5
- package/dist/esm/adapters/helpers/graphicTypeEquals.js +0 -5
- package/dist/esm/adapters/index.js +0 -1
- package/dist/umd/adapters.umd.js +74 -301
- package/dist/umd/adapters.umd.js.map +1 -1
- package/package.json +41 -16
- package/dist/esm/node_modules/lodash.clonedeep/index.js +0 -1692
package/dist/umd/adapters.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('dcmjs'), require('buffer'), require('ndarray'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'dcmjs', 'buffer', 'ndarray', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Adapters = {}, global.dcmjs, global.buffer, global.ndarray, global.
|
|
5
|
-
})(this, (function (exports, dcmjs, buffer, ndarray,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('dcmjs'), require('buffer'), require('ndarray'), require('gl-matrix'), require('@cornerstonejs/tools')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'dcmjs', 'buffer', 'ndarray', 'gl-matrix', '@cornerstonejs/tools'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Adapters = {}, global.dcmjs, global.buffer, global.ndarray, global.glMatrix, global.cornerstoneTools));
|
|
5
|
+
})(this, (function (exports, dcmjs, buffer, ndarray, glMatrix, tools) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _arrayLikeToArray(r, a) {
|
|
8
8
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -500,24 +500,12 @@
|
|
|
500
500
|
return Array.isArray(x) ? x : [x];
|
|
501
501
|
};
|
|
502
502
|
|
|
503
|
-
/**
|
|
504
|
-
* Returns a function that checks if a given content item's ConceptNameCodeSequence.CodeMeaning
|
|
505
|
-
* matches the provided codeMeaningName.
|
|
506
|
-
* @param codeMeaningName - The CodeMeaning to match against.
|
|
507
|
-
* @returns A function that takes a content item and returns a boolean indicating whether the
|
|
508
|
-
* content item's CodeMeaning matches the provided codeMeaningName.
|
|
509
|
-
*/
|
|
510
503
|
var codeMeaningEquals = function codeMeaningEquals(codeMeaningName) {
|
|
511
504
|
return function (contentItem) {
|
|
512
505
|
return contentItem.ConceptNameCodeSequence.CodeMeaning === codeMeaningName;
|
|
513
506
|
};
|
|
514
507
|
};
|
|
515
508
|
|
|
516
|
-
/**
|
|
517
|
-
* Checks if a given content item's GraphicType property matches a specified value.
|
|
518
|
-
* @param {string} graphicType - The value to compare the content item's GraphicType property to.
|
|
519
|
-
* @returns {function} A function that takes a content item and returns a boolean indicating whether its GraphicType property matches the specified value.
|
|
520
|
-
*/
|
|
521
509
|
var graphicTypeEquals = function graphicTypeEquals(graphicType) {
|
|
522
510
|
return function (contentItem) {
|
|
523
511
|
return contentItem && contentItem.GraphicType === graphicType;
|
|
@@ -525,11 +513,6 @@
|
|
|
525
513
|
};
|
|
526
514
|
|
|
527
515
|
var datasetToDict = dcmjs.data.datasetToDict;
|
|
528
|
-
/**
|
|
529
|
-
* Trigger file download from an array buffer
|
|
530
|
-
* @param bufferOrDataset - ArrayBuffer or DicomDataset
|
|
531
|
-
* @param filename - name of the file to download
|
|
532
|
-
*/
|
|
533
516
|
function downloadDICOMData(bufferOrDataset, filename) {
|
|
534
517
|
var blob;
|
|
535
518
|
if (bufferOrDataset instanceof ArrayBuffer) {
|
|
@@ -1796,14 +1779,6 @@
|
|
|
1796
1779
|
var DicomMessage$3 = dcmjs.data.DicomMessage,
|
|
1797
1780
|
DicomMetaDictionary$5 = dcmjs.data.DicomMetaDictionary;
|
|
1798
1781
|
var Normalizer$5 = dcmjs.normalizers.Normalizer;
|
|
1799
|
-
/**
|
|
1800
|
-
* Convert an array of cornerstone images into datasets
|
|
1801
|
-
*
|
|
1802
|
-
* @param images - An array of the cornerstone image objects
|
|
1803
|
-
* @param isMultiframe - Whether the images are multiframe
|
|
1804
|
-
* @param options - Options object that may contain:
|
|
1805
|
-
* - SpecificCharacterSet: character set to be set to each dataset
|
|
1806
|
-
*/
|
|
1807
1782
|
function getDatasetsFromImages(images, isMultiframe, options) {
|
|
1808
1783
|
var datasets = [];
|
|
1809
1784
|
if (isMultiframe) {
|
|
@@ -2236,14 +2211,6 @@
|
|
|
2236
2211
|
};
|
|
2237
2212
|
}
|
|
2238
2213
|
|
|
2239
|
-
/**
|
|
2240
|
-
* Returns true if iop1 and iop2 are perpendicular within a tolerance.
|
|
2241
|
-
*
|
|
2242
|
-
* @param iop1 - First ImageOrientationPatient
|
|
2243
|
-
* @param iop2 - Second ImageOrientationPatient
|
|
2244
|
-
* @param tolerance - Tolerance
|
|
2245
|
-
* @returns True if iop1 and iop2 are equal.
|
|
2246
|
-
*/
|
|
2247
2214
|
function checkIfPerpendicular(iop1, iop2, tolerance) {
|
|
2248
2215
|
var absDotColumnCosines = Math.abs(iop1[0] * iop2[0] + iop1[1] * iop2[1] + iop1[2] * iop2[2]);
|
|
2249
2216
|
var absDotRowCosines = Math.abs(iop1[3] * iop2[3] + iop1[4] * iop2[4] + iop1[5] * iop2[5]);
|
|
@@ -2251,14 +2218,6 @@
|
|
|
2251
2218
|
}
|
|
2252
2219
|
|
|
2253
2220
|
var nearlyEqual = dcmjs.utilities.orientation.nearlyEqual;
|
|
2254
|
-
/**
|
|
2255
|
-
* Returns true if array1 and array2 are equal within a tolerance.
|
|
2256
|
-
*
|
|
2257
|
-
* @param array1 - First array
|
|
2258
|
-
* @param array2 - Second array
|
|
2259
|
-
* @param tolerance - Tolerance
|
|
2260
|
-
* @returns True if array1 and array2 are equal.
|
|
2261
|
-
*/
|
|
2262
2221
|
function compareArrays(array1, array2, tolerance) {
|
|
2263
2222
|
if (array1.length !== array2.length) {
|
|
2264
2223
|
return false;
|
|
@@ -2275,7 +2234,6 @@
|
|
|
2275
2234
|
var SharedFunctionalGroupsSequence = multiframe.SharedFunctionalGroupsSequence,
|
|
2276
2235
|
PerFrameFunctionalGroupsSequence = multiframe.PerFrameFunctionalGroupsSequence;
|
|
2277
2236
|
var sharedImageOrientationPatient = SharedFunctionalGroupsSequence.PlaneOrientationSequence ? SharedFunctionalGroupsSequence.PlaneOrientationSequence.ImageOrientationPatient : undefined;
|
|
2278
|
-
// Check if in plane.
|
|
2279
2237
|
var PerFrameFunctionalGroups = PerFrameFunctionalGroupsSequence[0];
|
|
2280
2238
|
var iop = sharedImageOrientationPatient || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
|
|
2281
2239
|
var inPlane = validOrientations.some(function (operation) {
|
|
@@ -2285,20 +2243,13 @@
|
|
|
2285
2243
|
return "Planar";
|
|
2286
2244
|
}
|
|
2287
2245
|
if (checkIfPerpendicular(iop, validOrientations[0], tolerance) && sourceDataDimensions.includes(multiframe.Rows) && sourceDataDimensions.includes(multiframe.Columns)) {
|
|
2288
|
-
// Perpendicular and fits on same grid.
|
|
2289
2246
|
return "Perpendicular";
|
|
2290
2247
|
}
|
|
2291
2248
|
return "Oblique";
|
|
2292
2249
|
}
|
|
2293
2250
|
|
|
2294
|
-
/**
|
|
2295
|
-
* Cornerstone adapters events
|
|
2296
|
-
*/
|
|
2297
2251
|
var Events;
|
|
2298
2252
|
(function (Events) {
|
|
2299
|
-
/**
|
|
2300
|
-
* Cornerstone segmentation load progress event
|
|
2301
|
-
*/
|
|
2302
2253
|
Events["SEGMENTATION_LOAD_PROGRESS"] = "CORNERSTONE_ADAPTER_SEGMENTATION_LOAD_PROGRESS";
|
|
2303
2254
|
})(Events || (Events = {}));
|
|
2304
2255
|
var Events$1 = Events;
|
|
@@ -3533,12 +3484,10 @@
|
|
|
3533
3484
|
if (!imagePlaneModule) {
|
|
3534
3485
|
console.warn("Insufficient metadata, imagePlaneModule missing.");
|
|
3535
3486
|
}
|
|
3536
|
-
ImageOrientationPatient = Array.isArray(imagePlaneModule.rowCosines) ? [].concat(_toConsumableArray(imagePlaneModule.rowCosines), _toConsumableArray(imagePlaneModule.columnCosines)) : [imagePlaneModule.rowCosines.x, imagePlaneModule.rowCosines.y, imagePlaneModule.rowCosines.z, imagePlaneModule.columnCosines.x, imagePlaneModule.columnCosines.y, imagePlaneModule.columnCosines.z];
|
|
3487
|
+
ImageOrientationPatient = Array.isArray(imagePlaneModule.rowCosines) ? [].concat(_toConsumableArray(imagePlaneModule.rowCosines), _toConsumableArray(imagePlaneModule.columnCosines)) : [imagePlaneModule.rowCosines.x, imagePlaneModule.rowCosines.y, imagePlaneModule.rowCosines.z, imagePlaneModule.columnCosines.x, imagePlaneModule.columnCosines.y, imagePlaneModule.columnCosines.z];
|
|
3537
3488
|
validOrientations = [ImageOrientationPatient];
|
|
3538
3489
|
pixelData = getPixelData(multiframe);
|
|
3539
|
-
orientation = checkOrientation(multiframe, validOrientations, [imagePlaneModule.rows, imagePlaneModule.columns, imageIds.length], tolerance);
|
|
3540
|
-
// we don't have to call metadataProvider.get() for each imageId over
|
|
3541
|
-
// and over again.
|
|
3490
|
+
orientation = checkOrientation(multiframe, validOrientations, [imagePlaneModule.rows, imagePlaneModule.columns, imageIds.length], tolerance);
|
|
3542
3491
|
sopUIDImageIdIndexMap = imageIds.reduce(function (acc, imageId) {
|
|
3543
3492
|
var _metadataProvider$get = metadataProvider.get("generalImageModule", imageId),
|
|
3544
3493
|
sopInstanceUID = _metadataProvider$get.sopInstanceUID;
|
|
@@ -3555,8 +3504,6 @@
|
|
|
3555
3504
|
};
|
|
3556
3505
|
throw new Error("Parametric maps ".concat(orientationText[orientation], " to the acquisition plane of the source data are not yet supported."));
|
|
3557
3506
|
case 15:
|
|
3558
|
-
// Pre-compute the indices and metadata so that we don't have to call
|
|
3559
|
-
// a function for each imageId in the for loop.
|
|
3560
3507
|
imageIdMaps = imageIds.reduce(function (acc, curr, index) {
|
|
3561
3508
|
acc.indices[curr] = index;
|
|
3562
3509
|
acc.metadata[curr] = metadataProvider.get("instance", curr);
|
|
@@ -3600,8 +3547,6 @@
|
|
|
3600
3547
|
var imageIdIndex = imageIdMaps.indices[imageId];
|
|
3601
3548
|
var byteOffset = sliceLength * imageIdIndex * targetPixelData.BYTES_PER_ELEMENT;
|
|
3602
3549
|
var targetSliceDataView = new targetPixelData.constructor(targetPixelData.buffer, byteOffset, sliceLength);
|
|
3603
|
-
// Copy from source to target which works for parametric maps with same orientation.
|
|
3604
|
-
// TODO: Find a dataset with parametric map in a different orientation and add finish this implementation
|
|
3605
3550
|
targetSliceDataView.set(sourceSliceDataView);
|
|
3606
3551
|
}
|
|
3607
3552
|
return targetPixelData;
|
|
@@ -3786,8 +3731,6 @@
|
|
|
3786
3731
|
if (!toolTypeData || !toolTypeData.data || !toolTypeData.data.length || !toolClass) {
|
|
3787
3732
|
return;
|
|
3788
3733
|
}
|
|
3789
|
-
// Loop through the array of tool instances
|
|
3790
|
-
// for this tool
|
|
3791
3734
|
var Measurements = toolTypeData.data.map(function (tool) {
|
|
3792
3735
|
return getTID300ContentItem(tool, toolType, ReferencedSOPSequence, toolClass, worldToImageCoords);
|
|
3793
3736
|
});
|
|
@@ -3817,9 +3760,6 @@
|
|
|
3817
3760
|
}, {
|
|
3818
3761
|
key: "generateDatasetMeta",
|
|
3819
3762
|
value: function generateDatasetMeta() {
|
|
3820
|
-
// TODO: what is the correct metaheader
|
|
3821
|
-
// http://dicom.nema.org/medical/Dicom/current/output/chtml/part10/chapter_7.html
|
|
3822
|
-
// TODO: move meta creation to happen in derivations.js
|
|
3823
3763
|
var fileMetaInformationVersionArray = new Uint8Array(2);
|
|
3824
3764
|
fileMetaInformationVersionArray[1] = 1;
|
|
3825
3765
|
var _meta = {
|
|
@@ -3827,15 +3767,12 @@
|
|
|
3827
3767
|
Value: [fileMetaInformationVersionArray.buffer],
|
|
3828
3768
|
vr: "OB"
|
|
3829
3769
|
},
|
|
3830
|
-
//MediaStorageSOPClassUID
|
|
3831
|
-
//MediaStorageSOPInstanceUID: sopCommonModule.sopInstanceUID,
|
|
3832
3770
|
TransferSyntaxUID: {
|
|
3833
3771
|
Value: ["1.2.840.10008.1.2.1"],
|
|
3834
3772
|
vr: "UI"
|
|
3835
3773
|
},
|
|
3836
3774
|
ImplementationClassUID: {
|
|
3837
3775
|
Value: [DicomMetaDictionary$1.uid()],
|
|
3838
|
-
// TODO: could be git hash or other valid id
|
|
3839
3776
|
vr: "UI"
|
|
3840
3777
|
},
|
|
3841
3778
|
ImplementationVersionName: {
|
|
@@ -3903,19 +3840,10 @@
|
|
|
3903
3840
|
}, {
|
|
3904
3841
|
key: "generateReport",
|
|
3905
3842
|
value: function generateReport(toolState, metadataProvider, worldToImageCoords, options) {
|
|
3906
|
-
// ToolState for array of imageIDs to a Report
|
|
3907
|
-
// Assume Cornerstone metadata provider has access to Study / Series / Sop Instance UID
|
|
3908
3843
|
var allMeasurementGroups = [];
|
|
3909
|
-
/* Patient ID
|
|
3910
|
-
Warning - Missing attribute or value that would be needed to build DICOMDIR - Patient ID
|
|
3911
|
-
Warning - Missing attribute or value that would be needed to build DICOMDIR - Study Date
|
|
3912
|
-
Warning - Missing attribute or value that would be needed to build DICOMDIR - Study Time
|
|
3913
|
-
Warning - Missing attribute or value that would be needed to build DICOMDIR - Study ID
|
|
3914
|
-
*/
|
|
3915
3844
|
var sopInstanceUIDsToSeriesInstanceUIDMap = {};
|
|
3916
3845
|
var derivationSourceDatasets = [];
|
|
3917
3846
|
var _meta = MeasurementReport.generateDatasetMeta();
|
|
3918
|
-
// Loop through each image in the toolData
|
|
3919
3847
|
Object.keys(toolState).forEach(function (imageId) {
|
|
3920
3848
|
var sopCommonModule = metadataProvider.get("sopCommonModule", imageId);
|
|
3921
3849
|
var instance = metadataProvider.get("instance", imageId);
|
|
@@ -3926,7 +3854,6 @@
|
|
|
3926
3854
|
if (!derivationSourceDatasets.find(function (dsd) {
|
|
3927
3855
|
return dsd.SeriesInstanceUID === seriesInstanceUID;
|
|
3928
3856
|
})) {
|
|
3929
|
-
// Entry not present for series, create one.
|
|
3930
3857
|
var derivationSourceDataset = MeasurementReport.generateDerivationSourceDataset(instance);
|
|
3931
3858
|
derivationSourceDatasets.push(derivationSourceDataset);
|
|
3932
3859
|
}
|
|
@@ -3941,7 +3868,6 @@
|
|
|
3941
3868
|
if (instance && instance.NumberOfFrames && instance.NumberOfFrames > 1 || Normalizer$1.isMultiframeSOPClassUID(sopClassUID)) {
|
|
3942
3869
|
ReferencedSOPSequence.ReferencedFrameNumber = frameNumber;
|
|
3943
3870
|
}
|
|
3944
|
-
// Loop through each tool type for the image
|
|
3945
3871
|
var measurementGroups = [];
|
|
3946
3872
|
toolTypes.forEach(function (toolType) {
|
|
3947
3873
|
var group = getMeasurementGroup(toolType, toolData, ReferencedSOPSequence, worldToImageCoords);
|
|
@@ -3958,19 +3884,14 @@
|
|
|
3958
3884
|
var contentItem = tid1500MeasurementReport.contentItem(derivationSourceDatasets, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
3959
3885
|
sopInstanceUIDsToSeriesInstanceUIDMap: sopInstanceUIDsToSeriesInstanceUIDMap
|
|
3960
3886
|
}));
|
|
3961
|
-
// Merge the derived dataset with the content from the Measurement Report
|
|
3962
3887
|
report.dataset = Object.assign(report.dataset, contentItem);
|
|
3963
3888
|
report.dataset._meta = _meta;
|
|
3964
3889
|
report.SpecificCharacterSet = "ISO_IR 192";
|
|
3965
3890
|
return report;
|
|
3966
3891
|
}
|
|
3967
|
-
/**
|
|
3968
|
-
* Generate Cornerstone tool state from dataset
|
|
3969
|
-
*/
|
|
3970
3892
|
}, {
|
|
3971
3893
|
key: "generateToolState",
|
|
3972
3894
|
value: function generateToolState(dataset, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata, hooks) {
|
|
3973
|
-
// For now, bail out if the dataset is not a TID1500 SR with length measurements
|
|
3974
3895
|
if (dataset.ContentTemplateSequence.TemplateIdentifier !== "1500") {
|
|
3975
3896
|
throw new Error("This package can currently only interpret DICOM SR TID 1500");
|
|
3976
3897
|
}
|
|
@@ -3978,11 +3899,8 @@
|
|
|
3978
3899
|
var GROUP = "Measurement Group";
|
|
3979
3900
|
var TRACKING_IDENTIFIER = "Tracking Identifier";
|
|
3980
3901
|
var TRACKING_UNIQUE_IDENTIFIER = "Tracking Unique Identifier";
|
|
3981
|
-
// Identify the Imaging Measurements
|
|
3982
3902
|
var imagingMeasurementContent = toArray(dataset.ContentSequence).find(codeMeaningEquals(REPORT));
|
|
3983
|
-
// Retrieve the Measurements themselves
|
|
3984
3903
|
var measurementGroups = toArray(imagingMeasurementContent.ContentSequence).filter(codeMeaningEquals(GROUP));
|
|
3985
|
-
// For each of the supported measurement types, compute the measurement data
|
|
3986
3904
|
var measurementData = {};
|
|
3987
3905
|
var cornerstoneToolClasses = MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE;
|
|
3988
3906
|
var registeredToolClasses = [];
|
|
@@ -4016,14 +3934,8 @@
|
|
|
4016
3934
|
console.warn("Unable to generate tool state for", measurementGroup, e);
|
|
4017
3935
|
}
|
|
4018
3936
|
});
|
|
4019
|
-
// NOTE: There is no way of knowing the cornerstone imageIds as that could be anything.
|
|
4020
|
-
// That is up to the consumer to derive from the SOPInstanceUIDs.
|
|
4021
3937
|
return measurementData;
|
|
4022
3938
|
}
|
|
4023
|
-
/**
|
|
4024
|
-
* Register a new tool type.
|
|
4025
|
-
* @param toolClass to perform I/O to DICOM for this tool
|
|
4026
|
-
*/
|
|
4027
3939
|
}, {
|
|
4028
3940
|
key: "registerTool",
|
|
4029
3941
|
value: function registerTool(toolClass) {
|
|
@@ -4034,11 +3946,11 @@
|
|
|
4034
3946
|
}]);
|
|
4035
3947
|
}();
|
|
4036
3948
|
_MeasurementReport = MeasurementReport;
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
3949
|
+
_MeasurementReport.CORNERSTONE_3D_TAG = CORNERSTONE_3D_TAG;
|
|
3950
|
+
_MeasurementReport.MEASUREMENT_BY_TOOLTYPE = {};
|
|
3951
|
+
_MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_UTILITY_TYPE = {};
|
|
3952
|
+
_MeasurementReport.CORNERSTONE_TOOL_CLASSES_BY_TOOL_TYPE = {};
|
|
3953
|
+
_MeasurementReport.generateDerivationSourceDataset = function (instance) {
|
|
4042
3954
|
var _vrMap = {
|
|
4043
3955
|
PixelData: "OW"
|
|
4044
3956
|
};
|
|
@@ -4048,7 +3960,7 @@
|
|
|
4048
3960
|
_vrMap: _vrMap
|
|
4049
3961
|
});
|
|
4050
3962
|
return derivationSourceDataset;
|
|
4051
|
-
}
|
|
3963
|
+
};
|
|
4052
3964
|
|
|
4053
3965
|
var TID300Point$1 = dcmjs.utilities.TID300.Point;
|
|
4054
3966
|
var ARROW_ANNOTATE = "ArrowAnnotate";
|
|
@@ -4166,6 +4078,7 @@
|
|
|
4166
4078
|
};
|
|
4167
4079
|
MeasurementReport.registerTool(ArrowAnnotate);
|
|
4168
4080
|
|
|
4081
|
+
var _Bidirectional;
|
|
4169
4082
|
var TID300Bidirectional = dcmjs.utilities.TID300.Bidirectional;
|
|
4170
4083
|
var BIDIRECTIONAL = "Bidirectional";
|
|
4171
4084
|
var LONG_AXIS = "Long Axis";
|
|
@@ -4238,7 +4151,6 @@
|
|
|
4238
4151
|
length = _ref.length,
|
|
4239
4152
|
width = _ref.width;
|
|
4240
4153
|
var points = handles.points;
|
|
4241
|
-
// Find the length and width point pairs by comparing the distances of the points at 0,1 to points at 2,3
|
|
4242
4154
|
var firstPointPairs = [points[0], points[1]];
|
|
4243
4155
|
var secondPointPairs = [points[2], points[3]];
|
|
4244
4156
|
var firstPointPairsDistance = Math.sqrt(Math.pow(firstPointPairs[0][0] - firstPointPairs[1][0], 2) + Math.pow(firstPointPairs[0][1] - firstPointPairs[1][1], 2) + Math.pow(firstPointPairs[0][2] - firstPointPairs[1][2], 2));
|
|
@@ -4286,10 +4198,11 @@
|
|
|
4286
4198
|
}
|
|
4287
4199
|
}]);
|
|
4288
4200
|
}();
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4201
|
+
_Bidirectional = Bidirectional;
|
|
4202
|
+
_Bidirectional.toolType = BIDIRECTIONAL;
|
|
4203
|
+
_Bidirectional.utilityToolType = BIDIRECTIONAL;
|
|
4204
|
+
_Bidirectional.TID300Representation = TID300Bidirectional;
|
|
4205
|
+
_Bidirectional.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4293
4206
|
if (!TrackingIdentifier.includes(":")) {
|
|
4294
4207
|
return false;
|
|
4295
4208
|
}
|
|
@@ -4301,9 +4214,10 @@
|
|
|
4301
4214
|
return false;
|
|
4302
4215
|
}
|
|
4303
4216
|
return toolType === BIDIRECTIONAL;
|
|
4304
|
-
}
|
|
4217
|
+
};
|
|
4305
4218
|
MeasurementReport.registerTool(Bidirectional);
|
|
4306
4219
|
|
|
4220
|
+
var _Angle;
|
|
4307
4221
|
var TID300CobbAngle$1 = dcmjs.utilities.TID300.CobbAngle;
|
|
4308
4222
|
var MEASUREMENT_TYPE$1 = "Angle";
|
|
4309
4223
|
var trackingIdentifierTextValue$6 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE$1);
|
|
@@ -4313,9 +4227,7 @@
|
|
|
4313
4227
|
}
|
|
4314
4228
|
return _createClass(Angle, null, [{
|
|
4315
4229
|
key: "getMeasurementData",
|
|
4316
|
-
value:
|
|
4317
|
-
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
4318
|
-
function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4230
|
+
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4319
4231
|
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, Angle.toolType),
|
|
4320
4232
|
defaultState = _MeasurementReport$ge.defaultState,
|
|
4321
4233
|
NUMGroup = _MeasurementReport$ge.NUMGroup,
|
|
@@ -4376,7 +4288,6 @@
|
|
|
4376
4288
|
};
|
|
4377
4289
|
var _ref = cachedStats["imageId:".concat(referencedImageId)] || {},
|
|
4378
4290
|
angle = _ref.angle;
|
|
4379
|
-
// Represented as a cobb angle
|
|
4380
4291
|
return {
|
|
4381
4292
|
point1: point1,
|
|
4382
4293
|
point2: point2,
|
|
@@ -4390,10 +4301,11 @@
|
|
|
4390
4301
|
}
|
|
4391
4302
|
}]);
|
|
4392
4303
|
}();
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4304
|
+
_Angle = Angle;
|
|
4305
|
+
_Angle.toolType = MEASUREMENT_TYPE$1;
|
|
4306
|
+
_Angle.utilityToolType = MEASUREMENT_TYPE$1;
|
|
4307
|
+
_Angle.TID300Representation = TID300CobbAngle$1;
|
|
4308
|
+
_Angle.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4397
4309
|
if (!TrackingIdentifier.includes(":")) {
|
|
4398
4310
|
return false;
|
|
4399
4311
|
}
|
|
@@ -4405,9 +4317,10 @@
|
|
|
4405
4317
|
return false;
|
|
4406
4318
|
}
|
|
4407
4319
|
return toolType === MEASUREMENT_TYPE$1;
|
|
4408
|
-
}
|
|
4320
|
+
};
|
|
4409
4321
|
MeasurementReport.registerTool(Angle);
|
|
4410
4322
|
|
|
4323
|
+
var _CobbAngle;
|
|
4411
4324
|
var TID300CobbAngle = dcmjs.utilities.TID300.CobbAngle;
|
|
4412
4325
|
var MEASUREMENT_TYPE = "CobbAngle";
|
|
4413
4326
|
var trackingIdentifierTextValue$5 = "".concat(CORNERSTONE_3D_TAG, ":").concat(MEASUREMENT_TYPE);
|
|
@@ -4417,9 +4330,7 @@
|
|
|
4417
4330
|
}
|
|
4418
4331
|
return _createClass(CobbAngle, null, [{
|
|
4419
4332
|
key: "getMeasurementData",
|
|
4420
|
-
value:
|
|
4421
|
-
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
4422
|
-
function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4333
|
+
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4423
4334
|
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CobbAngle.toolType),
|
|
4424
4335
|
defaultState = _MeasurementReport$ge.defaultState,
|
|
4425
4336
|
NUMGroup = _MeasurementReport$ge.NUMGroup,
|
|
@@ -4497,10 +4408,11 @@
|
|
|
4497
4408
|
}
|
|
4498
4409
|
}]);
|
|
4499
4410
|
}();
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4411
|
+
_CobbAngle = CobbAngle;
|
|
4412
|
+
_CobbAngle.toolType = MEASUREMENT_TYPE;
|
|
4413
|
+
_CobbAngle.utilityToolType = MEASUREMENT_TYPE;
|
|
4414
|
+
_CobbAngle.TID300Representation = TID300CobbAngle;
|
|
4415
|
+
_CobbAngle.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4504
4416
|
if (!TrackingIdentifier.includes(":")) {
|
|
4505
4417
|
return false;
|
|
4506
4418
|
}
|
|
@@ -4512,7 +4424,7 @@
|
|
|
4512
4424
|
return false;
|
|
4513
4425
|
}
|
|
4514
4426
|
return toolType === MEASUREMENT_TYPE;
|
|
4515
|
-
}
|
|
4427
|
+
};
|
|
4516
4428
|
MeasurementReport.registerTool(CobbAngle);
|
|
4517
4429
|
|
|
4518
4430
|
function isValidCornerstoneTrackingIdentifier(trackingIdentifier) {
|
|
@@ -4526,11 +4438,10 @@
|
|
|
4526
4438
|
if (cornerstone3DTag !== CORNERSTONE_3D_TAG) {
|
|
4527
4439
|
return false;
|
|
4528
4440
|
}
|
|
4529
|
-
// The following is needed since the new cornerstone3D has changed
|
|
4530
|
-
// case names such as EllipticalRoi to EllipticalROI
|
|
4531
4441
|
return toolType.toLowerCase() === this.toolType.toLowerCase();
|
|
4532
4442
|
}
|
|
4533
4443
|
|
|
4444
|
+
var _CircleROI;
|
|
4534
4445
|
var TID300Circle = dcmjs.utilities.TID300.Circle;
|
|
4535
4446
|
var CIRCLEROI = "CircleROI";
|
|
4536
4447
|
var CircleROI = /*#__PURE__*/function () {
|
|
@@ -4539,8 +4450,7 @@
|
|
|
4539
4450
|
}
|
|
4540
4451
|
return _createClass(CircleROI, null, [{
|
|
4541
4452
|
key: "getMeasurementData",
|
|
4542
|
-
value:
|
|
4543
|
-
function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4453
|
+
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
4544
4454
|
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, CircleROI.toolType),
|
|
4545
4455
|
defaultState = _MeasurementReport$ge.defaultState,
|
|
4546
4456
|
NUMGroup = _MeasurementReport$ge.NUMGroup,
|
|
@@ -4548,7 +4458,6 @@
|
|
|
4548
4458
|
ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
|
|
4549
4459
|
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4550
4460
|
var GraphicData = SCOORDGroup.GraphicData;
|
|
4551
|
-
// GraphicData is ordered as [centerX, centerY, endX, endY]
|
|
4552
4461
|
var pointsWorld = [];
|
|
4553
4462
|
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
4554
4463
|
var worldPos = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
@@ -4565,7 +4474,6 @@
|
|
|
4565
4474
|
},
|
|
4566
4475
|
cachedStats: _defineProperty({}, "imageId:".concat(referencedImageId), {
|
|
4567
4476
|
area: NUMGroup ? NUMGroup.MeasuredValueSequence.NumericValue : 0,
|
|
4568
|
-
// Dummy values to be updated by cornerstone
|
|
4569
4477
|
radius: 0,
|
|
4570
4478
|
perimeter: 0
|
|
4571
4479
|
}),
|
|
@@ -4573,12 +4481,6 @@
|
|
|
4573
4481
|
};
|
|
4574
4482
|
return state;
|
|
4575
4483
|
}
|
|
4576
|
-
/**
|
|
4577
|
-
* Gets the TID 300 representation of a circle, given the cornerstone representation.
|
|
4578
|
-
*
|
|
4579
|
-
* @param {Object} tool
|
|
4580
|
-
* @returns
|
|
4581
|
-
*/
|
|
4582
4484
|
}, {
|
|
4583
4485
|
key: "getTID300RepresentationArguments",
|
|
4584
4486
|
value: function getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
@@ -4620,13 +4522,15 @@
|
|
|
4620
4522
|
}
|
|
4621
4523
|
}]);
|
|
4622
4524
|
}();
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4525
|
+
_CircleROI = CircleROI;
|
|
4526
|
+
_CircleROI.trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(CIRCLEROI);
|
|
4527
|
+
_CircleROI.toolType = CIRCLEROI;
|
|
4528
|
+
_CircleROI.utilityToolType = CIRCLEROI;
|
|
4529
|
+
_CircleROI.TID300Representation = TID300Circle;
|
|
4530
|
+
_CircleROI.isValidCornerstoneTrackingIdentifier = isValidCornerstoneTrackingIdentifier;
|
|
4628
4531
|
MeasurementReport.registerTool(CircleROI);
|
|
4629
4532
|
|
|
4533
|
+
var _EllipticalROI;
|
|
4630
4534
|
var TID300Ellipse = dcmjs.utilities.TID300.Ellipse;
|
|
4631
4535
|
var ELLIPTICALROI = "EllipticalROI";
|
|
4632
4536
|
var EPSILON = 1e-4;
|
|
@@ -4644,10 +4548,6 @@
|
|
|
4644
4548
|
ReferencedFrameNumber = _MeasurementReport$ge.ReferencedFrameNumber;
|
|
4645
4549
|
var referencedImageId = defaultState.annotation.metadata.referencedImageId;
|
|
4646
4550
|
var GraphicData = SCOORDGroup.GraphicData;
|
|
4647
|
-
// GraphicData is ordered as [majorAxisStartX, majorAxisStartY, majorAxisEndX, majorAxisEndY, minorAxisStartX, minorAxisStartY, minorAxisEndX, minorAxisEndY]
|
|
4648
|
-
// But Cornerstone3D points are ordered as top, bottom, left, right for the
|
|
4649
|
-
// ellipse so we need to identify if the majorAxis is horizontal or vertical
|
|
4650
|
-
// in the image plane and then choose the correct points to use for the ellipse.
|
|
4651
4551
|
var pointsWorld = [];
|
|
4652
4552
|
for (var i = 0; i < GraphicData.length; i += 2) {
|
|
4653
4553
|
var worldPos = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
@@ -4659,7 +4559,6 @@
|
|
|
4659
4559
|
var minorAxisEnd = glMatrix.vec3.fromValues.apply(glMatrix.vec3, _toConsumableArray(pointsWorld[3]));
|
|
4660
4560
|
var majorAxisVec = glMatrix.vec3.create();
|
|
4661
4561
|
glMatrix.vec3.sub(majorAxisVec, majorAxisEnd, majorAxisStart);
|
|
4662
|
-
// normalize majorAxisVec to avoid scaling issues
|
|
4663
4562
|
glMatrix.vec3.normalize(majorAxisVec, majorAxisVec);
|
|
4664
4563
|
var minorAxisVec = glMatrix.vec3.create();
|
|
4665
4564
|
glMatrix.vec3.sub(minorAxisVec, minorAxisEnd, minorAxisStart);
|
|
@@ -4669,7 +4568,6 @@
|
|
|
4669
4568
|
throw new Error("imageId does not have imagePlaneModule metadata");
|
|
4670
4569
|
}
|
|
4671
4570
|
var columnCosines = imagePlaneModule.columnCosines;
|
|
4672
|
-
// find which axis is parallel to the columnCosines
|
|
4673
4571
|
var columnCosinesVec = glMatrix.vec3.fromValues(columnCosines[0], columnCosines[1], columnCosines[2]);
|
|
4674
4572
|
var projectedMajorAxisOnColVec = glMatrix.vec3.dot(columnCosinesVec, majorAxisVec);
|
|
4675
4573
|
var projectedMinorAxisOnColVec = glMatrix.vec3.dot(columnCosinesVec, minorAxisVec);
|
|
@@ -4715,7 +4613,6 @@
|
|
|
4715
4613
|
throw new Error("EllipticalROI.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
4716
4614
|
}
|
|
4717
4615
|
var top, bottom, left, right;
|
|
4718
|
-
// this way when it's restored we can assume the initial rotation is 0.
|
|
4719
4616
|
if (rotation == 90 || rotation == 270) {
|
|
4720
4617
|
bottom = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
4721
4618
|
top = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
@@ -4727,12 +4624,10 @@
|
|
|
4727
4624
|
left = worldToImageCoords(referencedImageId, handles.points[2]);
|
|
4728
4625
|
right = worldToImageCoords(referencedImageId, handles.points[3]);
|
|
4729
4626
|
}
|
|
4730
|
-
// find the major axis and minor axis
|
|
4731
4627
|
var topBottomLength = Math.abs(top[1] - bottom[1]);
|
|
4732
4628
|
var leftRightLength = Math.abs(left[0] - right[0]);
|
|
4733
4629
|
var points = [];
|
|
4734
4630
|
if (topBottomLength > leftRightLength) {
|
|
4735
|
-
// major axis is bottom to top
|
|
4736
4631
|
points.push({
|
|
4737
4632
|
x: top[0],
|
|
4738
4633
|
y: top[1]
|
|
@@ -4741,7 +4636,6 @@
|
|
|
4741
4636
|
x: bottom[0],
|
|
4742
4637
|
y: bottom[1]
|
|
4743
4638
|
});
|
|
4744
|
-
// minor axis is left to right
|
|
4745
4639
|
points.push({
|
|
4746
4640
|
x: left[0],
|
|
4747
4641
|
y: left[1]
|
|
@@ -4751,7 +4645,6 @@
|
|
|
4751
4645
|
y: right[1]
|
|
4752
4646
|
});
|
|
4753
4647
|
} else {
|
|
4754
|
-
// major axis is left to right
|
|
4755
4648
|
points.push({
|
|
4756
4649
|
x: left[0],
|
|
4757
4650
|
y: left[1]
|
|
@@ -4760,7 +4653,6 @@
|
|
|
4760
4653
|
x: right[0],
|
|
4761
4654
|
y: right[1]
|
|
4762
4655
|
});
|
|
4763
|
-
// minor axis is bottom to top
|
|
4764
4656
|
points.push({
|
|
4765
4657
|
x: top[0],
|
|
4766
4658
|
y: top[1]
|
|
@@ -4782,13 +4674,15 @@
|
|
|
4782
4674
|
}
|
|
4783
4675
|
}]);
|
|
4784
4676
|
}();
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4677
|
+
_EllipticalROI = EllipticalROI;
|
|
4678
|
+
_EllipticalROI.trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(ELLIPTICALROI);
|
|
4679
|
+
_EllipticalROI.toolType = ELLIPTICALROI;
|
|
4680
|
+
_EllipticalROI.utilityToolType = ELLIPTICALROI;
|
|
4681
|
+
_EllipticalROI.TID300Representation = TID300Ellipse;
|
|
4682
|
+
_EllipticalROI.isValidCornerstoneTrackingIdentifier = isValidCornerstoneTrackingIdentifier;
|
|
4790
4683
|
MeasurementReport.registerTool(EllipticalROI);
|
|
4791
4684
|
|
|
4685
|
+
var _RectangleROI;
|
|
4792
4686
|
var TID300Polyline$1 = dcmjs.utilities.TID300.Polyline;
|
|
4793
4687
|
var TOOLTYPE = "RectangleROI";
|
|
4794
4688
|
var trackingIdentifierTextValue$4 = "".concat(CORNERSTONE_3D_TAG, ":").concat(TOOLTYPE);
|
|
@@ -4857,10 +4751,11 @@
|
|
|
4857
4751
|
}
|
|
4858
4752
|
}]);
|
|
4859
4753
|
}();
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4754
|
+
_RectangleROI = RectangleROI;
|
|
4755
|
+
_RectangleROI.toolType = TOOLTYPE;
|
|
4756
|
+
_RectangleROI.utilityToolType = TOOLTYPE;
|
|
4757
|
+
_RectangleROI.TID300Representation = TID300Polyline$1;
|
|
4758
|
+
_RectangleROI.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
4864
4759
|
if (!TrackingIdentifier.includes(":")) {
|
|
4865
4760
|
return false;
|
|
4866
4761
|
}
|
|
@@ -4872,7 +4767,7 @@
|
|
|
4872
4767
|
return false;
|
|
4873
4768
|
}
|
|
4874
4769
|
return toolType === TOOLTYPE;
|
|
4875
|
-
}
|
|
4770
|
+
};
|
|
4876
4771
|
MeasurementReport.registerTool(RectangleROI);
|
|
4877
4772
|
|
|
4878
4773
|
var TID300Length$1 = dcmjs.utilities.TID300.Length;
|
|
@@ -4970,6 +4865,7 @@
|
|
|
4970
4865
|
};
|
|
4971
4866
|
MeasurementReport.registerTool(Length);
|
|
4972
4867
|
|
|
4868
|
+
var _PlanarFreehandROI;
|
|
4973
4869
|
var TID300Polyline = dcmjs.utilities.TID300.Polyline;
|
|
4974
4870
|
var PLANARFREEHANDROI = "PlanarFreehandROI";
|
|
4975
4871
|
var trackingIdentifierTextValue$2 = "".concat(CORNERSTONE_3D_TAG, ":").concat(PLANARFREEHANDROI);
|
|
@@ -4995,9 +4891,8 @@
|
|
|
4995
4891
|
}
|
|
4996
4892
|
var distanceBetweenFirstAndLastPoint = glMatrix.vec3.distance(worldCoords[worldCoords.length - 1], worldCoords[0]);
|
|
4997
4893
|
var isOpenContour = true;
|
|
4998
|
-
// If the contour is closed, this should have been encoded as exactly the same point, so check for a very small difference.
|
|
4999
4894
|
if (distanceBetweenFirstAndLastPoint < closedContourThreshold) {
|
|
5000
|
-
worldCoords.pop();
|
|
4895
|
+
worldCoords.pop();
|
|
5001
4896
|
isOpenContour = false;
|
|
5002
4897
|
}
|
|
5003
4898
|
var points = [];
|
|
@@ -5043,9 +4938,7 @@
|
|
|
5043
4938
|
return worldToImageCoords(referencedImageId, worldPos);
|
|
5044
4939
|
});
|
|
5045
4940
|
if (!isOpenContour) {
|
|
5046
|
-
// Need to repeat the first point at the end of to have an explicitly closed contour.
|
|
5047
4941
|
var firstPoint = points[0];
|
|
5048
|
-
// Explicitly expand to avoid circular references.
|
|
5049
4942
|
points.push([firstPoint[0], firstPoint[1]]);
|
|
5050
4943
|
}
|
|
5051
4944
|
var _ref = data.cachedStats["imageId:".concat(referencedImageId)] || {},
|
|
@@ -5057,7 +4950,6 @@
|
|
|
5057
4950
|
max = _ref.max,
|
|
5058
4951
|
stdDev = _ref.stdDev;
|
|
5059
4952
|
return {
|
|
5060
|
-
/** From cachedStats */
|
|
5061
4953
|
points: points,
|
|
5062
4954
|
area: area,
|
|
5063
4955
|
areaUnit: areaUnit,
|
|
@@ -5066,7 +4958,6 @@
|
|
|
5066
4958
|
mean: mean,
|
|
5067
4959
|
max: max,
|
|
5068
4960
|
stdDev: stdDev,
|
|
5069
|
-
/** Other */
|
|
5070
4961
|
trackingIdentifierTextValue: trackingIdentifierTextValue$2,
|
|
5071
4962
|
finding: finding,
|
|
5072
4963
|
findingSites: findingSites || []
|
|
@@ -5074,10 +4965,11 @@
|
|
|
5074
4965
|
}
|
|
5075
4966
|
}]);
|
|
5076
4967
|
}();
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
4968
|
+
_PlanarFreehandROI = PlanarFreehandROI;
|
|
4969
|
+
_PlanarFreehandROI.toolType = PLANARFREEHANDROI;
|
|
4970
|
+
_PlanarFreehandROI.utilityToolType = PLANARFREEHANDROI;
|
|
4971
|
+
_PlanarFreehandROI.TID300Representation = TID300Polyline;
|
|
4972
|
+
_PlanarFreehandROI.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
5081
4973
|
if (!TrackingIdentifier.includes(":")) {
|
|
5082
4974
|
return false;
|
|
5083
4975
|
}
|
|
@@ -5089,7 +4981,7 @@
|
|
|
5089
4981
|
return false;
|
|
5090
4982
|
}
|
|
5091
4983
|
return toolType === PLANARFREEHANDROI;
|
|
5092
|
-
}
|
|
4984
|
+
};
|
|
5093
4985
|
MeasurementReport.registerTool(PlanarFreehandROI);
|
|
5094
4986
|
|
|
5095
4987
|
var TID300Point = dcmjs.utilities.TID300.Point;
|
|
@@ -5173,6 +5065,7 @@
|
|
|
5173
5065
|
};
|
|
5174
5066
|
MeasurementReport.registerTool(Probe);
|
|
5175
5067
|
|
|
5068
|
+
var _UltrasoundDirectional;
|
|
5176
5069
|
var TID300Length = dcmjs.utilities.TID300.Length;
|
|
5177
5070
|
var ULTRASOUND_DIRECTIONAL = "UltrasoundDirectionalTool";
|
|
5178
5071
|
var trackingIdentifierTextValue = "".concat(CORNERSTONE_3D_TAG, ":").concat(ULTRASOUND_DIRECTIONAL);
|
|
@@ -5182,9 +5075,7 @@
|
|
|
5182
5075
|
}
|
|
5183
5076
|
return _createClass(UltrasoundDirectional, null, [{
|
|
5184
5077
|
key: "getMeasurementData",
|
|
5185
|
-
value:
|
|
5186
|
-
// TODO: this function is required for all Cornerstone Tool Adapters, since it is called by MeasurementReport.
|
|
5187
|
-
function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
5078
|
+
value: function getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
5188
5079
|
var _MeasurementReport$ge = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, UltrasoundDirectional.toolType),
|
|
5189
5080
|
defaultState = _MeasurementReport$ge.defaultState,
|
|
5190
5081
|
SCOORDGroup = _MeasurementReport$ge.SCOORDGroup,
|
|
@@ -5242,10 +5133,11 @@
|
|
|
5242
5133
|
}
|
|
5243
5134
|
}]);
|
|
5244
5135
|
}();
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5136
|
+
_UltrasoundDirectional = UltrasoundDirectional;
|
|
5137
|
+
_UltrasoundDirectional.toolType = ULTRASOUND_DIRECTIONAL;
|
|
5138
|
+
_UltrasoundDirectional.utilityToolType = ULTRASOUND_DIRECTIONAL;
|
|
5139
|
+
_UltrasoundDirectional.TID300Representation = TID300Length;
|
|
5140
|
+
_UltrasoundDirectional.isValidCornerstoneTrackingIdentifier = function (TrackingIdentifier) {
|
|
5249
5141
|
if (!TrackingIdentifier.includes(":")) {
|
|
5250
5142
|
return false;
|
|
5251
5143
|
}
|
|
@@ -5257,38 +5149,20 @@
|
|
|
5257
5149
|
return false;
|
|
5258
5150
|
}
|
|
5259
5151
|
return toolType === ULTRASOUND_DIRECTIONAL;
|
|
5260
|
-
}
|
|
5152
|
+
};
|
|
5261
5153
|
MeasurementReport.registerTool(UltrasoundDirectional);
|
|
5262
5154
|
|
|
5263
5155
|
var Normalizer = dcmjs.normalizers.Normalizer;
|
|
5264
5156
|
var SegmentationDerivation = dcmjs.derivations.Segmentation;
|
|
5265
|
-
/**
|
|
5266
|
-
* generateSegmentation - Generates a DICOM Segmentation object given cornerstoneTools data.
|
|
5267
|
-
*
|
|
5268
|
-
* @param images - An array of the cornerstone image objects, which includes imageId and metadata
|
|
5269
|
-
* @param labelmaps - An array of the 3D Volumes that contain the segmentation data.
|
|
5270
|
-
*/
|
|
5271
5157
|
function generateSegmentation(images, labelmaps, metadata) {
|
|
5272
5158
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
5273
5159
|
var segmentation = _createMultiframeSegmentationFromReferencedImages(images, metadata, options);
|
|
5274
5160
|
return fillSegmentation$1(segmentation, labelmaps, options);
|
|
5275
5161
|
}
|
|
5276
|
-
/**
|
|
5277
|
-
* _createMultiframeSegmentationFromReferencedImages - description
|
|
5278
|
-
*
|
|
5279
|
-
* @param images - An array of the cornerstone image objects related to the reference
|
|
5280
|
-
* series that the segmentation is derived from. You can use methods such as
|
|
5281
|
-
* volume.getCornerstoneImages() to get this array.
|
|
5282
|
-
*
|
|
5283
|
-
* @param options - the options object for the SegmentationDerivation.
|
|
5284
|
-
* @returns The Seg derived dataSet.
|
|
5285
|
-
*/
|
|
5286
5162
|
function _createMultiframeSegmentationFromReferencedImages(images, metadata, options) {
|
|
5287
5163
|
var datasets = images.map(function (image) {
|
|
5288
|
-
// add the sopClassUID to the dataset
|
|
5289
5164
|
var instance = metadata.get("instance", image.imageId);
|
|
5290
5165
|
return _objectSpread2(_objectSpread2(_objectSpread2({}, image), instance), {}, {
|
|
5291
|
-
// Todo: move to dcmjs tag style
|
|
5292
5166
|
SOPClassUID: instance.SopClassUID || instance.SOPClassUID,
|
|
5293
5167
|
SOPInstanceUID: instance.SopInstanceUID || instance.SOPInstanceUID,
|
|
5294
5168
|
PixelData: image.voxelManager.getScalarData(),
|
|
@@ -5302,21 +5176,11 @@
|
|
|
5302
5176
|
return new SegmentationDerivation([multiframe], options);
|
|
5303
5177
|
}
|
|
5304
5178
|
|
|
5305
|
-
/**
|
|
5306
|
-
* Generates 2D label maps from a 3D label map.
|
|
5307
|
-
* @param labelmap3D - The 3D label map object to generate 2D label maps from. It is derived
|
|
5308
|
-
* from the volume labelmap.
|
|
5309
|
-
* @returns The label map object containing the 2D label maps and segments on label maps.
|
|
5310
|
-
*/
|
|
5311
5179
|
function generateLabelMaps2DFrom3D(labelmap3D) {
|
|
5312
|
-
// 1. we need to generate labelmaps2D from labelmaps3D, a labelmap2D is for each
|
|
5313
|
-
// slice
|
|
5314
5180
|
var scalarData = labelmap3D.scalarData,
|
|
5315
5181
|
dimensions = labelmap3D.dimensions;
|
|
5316
|
-
// scalarData is a flat array of all the pixels in the volume.
|
|
5317
5182
|
var labelmaps2D = [];
|
|
5318
5183
|
var segmentsOnLabelmap3D = new Set();
|
|
5319
|
-
// X-Y are the row and column dimensions, Z is the number of slices.
|
|
5320
5184
|
for (var z = 0; z < dimensions[2]; z++) {
|
|
5321
5185
|
var pixelData = scalarData.slice(z * dimensions[0] * dimensions[1], (z + 1) * dimensions[0] * dimensions[1]);
|
|
5322
5186
|
var segmentsOnLabelmap = [];
|
|
@@ -5340,7 +5204,6 @@
|
|
|
5340
5204
|
});
|
|
5341
5205
|
labelmaps2D[dimensions[2] - 1 - z] = labelmap2D;
|
|
5342
5206
|
}
|
|
5343
|
-
// remove segment 0 from segmentsOnLabelmap3D
|
|
5344
5207
|
labelmap3D.segmentsOnLabelmap = Array.from(segmentsOnLabelmap3D);
|
|
5345
5208
|
labelmap3D.labelmaps2D = labelmaps2D;
|
|
5346
5209
|
return labelmap3D;
|
|
@@ -5348,20 +5211,6 @@
|
|
|
5348
5211
|
|
|
5349
5212
|
var Segmentation$2 = CornerstoneSEG.Segmentation;
|
|
5350
5213
|
var generateToolStateCornerstoneLegacy = Segmentation$2.generateToolState;
|
|
5351
|
-
/**
|
|
5352
|
-
* generateToolState - Given a set of cornerstoneTools imageIds and a Segmentation buffer,
|
|
5353
|
-
* derive cornerstoneTools toolState and brush metadata.
|
|
5354
|
-
*
|
|
5355
|
-
* @param imageIds - An array of the imageIds.
|
|
5356
|
-
* @param arrayBuffer - The SEG arrayBuffer.
|
|
5357
|
-
* @param skipOverlapping - skip checks for overlapping segs, default value false.
|
|
5358
|
-
* @param tolerance - default value 1.e-3.
|
|
5359
|
-
*
|
|
5360
|
-
* @returns a list of array buffer for each labelMap
|
|
5361
|
-
* an object from which the segment metadata can be derived
|
|
5362
|
-
* list containing the track of segments per frame
|
|
5363
|
-
* list containing the track of segments per frame for each labelMap (available only for the overlapping case).
|
|
5364
|
-
*/
|
|
5365
5214
|
function generateToolState$1(imageIds, arrayBuffer, metadataProvider) {
|
|
5366
5215
|
var skipOverlapping = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
5367
5216
|
var tolerance = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1e-3;
|
|
@@ -5486,64 +5335,22 @@
|
|
|
5486
5335
|
generateContourSetsFromLabelmap$1 = _utilities$contours.generateContourSetsFromLabelmap,
|
|
5487
5336
|
AnnotationToPointData = _utilities$contours.AnnotationToPointData;
|
|
5488
5337
|
var DicomMetaDictionary = dcmjs.data.DicomMetaDictionary;
|
|
5489
|
-
/**
|
|
5490
|
-
* Convert handles to RTSS report containing the dcmjs dicom dataset.
|
|
5491
|
-
*
|
|
5492
|
-
* Note: current WIP and using segmentation to contour conversion,
|
|
5493
|
-
* routine that is not fully tested
|
|
5494
|
-
*
|
|
5495
|
-
* @param segmentations - Cornerstone tool segmentations data
|
|
5496
|
-
* @param metadataProvider - Metadata provider
|
|
5497
|
-
* @param DicomMetadataStore - metadata store instance
|
|
5498
|
-
* @param cs - cornerstone instance
|
|
5499
|
-
* @param csTools - cornerstone tool instance
|
|
5500
|
-
* @returns Report object containing the dataset
|
|
5501
|
-
*/
|
|
5502
5338
|
function generateRTSSFromSegmentations(segmentations, metadataProvider, DicomMetadataStore) {
|
|
5503
|
-
// Convert segmentations to ROIContours
|
|
5504
5339
|
var roiContours = [];
|
|
5505
5340
|
var contourSets = generateContourSetsFromLabelmap$1({
|
|
5506
5341
|
segmentations: segmentations
|
|
5507
5342
|
});
|
|
5508
5343
|
contourSets.forEach(function (contourSet, segIndex) {
|
|
5509
|
-
// Check contour set isn't undefined
|
|
5510
5344
|
if (contourSet) {
|
|
5511
5345
|
var contourSequence = [];
|
|
5512
5346
|
contourSet.sliceContours.forEach(function (sliceContour) {
|
|
5513
|
-
/**
|
|
5514
|
-
* addContour - Adds a new ROI with related contours to ROIContourSequence
|
|
5515
|
-
*
|
|
5516
|
-
* @param newContour - cornerstoneTools `ROIContour` object
|
|
5517
|
-
*
|
|
5518
|
-
* newContour = {
|
|
5519
|
-
* name: string,
|
|
5520
|
-
* description: string,
|
|
5521
|
-
* contourSequence: array[contour]
|
|
5522
|
-
* color: array[number],
|
|
5523
|
-
* metadata: {
|
|
5524
|
-
* referencedImageId: string,
|
|
5525
|
-
* FrameOfReferenceUID: string
|
|
5526
|
-
* }
|
|
5527
|
-
* }
|
|
5528
|
-
*
|
|
5529
|
-
* contour = {
|
|
5530
|
-
* ContourImageSequence: array[
|
|
5531
|
-
* { ReferencedSOPClassUID: string, ReferencedSOPInstanceUID: string}
|
|
5532
|
-
* ]
|
|
5533
|
-
* ContourGeometricType: string,
|
|
5534
|
-
* NumberOfContourPoints: number,
|
|
5535
|
-
* ContourData: array[number]
|
|
5536
|
-
* }
|
|
5537
|
-
*/
|
|
5538
|
-
// Note: change needed if support non-planar contour representation is needed
|
|
5539
5347
|
var sopCommon = metadataProvider.get("sopCommonModule", sliceContour.referencedImageId);
|
|
5540
5348
|
var ReferencedSOPClassUID = sopCommon.sopClassUID;
|
|
5541
5349
|
var ReferencedSOPInstanceUID = sopCommon.sopInstanceUID;
|
|
5542
5350
|
var ContourImageSequence = [{
|
|
5543
5351
|
ReferencedSOPClassUID: ReferencedSOPClassUID,
|
|
5544
5352
|
ReferencedSOPInstanceUID: ReferencedSOPInstanceUID
|
|
5545
|
-
}
|
|
5546
|
-
];
|
|
5353
|
+
}];
|
|
5547
5354
|
var sliceContourPolyData = sliceContour.polyData;
|
|
5548
5355
|
sliceContour.contours.forEach(function (contour, index) {
|
|
5549
5356
|
var ContourGeometricType = contour.type;
|
|
@@ -5591,9 +5398,7 @@
|
|
|
5591
5398
|
};
|
|
5592
5399
|
dataset.StructureSetROISequence.push(getStructureSetModule(contour, index));
|
|
5593
5400
|
dataset.ROIContourSequence.push(roiContour);
|
|
5594
|
-
// ReferencedSeriesSequence
|
|
5595
5401
|
dataset.ReferencedSeriesSequence = getReferencedSeriesSequence(contour.metadata, index, metadataProvider, DicomMetadataStore);
|
|
5596
|
-
// ReferencedFrameOfReferenceSequence
|
|
5597
5402
|
dataset.ReferencedFrameOfReferenceSequence = getReferencedFrameOfReferenceSequence(contour.metadata, metadataProvider, dataset);
|
|
5598
5403
|
});
|
|
5599
5404
|
var fileMetaInformationVersionArray = new Uint8Array(2);
|
|
@@ -5609,7 +5414,6 @@
|
|
|
5609
5414
|
},
|
|
5610
5415
|
ImplementationClassUID: {
|
|
5611
5416
|
Value: [DicomMetaDictionary.uid()],
|
|
5612
|
-
// TODO: could be git hash or other valid id
|
|
5613
5417
|
vr: "UI"
|
|
5614
5418
|
},
|
|
5615
5419
|
ImplementationVersionName: {
|
|
@@ -5618,20 +5422,9 @@
|
|
|
5618
5422
|
}
|
|
5619
5423
|
};
|
|
5620
5424
|
dataset._meta = _meta;
|
|
5621
|
-
// @ts-ignore
|
|
5622
5425
|
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
5623
5426
|
return dataset;
|
|
5624
5427
|
}
|
|
5625
|
-
/**
|
|
5626
|
-
* Convert handles to RTSSReport report object containing the dcmjs dicom dataset.
|
|
5627
|
-
*
|
|
5628
|
-
* Note: The tool data needs to be formatted in a specific way, and currently
|
|
5629
|
-
* it is limited to the RectangleROIStartEndTool in the Cornerstone.
|
|
5630
|
-
*
|
|
5631
|
-
* @param annotations - Array of Cornerstone tool annotation data
|
|
5632
|
-
* @param metadataProvider - Metadata provider
|
|
5633
|
-
* @returns Report object containing the dataset
|
|
5634
|
-
*/
|
|
5635
5428
|
function generateRTSSFromAnnotations(annotations, metadataProvider, DicomMetadataStore) {
|
|
5636
5429
|
var rtMetadata = {
|
|
5637
5430
|
name: "RTSS from Annotations",
|
|
@@ -5643,10 +5436,7 @@
|
|
|
5643
5436
|
dataset.StructureSetROISequence.push(getStructureSetModule(annotation, index));
|
|
5644
5437
|
dataset.ROIContourSequence.push(ContourSequence);
|
|
5645
5438
|
dataset.RTROIObservationsSequence.push(getRTROIObservationsSequence(annotation, index));
|
|
5646
|
-
// ReferencedSeriesSequence
|
|
5647
|
-
// Todo: handle more than one series
|
|
5648
5439
|
dataset.ReferencedSeriesSequence = getReferencedSeriesSequence(annotation.metadata, index, metadataProvider, DicomMetadataStore);
|
|
5649
|
-
// ReferencedFrameOfReferenceSequence
|
|
5650
5440
|
dataset.ReferencedFrameOfReferenceSequence = getReferencedFrameOfReferenceSequence(annotation.metadata, metadataProvider, dataset);
|
|
5651
5441
|
});
|
|
5652
5442
|
var fileMetaInformationVersionArray = new Uint8Array(2);
|
|
@@ -5662,7 +5452,6 @@
|
|
|
5662
5452
|
},
|
|
5663
5453
|
ImplementationClassUID: {
|
|
5664
5454
|
Value: [DicomMetaDictionary.uid()],
|
|
5665
|
-
// TODO: could be git hash or other valid id
|
|
5666
5455
|
vr: "UI"
|
|
5667
5456
|
},
|
|
5668
5457
|
ImplementationVersionName: {
|
|
@@ -5671,25 +5460,11 @@
|
|
|
5671
5460
|
}
|
|
5672
5461
|
};
|
|
5673
5462
|
dataset._meta = _meta;
|
|
5674
|
-
//@ts-ignore
|
|
5675
5463
|
dataset.SpecificCharacterSet = "ISO_IR 192";
|
|
5676
5464
|
return dataset;
|
|
5677
5465
|
}
|
|
5678
|
-
// /**
|
|
5679
|
-
// * Generate Cornerstone tool state from dataset
|
|
5680
|
-
// * @param {object} dataset dataset
|
|
5681
|
-
// * @param {object} hooks
|
|
5682
|
-
// * @param {function} hooks.getToolClass Function to map dataset to a tool class
|
|
5683
|
-
// * @returns
|
|
5684
|
-
// */
|
|
5685
|
-
// //static generateToolState(_dataset, _hooks = {}) {
|
|
5686
|
-
// function generateToolState() {
|
|
5687
|
-
// // Todo
|
|
5688
|
-
// console.warn("RTSS.generateToolState not implemented");
|
|
5689
|
-
// }
|
|
5690
5466
|
function _initializeDataset(rtMetadata, imgMetadata, metadataProvider) {
|
|
5691
5467
|
var rtSOPInstanceUID = DicomMetaDictionary.uid();
|
|
5692
|
-
// get the first annotation data
|
|
5693
5468
|
var imageId = imgMetadata.referencedImageId,
|
|
5694
5469
|
FrameOfReferenceUID = imgMetadata.FrameOfReferenceUID;
|
|
5695
5470
|
var _metadataProvider$get = metadataProvider.get("generalSeriesModule", imageId),
|
|
@@ -5705,7 +5480,6 @@
|
|
|
5705
5480
|
}, patientModule), rtSeriesModule), {}, {
|
|
5706
5481
|
StudyInstanceUID: studyInstanceUID,
|
|
5707
5482
|
SOPClassUID: "1.2.840.10008.5.1.4.1.1.481.3",
|
|
5708
|
-
// RT Structure Set Storage
|
|
5709
5483
|
SOPInstanceUID: rtSOPInstanceUID,
|
|
5710
5484
|
Manufacturer: "dcmjs",
|
|
5711
5485
|
Modality: "RTSTRUCT",
|
|
@@ -5954,7 +5728,6 @@
|
|
|
5954
5728
|
var adaptersPMAP = {
|
|
5955
5729
|
Cornerstone: CornerstonePMAP,
|
|
5956
5730
|
Cornerstone3D: Cornerstone3DPMAP
|
|
5957
|
-
// VTKjs: VTKjsPMAP
|
|
5958
5731
|
};
|
|
5959
5732
|
var adaptersRT = {
|
|
5960
5733
|
Cornerstone3D: Cornerstone3DRT
|