@cornerstonejs/adapters 3.0.0-beta.5 → 3.0.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/esm/adapters/Cornerstone/Angle.js +61 -74
- package/dist/esm/adapters/Cornerstone/ArrowAnnotate.js +76 -76
- package/dist/esm/adapters/Cornerstone/Bidirectional.js +130 -146
- package/dist/esm/adapters/Cornerstone/CircleRoi.js +96 -95
- package/dist/esm/adapters/Cornerstone/CobbAngle.js +66 -79
- package/dist/esm/adapters/Cornerstone/EllipticalRoi.js +152 -152
- package/dist/esm/adapters/Cornerstone/FreehandRoi.js +68 -69
- package/dist/esm/adapters/Cornerstone/Length.js +54 -63
- package/dist/esm/adapters/Cornerstone/MeasurementReport.js +221 -224
- package/dist/esm/adapters/Cornerstone/ParametricMap.js +88 -110
- package/dist/esm/adapters/Cornerstone/RectangleRoi.js +72 -78
- package/dist/esm/adapters/Cornerstone/Segmentation.js +7 -7
- package/dist/esm/adapters/Cornerstone/Segmentation_3X.js +113 -104
- package/dist/esm/adapters/Cornerstone/Segmentation_4X.js +434 -462
- package/dist/esm/adapters/Cornerstone/index.js +14 -14
- package/dist/esm/adapters/Cornerstone3D/Angle.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/Angle.js +89 -100
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.d.ts +5 -11
- package/dist/esm/adapters/Cornerstone3D/ArrowAnnotate.js +106 -118
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.d.ts +43 -0
- package/dist/esm/adapters/Cornerstone3D/BaseAdapter3D.js +92 -0
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/Bidirectional.js +118 -133
- package/dist/esm/adapters/Cornerstone3D/CircleROI.d.ts +2 -7
- package/dist/esm/adapters/Cornerstone3D/CircleROI.js +85 -85
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/CobbAngle.js +93 -104
- package/dist/esm/adapters/Cornerstone3D/CodingScheme.js +5 -5
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.d.ts +2 -7
- package/dist/esm/adapters/Cornerstone3D/EllipticalROI.js +148 -149
- package/dist/esm/adapters/Cornerstone3D/KeyImage.d.ts +24 -0
- package/dist/esm/adapters/Cornerstone3D/KeyImage.js +49 -0
- package/dist/esm/adapters/Cornerstone3D/Length.d.ts +2 -10
- package/dist/esm/adapters/Cornerstone3D/Length.js +83 -93
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.d.ts +23 -4
- package/dist/esm/adapters/Cornerstone3D/MeasurementReport.js +259 -240
- package/dist/esm/adapters/Cornerstone3D/ParametricMap/generateToolState.js +8 -4
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.d.ts +3 -5
- package/dist/esm/adapters/Cornerstone3D/PlanarFreehandROI.js +99 -115
- package/dist/esm/adapters/Cornerstone3D/Probe.d.ts +4 -17
- package/dist/esm/adapters/Cornerstone3D/Probe.js +38 -79
- package/dist/esm/adapters/Cornerstone3D/RTStruct/RTSS.js +60 -52
- package/dist/esm/adapters/Cornerstone3D/RTStruct/index.js +3 -1
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getPatientModule.js +5 -5
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedFrameOfReferenceSequence.js +14 -10
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getReferencedSeriesSequence.js +17 -11
- package/dist/esm/adapters/Cornerstone3D/RTStruct/utilities/getStructureSetModule.js +3 -1
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/RectangleROI.js +73 -85
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateLabelMaps2DFrom3D.js +15 -13
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateSegmentation.js +15 -9
- package/dist/esm/adapters/Cornerstone3D/Segmentation/generateToolState.js +10 -10
- package/dist/esm/adapters/Cornerstone3D/Segmentation/labelmapImagesFromBuffer.js +134 -151
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.d.ts +2 -5
- package/dist/esm/adapters/Cornerstone3D/UltrasoundDirectional.js +68 -84
- package/dist/esm/adapters/Cornerstone3D/index.d.ts +4 -0
- package/dist/esm/adapters/Cornerstone3D/index.js +21 -17
- package/dist/esm/adapters/VTKjs/Segmentation.js +66 -72
- package/dist/esm/adapters/VTKjs/index.js +2 -2
- package/dist/esm/adapters/helpers/checkIfPerpendicular.js +2 -2
- package/dist/esm/adapters/helpers/checkOrientation.js +8 -8
- package/dist/esm/adapters/helpers/codeMeaningEquals.js +2 -2
- package/dist/esm/adapters/helpers/compareArrays.js +4 -2
- package/dist/esm/adapters/helpers/downloadDICOMData.js +6 -4
- package/dist/esm/adapters/helpers/getDatasetsFromImages.js +20 -18
- package/dist/esm/adapters/helpers/graphicTypeEquals.js +2 -2
- package/dist/esm/adapters/helpers/toArray.js +1 -3
- package/dist/esm/adapters/index.d.ts +2 -0
- package/dist/esm/adapters/index.js +6 -5
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/defineProperty.js +18 -0
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/esm/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
- package/package.json +4 -4
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +0 -493
- package/dist/esm/adapters/Cornerstone3D/isValidCornerstoneTrackingIdentifier.js +0 -18
|
@@ -1,177 +1,160 @@
|
|
|
1
|
-
import { asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime, toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { imageLoader } from '@cornerstonejs/core';
|
|
3
|
-
import { data, normalizers
|
|
2
|
+
import { utilities, data, normalizers } from 'dcmjs';
|
|
4
3
|
import ndarray from 'ndarray';
|
|
5
4
|
import checkOrientation from '../../helpers/checkOrientation.js';
|
|
6
|
-
import {
|
|
5
|
+
import { getValidOrientations, getSegmentMetadata, unpackPixelData, checkSEGsOverlapping, calculateCentroid, readFromUnpackedChunks, alignPixelDataWithSourceData, getSegmentIndex, findReferenceSourceImageId } from '../../Cornerstone/Segmentation_4X.js';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
case 32:
|
|
77
|
-
if (!overlapping) {
|
|
78
|
-
_context.next = 36;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
throw new Error("Overlapping segmentations are not yet supported.");
|
|
82
|
-
case 36:
|
|
83
|
-
insertFunction = insertPixelDataPlanar;
|
|
84
|
-
case 37:
|
|
85
|
-
return _context.abrupt("break", 40);
|
|
86
|
-
case 38:
|
|
87
|
-
throw new Error("Segmentations orthogonal to the acquisition plane of the source data are not yet supported.");
|
|
88
|
-
case 39:
|
|
89
|
-
throw new Error("Segmentations oblique to the acquisition plane of the source data are not yet supported.");
|
|
90
|
-
case 40:
|
|
91
|
-
segmentsOnFrameArray = [];
|
|
92
|
-
segmentsOnFrameArray[0] = [];
|
|
93
|
-
segmentsOnFrame = [];
|
|
94
|
-
imageIdMaps = {
|
|
95
|
-
indices: {},
|
|
96
|
-
metadata: {}
|
|
97
|
-
};
|
|
98
|
-
labelMapImages = [];
|
|
99
|
-
for (i = 0; i < referencedImageIds.length; i++) {
|
|
100
|
-
referenceImageId = referencedImageIds[i];
|
|
101
|
-
imageIdMaps.indices[referenceImageId] = i;
|
|
102
|
-
imageIdMaps.metadata[referenceImageId] = metadataProvider.get("instance", referenceImageId);
|
|
103
|
-
labelMapImage = imageLoader.createAndCacheDerivedLabelmapImage(referenceImageId);
|
|
104
|
-
labelMapImages.push(labelMapImage);
|
|
105
|
-
}
|
|
106
|
-
segmentsPixelIndices = new Map();
|
|
107
|
-
_context.next = 49;
|
|
108
|
-
return insertFunction(segmentsOnFrame, labelMapImages, pixelDataChunks, multiframe, referencedImageIds, validOrientations, metadataProvider, tolerance, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps);
|
|
109
|
-
case 49:
|
|
110
|
-
overlappingSegments = _context.sent;
|
|
111
|
-
centroidXYZ = new Map();
|
|
112
|
-
segmentsPixelIndices.forEach(function (imageIdIndexBufferIndex, segmentIndex) {
|
|
113
|
-
var centroids = calculateCentroid(imageIdIndexBufferIndex, multiframe, metadataProvider, referencedImageIds);
|
|
114
|
-
centroidXYZ.set(segmentIndex, centroids);
|
|
115
|
-
});
|
|
116
|
-
return _context.abrupt("return", {
|
|
117
|
-
labelMapImages: [labelMapImages],
|
|
118
|
-
segMetadata: segMetadata,
|
|
119
|
-
segmentsOnFrame: segmentsOnFrame,
|
|
120
|
-
segmentsOnFrameArray: segmentsOnFrameArray,
|
|
121
|
-
centroids: centroidXYZ,
|
|
122
|
-
overlappingSegments: overlappingSegments
|
|
123
|
-
});
|
|
124
|
-
case 53:
|
|
125
|
-
case "end":
|
|
126
|
-
return _context.stop();
|
|
7
|
+
const {
|
|
8
|
+
DicomMessage,
|
|
9
|
+
DicomMetaDictionary
|
|
10
|
+
} = data;
|
|
11
|
+
const {
|
|
12
|
+
Normalizer
|
|
13
|
+
} = normalizers;
|
|
14
|
+
const {
|
|
15
|
+
decode
|
|
16
|
+
} = utilities.compression;
|
|
17
|
+
async function createLabelmapsFromBufferInternal(referencedImageIds, arrayBuffer, metadataProvider, options) {
|
|
18
|
+
const {
|
|
19
|
+
skipOverlapping = false,
|
|
20
|
+
tolerance = 1e-3,
|
|
21
|
+
TypedArrayConstructor = Uint8Array,
|
|
22
|
+
maxBytesPerChunk = 199000000
|
|
23
|
+
} = options;
|
|
24
|
+
const dicomData = DicomMessage.readFile(arrayBuffer);
|
|
25
|
+
const dataset = DicomMetaDictionary.naturalizeDataset(dicomData.dict);
|
|
26
|
+
dataset._meta = DicomMetaDictionary.namifyDataset(dicomData.meta);
|
|
27
|
+
const multiframe = Normalizer.normalizeToDataset([dataset]);
|
|
28
|
+
const imagePlaneModule = metadataProvider.get("imagePlaneModule", referencedImageIds[0]);
|
|
29
|
+
const generalSeriesModule = metadataProvider.get("generalSeriesModule", referencedImageIds[0]);
|
|
30
|
+
const SeriesInstanceUID = generalSeriesModule.seriesInstanceUID;
|
|
31
|
+
if (!imagePlaneModule) {
|
|
32
|
+
console.warn("Insufficient metadata, imagePlaneModule missing.");
|
|
33
|
+
}
|
|
34
|
+
const ImageOrientationPatient = Array.isArray(imagePlaneModule.rowCosines) ? [...imagePlaneModule.rowCosines, ...imagePlaneModule.columnCosines] : [imagePlaneModule.rowCosines.x, imagePlaneModule.rowCosines.y, imagePlaneModule.rowCosines.z, imagePlaneModule.columnCosines.x, imagePlaneModule.columnCosines.y, imagePlaneModule.columnCosines.z];
|
|
35
|
+
const validOrientations = getValidOrientations(ImageOrientationPatient);
|
|
36
|
+
const segMetadata = getSegmentMetadata(multiframe, SeriesInstanceUID);
|
|
37
|
+
const TransferSyntaxUID = multiframe._meta.TransferSyntaxUID.Value[0];
|
|
38
|
+
let pixelData;
|
|
39
|
+
let pixelDataChunks;
|
|
40
|
+
if (TransferSyntaxUID === "1.2.840.10008.1.2.5") {
|
|
41
|
+
const rleEncodedFrames = Array.isArray(multiframe.PixelData) ? multiframe.PixelData : [multiframe.PixelData];
|
|
42
|
+
pixelData = decode(rleEncodedFrames, multiframe.Rows, multiframe.Columns);
|
|
43
|
+
if (multiframe.BitsStored === 1) {
|
|
44
|
+
console.warn("No implementation for rle + bit packing.");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
pixelDataChunks = [pixelData];
|
|
48
|
+
} else {
|
|
49
|
+
pixelDataChunks = unpackPixelData(multiframe, {
|
|
50
|
+
maxBytesPerChunk
|
|
51
|
+
});
|
|
52
|
+
if (!pixelDataChunks) {
|
|
53
|
+
throw new Error("Fractional segmentations are not yet supported");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const orientation = checkOrientation(multiframe, validOrientations, [imagePlaneModule.rows, imagePlaneModule.columns, referencedImageIds.length], tolerance);
|
|
57
|
+
const sopUIDImageIdIndexMap = referencedImageIds.reduce((acc, imageId) => {
|
|
58
|
+
const {
|
|
59
|
+
sopInstanceUID
|
|
60
|
+
} = metadataProvider.get("generalImageModule", imageId);
|
|
61
|
+
acc[sopInstanceUID] = imageId;
|
|
62
|
+
return acc;
|
|
63
|
+
}, {});
|
|
64
|
+
let overlapping = false;
|
|
65
|
+
if (!skipOverlapping) {
|
|
66
|
+
overlapping = checkSEGsOverlapping(pixelDataChunks, multiframe, referencedImageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, sopUIDImageIdIndexMap);
|
|
67
|
+
}
|
|
68
|
+
let insertFunction;
|
|
69
|
+
switch (orientation) {
|
|
70
|
+
case "Planar":
|
|
71
|
+
if (overlapping) {
|
|
72
|
+
throw new Error("Overlapping segmentations are not yet supported.");
|
|
73
|
+
} else {
|
|
74
|
+
insertFunction = insertPixelDataPlanar;
|
|
127
75
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
76
|
+
break;
|
|
77
|
+
case "Perpendicular":
|
|
78
|
+
throw new Error("Segmentations orthogonal to the acquisition plane of the source data are not yet supported.");
|
|
79
|
+
case "Oblique":
|
|
80
|
+
throw new Error("Segmentations oblique to the acquisition plane of the source data are not yet supported.");
|
|
81
|
+
}
|
|
82
|
+
const segmentsOnFrameArray = [];
|
|
83
|
+
segmentsOnFrameArray[0] = [];
|
|
84
|
+
const segmentsOnFrame = [];
|
|
85
|
+
const imageIdMaps = {
|
|
86
|
+
indices: {},
|
|
87
|
+
metadata: {}
|
|
88
|
+
};
|
|
89
|
+
const labelMapImages = [];
|
|
90
|
+
for (let i = 0; i < referencedImageIds.length; i++) {
|
|
91
|
+
const referenceImageId = referencedImageIds[i];
|
|
92
|
+
imageIdMaps.indices[referenceImageId] = i;
|
|
93
|
+
imageIdMaps.metadata[referenceImageId] = metadataProvider.get("instance", referenceImageId);
|
|
94
|
+
const labelMapImage = imageLoader.createAndCacheDerivedLabelmapImage(referenceImageId);
|
|
95
|
+
labelMapImages.push(labelMapImage);
|
|
96
|
+
}
|
|
97
|
+
const segmentsPixelIndices = new Map();
|
|
98
|
+
const overlappingSegments = await insertFunction(segmentsOnFrame, labelMapImages, pixelDataChunks, multiframe, referencedImageIds, validOrientations, metadataProvider, tolerance, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps);
|
|
99
|
+
const centroidXYZ = new Map();
|
|
100
|
+
segmentsPixelIndices.forEach((imageIdIndexBufferIndex, segmentIndex) => {
|
|
101
|
+
const centroids = calculateCentroid(imageIdIndexBufferIndex, multiframe, metadataProvider, referencedImageIds);
|
|
102
|
+
centroidXYZ.set(segmentIndex, centroids);
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
labelMapImages: [labelMapImages],
|
|
106
|
+
segMetadata,
|
|
107
|
+
segmentsOnFrame,
|
|
108
|
+
segmentsOnFrameArray,
|
|
109
|
+
centroids: centroidXYZ,
|
|
110
|
+
overlappingSegments
|
|
111
|
+
};
|
|
131
112
|
}
|
|
132
113
|
function insertPixelDataPlanar(segmentsOnFrame, labelMapImages, pixelData, multiframe, imageIds, validOrientations, metadataProvider, tolerance, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
114
|
+
const {
|
|
115
|
+
SharedFunctionalGroupsSequence,
|
|
116
|
+
PerFrameFunctionalGroupsSequence,
|
|
117
|
+
Rows,
|
|
118
|
+
Columns
|
|
119
|
+
} = multiframe;
|
|
120
|
+
const sharedImageOrientationPatient = SharedFunctionalGroupsSequence.PlaneOrientationSequence ? SharedFunctionalGroupsSequence.PlaneOrientationSequence.ImageOrientationPatient : undefined;
|
|
121
|
+
const sliceLength = Columns * Rows;
|
|
122
|
+
const groupsLen = PerFrameFunctionalGroupsSequence.length;
|
|
123
|
+
let overlapping = false;
|
|
124
|
+
return new Promise(resolve => {
|
|
125
|
+
for (let i = 0; i < groupsLen; ++i) {
|
|
126
|
+
const PerFrameFunctionalGroups = PerFrameFunctionalGroupsSequence[i];
|
|
127
|
+
const ImageOrientationPatientI = sharedImageOrientationPatient || PerFrameFunctionalGroups.PlaneOrientationSequence.ImageOrientationPatient;
|
|
128
|
+
const view = readFromUnpackedChunks(pixelData, i * sliceLength, sliceLength);
|
|
129
|
+
const pixelDataI2D = ndarray(view, [Rows, Columns]);
|
|
130
|
+
const alignedPixelDataI = alignPixelDataWithSourceData(pixelDataI2D, ImageOrientationPatientI, validOrientations, tolerance);
|
|
148
131
|
if (!alignedPixelDataI) {
|
|
149
132
|
throw new Error("Individual SEG frames are out of plane with respect to the first SEG frame. " + "This is not yet supported. Aborting segmentation loading.");
|
|
150
133
|
}
|
|
151
|
-
|
|
134
|
+
const segmentIndex = getSegmentIndex(multiframe, i);
|
|
152
135
|
if (segmentIndex === undefined) {
|
|
153
136
|
throw new Error("Could not retrieve the segment index. Aborting segmentation loading.");
|
|
154
137
|
}
|
|
155
138
|
if (!segmentsPixelIndices.has(segmentIndex)) {
|
|
156
139
|
segmentsPixelIndices.set(segmentIndex, {});
|
|
157
140
|
}
|
|
158
|
-
|
|
141
|
+
const imageId = findReferenceSourceImageId(multiframe, i, imageIds, metadataProvider, tolerance, sopUIDImageIdIndexMap);
|
|
159
142
|
if (!imageId) {
|
|
160
143
|
console.warn("Image not present in stack, can't import frame : " + i + ".");
|
|
161
144
|
continue;
|
|
162
145
|
}
|
|
163
|
-
|
|
146
|
+
const sourceImageMetadata = imageIdMaps.metadata[imageId];
|
|
164
147
|
if (Rows !== sourceImageMetadata.Rows || Columns !== sourceImageMetadata.Columns) {
|
|
165
148
|
throw new Error("Individual SEG frames have different geometry dimensions (Rows and Columns) " + "respect to the source image reference frame. This is not yet supported. " + "Aborting segmentation loading. ");
|
|
166
149
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
for (
|
|
150
|
+
const imageIdIndex = imageIdMaps.indices[imageId];
|
|
151
|
+
const labelmapImage = labelMapImages[imageIdIndex];
|
|
152
|
+
const labelmap2DView = labelmapImage.getPixelData();
|
|
153
|
+
const data = alignedPixelDataI.data;
|
|
154
|
+
const indexCache = [];
|
|
155
|
+
for (let j = 0, len = alignedPixelDataI.data.length; j < len; ++j) {
|
|
173
156
|
if (data[j]) {
|
|
174
|
-
for (
|
|
157
|
+
for (let x = j; x < len; ++x) {
|
|
175
158
|
if (data[x]) {
|
|
176
159
|
if (!overlapping && labelmap2DView[x] !== 0) {
|
|
177
160
|
overlapping = true;
|
|
@@ -187,7 +170,7 @@ function insertPixelDataPlanar(segmentsOnFrame, labelMapImages, pixelData, multi
|
|
|
187
170
|
break;
|
|
188
171
|
}
|
|
189
172
|
}
|
|
190
|
-
|
|
173
|
+
const segmentIndexObject = segmentsPixelIndices.get(segmentIndex);
|
|
191
174
|
segmentIndexObject[imageIdIndex] = indexCache;
|
|
192
175
|
segmentsPixelIndices.set(segmentIndex, segmentIndexObject);
|
|
193
176
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
static utilityToolType: string;
|
|
4
|
-
static TID300Representation: any;
|
|
5
|
-
static isValidCornerstoneTrackingIdentifier: (TrackingIdentifier: any) => boolean;
|
|
1
|
+
import BaseAdapter3D from "./BaseAdapter3D";
|
|
2
|
+
declare class UltrasoundDirectional extends BaseAdapter3D {
|
|
6
3
|
static getMeasurementData(MeasurementGroup: any, sopInstanceUIDToImageIdMap: any, imageToWorldCoords: any, metadata: any): {
|
|
7
4
|
description: any;
|
|
8
5
|
sopInstanceUid: any;
|
|
@@ -1,93 +1,77 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray, createClass as _createClass, classCallCheck as _classCallCheck } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { utilities } from 'dcmjs';
|
|
3
|
-
import CORNERSTONE_3D_TAG from './cornerstone3DTag.js';
|
|
4
2
|
import MeasurementReport from './MeasurementReport.js';
|
|
3
|
+
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
5
4
|
|
|
6
5
|
var _UltrasoundDirectional;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var point = imageToWorldCoords(referencedImageId, [GraphicData[i], GraphicData[i + 1]]);
|
|
26
|
-
worldCoords.push(point);
|
|
27
|
-
}
|
|
28
|
-
var state = defaultState;
|
|
29
|
-
state.annotation.data = {
|
|
30
|
-
handles: {
|
|
31
|
-
points: [worldCoords[0], worldCoords[1]],
|
|
32
|
-
activeHandleIndex: 0,
|
|
33
|
-
textBox: {
|
|
34
|
-
hasMoved: false
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
cachedStats: {},
|
|
38
|
-
frameNumber: ReferencedFrameNumber
|
|
39
|
-
};
|
|
40
|
-
return state;
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "getTID300RepresentationArguments",
|
|
44
|
-
value: function getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
45
|
-
var data = tool.data,
|
|
46
|
-
finding = tool.finding,
|
|
47
|
-
findingSites = tool.findingSites,
|
|
48
|
-
metadata = tool.metadata;
|
|
49
|
-
var handles = data.handles;
|
|
50
|
-
var referencedImageId = metadata.referencedImageId;
|
|
51
|
-
if (!referencedImageId) {
|
|
52
|
-
throw new Error("UltrasoundDirectionalTool.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
53
|
-
}
|
|
54
|
-
var start = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
55
|
-
var end = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
56
|
-
var point1 = {
|
|
57
|
-
x: start[0],
|
|
58
|
-
y: start[1]
|
|
59
|
-
};
|
|
60
|
-
var point2 = {
|
|
61
|
-
x: end[0],
|
|
62
|
-
y: end[1]
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
point1: point1,
|
|
66
|
-
point2: point2,
|
|
67
|
-
trackingIdentifierTextValue: trackingIdentifierTextValue,
|
|
68
|
-
finding: finding,
|
|
69
|
-
findingSites: findingSites || []
|
|
70
|
-
};
|
|
6
|
+
const {
|
|
7
|
+
Length: TID300Length
|
|
8
|
+
} = utilities.TID300;
|
|
9
|
+
class UltrasoundDirectional extends BaseAdapter3D {
|
|
10
|
+
static getMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, imageToWorldCoords, metadata) {
|
|
11
|
+
const {
|
|
12
|
+
defaultState,
|
|
13
|
+
SCOORDGroup,
|
|
14
|
+
ReferencedFrameNumber
|
|
15
|
+
} = MeasurementReport.getSetupMeasurementData(MeasurementGroup, sopInstanceUIDToImageIdMap, metadata, UltrasoundDirectional.toolType);
|
|
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);
|
|
71
24
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
25
|
+
const state = defaultState;
|
|
26
|
+
state.annotation.data = {
|
|
27
|
+
handles: {
|
|
28
|
+
points: [worldCoords[0], worldCoords[1]],
|
|
29
|
+
activeHandleIndex: 0,
|
|
30
|
+
textBox: {
|
|
31
|
+
hasMoved: false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
cachedStats: {},
|
|
35
|
+
frameNumber: ReferencedFrameNumber
|
|
36
|
+
};
|
|
37
|
+
return state;
|
|
81
38
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
39
|
+
static getTID300RepresentationArguments(tool, worldToImageCoords) {
|
|
40
|
+
const {
|
|
41
|
+
data,
|
|
42
|
+
finding,
|
|
43
|
+
findingSites,
|
|
44
|
+
metadata
|
|
45
|
+
} = tool;
|
|
46
|
+
const {
|
|
47
|
+
handles
|
|
48
|
+
} = data;
|
|
49
|
+
const {
|
|
50
|
+
referencedImageId
|
|
51
|
+
} = metadata;
|
|
52
|
+
if (!referencedImageId) {
|
|
53
|
+
throw new Error("UltrasoundDirectionalTool.getTID300RepresentationArguments: referencedImageId is not defined");
|
|
54
|
+
}
|
|
55
|
+
const start = worldToImageCoords(referencedImageId, handles.points[0]);
|
|
56
|
+
const end = worldToImageCoords(referencedImageId, handles.points[1]);
|
|
57
|
+
const point1 = {
|
|
58
|
+
x: start[0],
|
|
59
|
+
y: start[1]
|
|
60
|
+
};
|
|
61
|
+
const point2 = {
|
|
62
|
+
x: end[0],
|
|
63
|
+
y: end[1]
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
point1,
|
|
67
|
+
point2,
|
|
68
|
+
trackingIdentifierTextValue: this.trackingIdentifierTextValue,
|
|
69
|
+
finding,
|
|
70
|
+
findingSites: findingSites || []
|
|
71
|
+
};
|
|
88
72
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
73
|
+
}
|
|
74
|
+
_UltrasoundDirectional = UltrasoundDirectional;
|
|
75
|
+
_UltrasoundDirectional.init("UltrasoundDirectionalTool", TID300Length);
|
|
92
76
|
|
|
93
77
|
export { UltrasoundDirectional as default };
|
|
@@ -10,10 +10,13 @@ import Length from "./Length";
|
|
|
10
10
|
import PlanarFreehandROI from "./PlanarFreehandROI";
|
|
11
11
|
import Probe from "./Probe";
|
|
12
12
|
import UltrasoundDirectional from "./UltrasoundDirectional";
|
|
13
|
+
import BaseAdapter3D from "./BaseAdapter3D";
|
|
13
14
|
import * as Segmentation from "./Segmentation";
|
|
14
15
|
import * as ParametricMap from "./ParametricMap";
|
|
15
16
|
import * as RTSS from "./RTStruct";
|
|
17
|
+
import KeyImage from "./KeyImage";
|
|
16
18
|
declare const Cornerstone3DSR: {
|
|
19
|
+
BaseAdapter3D: typeof BaseAdapter3D;
|
|
17
20
|
Bidirectional: typeof Bidirectional;
|
|
18
21
|
CobbAngle: typeof CobbAngle;
|
|
19
22
|
Angle: typeof Angle;
|
|
@@ -25,6 +28,7 @@ declare const Cornerstone3DSR: {
|
|
|
25
28
|
Probe: typeof Probe;
|
|
26
29
|
PlanarFreehandROI: typeof PlanarFreehandROI;
|
|
27
30
|
UltrasoundDirectional: typeof UltrasoundDirectional;
|
|
31
|
+
KeyImage: typeof KeyImage;
|
|
28
32
|
MeasurementReport: typeof MeasurementReport;
|
|
29
33
|
CodeScheme: {
|
|
30
34
|
CodingSchemeDesignator: string;
|
|
@@ -12,33 +12,37 @@ import Length from './Length.js';
|
|
|
12
12
|
import PlanarFreehandROI from './PlanarFreehandROI.js';
|
|
13
13
|
import Probe from './Probe.js';
|
|
14
14
|
import UltrasoundDirectional from './UltrasoundDirectional.js';
|
|
15
|
+
import BaseAdapter3D from './BaseAdapter3D.js';
|
|
15
16
|
import * as index from './Segmentation/index.js';
|
|
16
17
|
import * as index$1 from './ParametricMap/index.js';
|
|
17
18
|
import * as index$2 from './RTStruct/index.js';
|
|
19
|
+
import KeyImage from './KeyImage.js';
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
const Cornerstone3DSR = {
|
|
22
|
+
BaseAdapter3D,
|
|
23
|
+
Bidirectional,
|
|
24
|
+
CobbAngle,
|
|
25
|
+
Angle,
|
|
26
|
+
Length,
|
|
27
|
+
CircleROI,
|
|
28
|
+
EllipticalROI,
|
|
29
|
+
RectangleROI,
|
|
30
|
+
ArrowAnnotate,
|
|
31
|
+
Probe,
|
|
32
|
+
PlanarFreehandROI,
|
|
33
|
+
UltrasoundDirectional,
|
|
34
|
+
KeyImage,
|
|
35
|
+
MeasurementReport,
|
|
32
36
|
CodeScheme: CodingScheme,
|
|
33
|
-
CORNERSTONE_3D_TAG
|
|
37
|
+
CORNERSTONE_3D_TAG
|
|
34
38
|
};
|
|
35
|
-
|
|
39
|
+
const Cornerstone3DSEG = {
|
|
36
40
|
Segmentation: index
|
|
37
41
|
};
|
|
38
|
-
|
|
42
|
+
const Cornerstone3DPMAP = {
|
|
39
43
|
ParametricMap: index$1
|
|
40
44
|
};
|
|
41
|
-
|
|
45
|
+
const Cornerstone3DRT = {
|
|
42
46
|
RTSS: index$2
|
|
43
47
|
};
|
|
44
48
|
|