@cornerstonejs/adapters 2.7.4 → 2.8.1

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.
@@ -10,4 +10,4 @@ declare namespace Segmentation {
10
10
  }
11
11
  export function fillSegmentation(segmentation: any, inputLabelmaps3D: any, userOptions?: {}): object;
12
12
  export function generateSegmentation(images: object[], inputLabelmaps3D: any | any[], userOptions?: any): Blob;
13
- export function generateToolState(imageIds: string[], arrayBuffer: ArrayBuffer, metadataProvider: any, options: obj): [];
13
+ export function generateToolState(referencedImageIds: string[], arrayBuffer: ArrayBuffer, metadataProvider: any, options: obj): [];
@@ -167,7 +167,7 @@ function _createSegFromImages(images, isMultiframe, options) {
167
167
  * generateToolState - Given a set of cornerstoneTools imageIds and a Segmentation buffer,
168
168
  * derive cornerstoneTools toolState and brush metadata.
169
169
  *
170
- * @param {string[]} imageIds - An array of the imageIds.
170
+ * @param {string[]} referencedImageIds - An array for referenced image imageIds.
171
171
  * @param {ArrayBuffer} arrayBuffer - The SEG arrayBuffer.
172
172
  * @param {*} metadataProvider.
173
173
  * @param {obj} options - Options object.
@@ -332,18 +332,18 @@ function generateToolState(_x, _x2, _x3, _x4) {
332
332
  * @returns {String} Returns the imageId
333
333
  */
334
334
  function _generateToolState() {
335
- _generateToolState = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(imageIds, arrayBuffer, metadataProvider, options) {
336
- var _options$skipOverlapp, skipOverlapping, _options$tolerance, tolerance, _options$TypedArrayCo, TypedArrayConstructor, _options$maxBytesPerC, maxBytesPerChunk, eventTarget, triggerEvent, dicomData, dataset, multiframe, imagePlaneModule, generalSeriesModule, SeriesInstanceUID, ImageOrientationPatient, validOrientations, sliceLength, segMetadata, TransferSyntaxUID, pixelData, pixelDataChunks, rleEncodedFrames, orientation, sopUIDImageIdIndexMap, overlapping, insertFunction, segmentsOnFrameArray, segmentsOnFrame, arrayBufferLength, labelmapBufferArray, imageIdMaps, segmentsPixelIndices, overlappingSegments, centroidXYZ;
335
+ _generateToolState = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(referencedImageIds, arrayBuffer, metadataProvider, options) {
336
+ var _options$skipOverlapp, skipOverlapping, _options$tolerance, tolerance, _options$TypedArrayCo, TypedArrayConstructor, _options$maxBytesPerC, maxBytesPerChunk, _options$eventTarget, eventTarget, _options$triggerEvent, triggerEvent, dicomData, dataset, multiframe, imagePlaneModule, generalSeriesModule, SeriesInstanceUID, ImageOrientationPatient, validOrientations, sliceLength, segMetadata, TransferSyntaxUID, pixelData, pixelDataChunks, rleEncodedFrames, orientation, sopUIDImageIdIndexMap, overlapping, insertFunction, segmentsOnFrameArray, segmentsOnFrame, arrayBufferLength, labelmapBufferArray, imageIdMaps, segmentsPixelIndices, overlappingSegments, centroidXYZ;
337
337
  return _regeneratorRuntime().wrap(function _callee$(_context) {
338
338
  while (1) switch (_context.prev = _context.next) {
339
339
  case 0:
340
- _options$skipOverlapp = options.skipOverlapping, skipOverlapping = _options$skipOverlapp === void 0 ? false : _options$skipOverlapp, _options$tolerance = options.tolerance, tolerance = _options$tolerance === void 0 ? 1e-3 : _options$tolerance, _options$TypedArrayCo = options.TypedArrayConstructor, TypedArrayConstructor = _options$TypedArrayCo === void 0 ? Uint8Array : _options$TypedArrayCo, _options$maxBytesPerC = options.maxBytesPerChunk, maxBytesPerChunk = _options$maxBytesPerC === void 0 ? 199000000 : _options$maxBytesPerC, eventTarget = options.eventTarget, triggerEvent = options.triggerEvent;
340
+ _options$skipOverlapp = options.skipOverlapping, skipOverlapping = _options$skipOverlapp === void 0 ? false : _options$skipOverlapp, _options$tolerance = options.tolerance, tolerance = _options$tolerance === void 0 ? 1e-3 : _options$tolerance, _options$TypedArrayCo = options.TypedArrayConstructor, TypedArrayConstructor = _options$TypedArrayCo === void 0 ? Uint8Array : _options$TypedArrayCo, _options$maxBytesPerC = options.maxBytesPerChunk, maxBytesPerChunk = _options$maxBytesPerC === void 0 ? 199000000 : _options$maxBytesPerC, _options$eventTarget = options.eventTarget, eventTarget = _options$eventTarget === void 0 ? null : _options$eventTarget, _options$triggerEvent = options.triggerEvent, triggerEvent = _options$triggerEvent === void 0 ? null : _options$triggerEvent;
341
341
  dicomData = DicomMessage.readFile(arrayBuffer);
342
342
  dataset = DicomMetaDictionary.naturalizeDataset(dicomData.dict);
343
343
  dataset._meta = DicomMetaDictionary.namifyDataset(dicomData.meta);
344
344
  multiframe = Normalizer.normalizeToDataset([dataset]);
345
- imagePlaneModule = metadataProvider.get("imagePlaneModule", imageIds[0]);
346
- generalSeriesModule = metadataProvider.get("generalSeriesModule", imageIds[0]);
345
+ imagePlaneModule = metadataProvider.get("imagePlaneModule", referencedImageIds[0]);
346
+ generalSeriesModule = metadataProvider.get("generalSeriesModule", referencedImageIds[0]);
347
347
  SeriesInstanceUID = generalSeriesModule.seriesInstanceUID;
348
348
  if (!imagePlaneModule) {
349
349
  console.warn("Insufficient metadata, imagePlaneModule missing.");
@@ -380,10 +380,10 @@ function _generateToolState() {
380
380
  }
381
381
  throw new Error("Fractional segmentations are not yet supported");
382
382
  case 26:
383
- orientation = checkOrientation(multiframe, validOrientations, [imagePlaneModule.rows, imagePlaneModule.columns, imageIds.length], tolerance); // Pre-compute the sop UID to imageId index map so that in the for loop
383
+ orientation = checkOrientation(multiframe, validOrientations, [imagePlaneModule.rows, imagePlaneModule.columns, referencedImageIds.length], tolerance); // Pre-compute the sop UID to imageId index map so that in the for loop
384
384
  // we don't have to call metadataProvider.get() for each imageId over
385
385
  // and over again.
386
- sopUIDImageIdIndexMap = imageIds.reduce(function (acc, imageId) {
386
+ sopUIDImageIdIndexMap = referencedImageIds.reduce(function (acc, imageId) {
387
387
  var _metadataProvider$get = metadataProvider.get("generalImageModule", imageId),
388
388
  sopInstanceUID = _metadataProvider$get.sopInstanceUID;
389
389
  acc[sopInstanceUID] = imageId;
@@ -391,7 +391,7 @@ function _generateToolState() {
391
391
  }, {});
392
392
  overlapping = false;
393
393
  if (!skipOverlapping) {
394
- overlapping = checkSEGsOverlapping(pixelDataChunks, multiframe, imageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, sopUIDImageIdIndexMap);
394
+ overlapping = checkSEGsOverlapping(pixelDataChunks, multiframe, referencedImageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, sopUIDImageIdIndexMap);
395
395
  }
396
396
  _context.t0 = orientation;
397
397
  _context.next = _context.t0 === "Planar" ? 33 : _context.t0 === "Perpendicular" ? 35 : _context.t0 === "Oblique" ? 36 : 37;
@@ -416,13 +416,13 @@ function _generateToolState() {
416
416
  segmentsOnFrameArray = [];
417
417
  segmentsOnFrameArray[0] = [];
418
418
  segmentsOnFrame = [];
419
- arrayBufferLength = sliceLength * imageIds.length * TypedArrayConstructor.BYTES_PER_ELEMENT;
419
+ arrayBufferLength = sliceLength * referencedImageIds.length * TypedArrayConstructor.BYTES_PER_ELEMENT;
420
420
  labelmapBufferArray = [];
421
421
  labelmapBufferArray[0] = new ArrayBuffer(arrayBufferLength);
422
422
 
423
423
  // Pre-compute the indices and metadata so that we don't have to call
424
424
  // a function for each imageId in the for loop.
425
- imageIdMaps = imageIds.reduce(function (acc, curr, index) {
425
+ imageIdMaps = referencedImageIds.reduce(function (acc, curr, index) {
426
426
  acc.indices[curr] = index;
427
427
  acc.metadata[curr] = metadataProvider.get("instance", curr);
428
428
  return acc;
@@ -435,13 +435,13 @@ function _generateToolState() {
435
435
  // segment in the labelmapBuffer
436
436
  segmentsPixelIndices = new Map();
437
437
  _context.next = 47;
438
- return insertFunction(segmentsOnFrame, segmentsOnFrameArray, labelmapBufferArray, pixelDataChunks, multiframe, imageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps, eventTarget, triggerEvent);
438
+ return insertFunction(segmentsOnFrame, segmentsOnFrameArray, labelmapBufferArray, pixelDataChunks, multiframe, referencedImageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps, eventTarget, triggerEvent);
439
439
  case 47:
440
440
  overlappingSegments = _context.sent;
441
441
  // calculate the centroid of each segment
442
442
  centroidXYZ = new Map();
443
443
  segmentsPixelIndices.forEach(function (imageIdIndexBufferIndex, segmentIndex) {
444
- var centroids = calculateCentroid(imageIdIndexBufferIndex, multiframe, metadataProvider, imageIds);
444
+ var centroids = calculateCentroid(imageIdIndexBufferIndex, multiframe, metadataProvider, referencedImageIds);
445
445
  centroidXYZ.set(segmentIndex, centroids);
446
446
  });
447
447
  return _context.abrupt("return", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/adapters",
3
- "version": "2.7.4",
3
+ "version": "2.8.1",
4
4
  "description": "Adapters for Cornerstone3D to/from formats including DICOM SR and others",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -84,8 +84,8 @@
84
84
  "ndarray": "^1.0.19"
85
85
  },
86
86
  "peerDependencies": {
87
- "@cornerstonejs/core": "^2.7.4",
88
- "@cornerstonejs/tools": "^2.7.4"
87
+ "@cornerstonejs/core": "^2.8.1",
88
+ "@cornerstonejs/tools": "^2.8.1"
89
89
  },
90
- "gitHead": "d386daf61a0fe0fb2f049e8456c3497839e7e4fa"
90
+ "gitHead": "1e0cd54783c405d4a72e2b23d7d519873d0c71da"
91
91
  }