@cornerstonejs/adapters 1.43.5 → 1.43.7

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.
@@ -2604,7 +2604,7 @@ function generateToolState$2(_x, _x2, _x3, _x4) {
2604
2604
  */
2605
2605
  function _generateToolState() {
2606
2606
  _generateToolState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(imageIds, arrayBuffer, metadataProvider, options) {
2607
- 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, centroidXYZ;
2607
+ 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;
2608
2608
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2609
2609
  while (1) switch (_context.prev = _context.next) {
2610
2610
  case 0:
@@ -2691,7 +2691,7 @@ function _generateToolState() {
2691
2691
  labelmapBufferArray = [];
2692
2692
  labelmapBufferArray[0] = new ArrayBuffer(arrayBufferLength);
2693
2693
 
2694
- // Precompute the indices and metadata so that we don't have to call
2694
+ // Pre-compute the indices and metadata so that we don't have to call
2695
2695
  // a function for each imageId in the for loop.
2696
2696
  imageIdMaps = imageIds.reduce(function (acc, curr, index) {
2697
2697
  acc.indices[curr] = index;
@@ -2708,6 +2708,7 @@ function _generateToolState() {
2708
2708
  _context.next = 47;
2709
2709
  return insertFunction(segmentsOnFrame, segmentsOnFrameArray, labelmapBufferArray, pixelDataChunks, multiframe, imageIds, validOrientations, metadataProvider, tolerance, TypedArrayConstructor, segmentsPixelIndices, sopUIDImageIdIndexMap, imageIdMaps, eventTarget, triggerEvent);
2710
2710
  case 47:
2711
+ overlappingSegments = _context.sent;
2711
2712
  // calculate the centroid of each segment
2712
2713
  centroidXYZ = new Map();
2713
2714
  segmentsPixelIndices.forEach(function (imageIdIndexBufferIndex, segmentIndex) {
@@ -2727,9 +2728,10 @@ function _generateToolState() {
2727
2728
  segMetadata: segMetadata,
2728
2729
  segmentsOnFrame: segmentsOnFrame,
2729
2730
  segmentsOnFrameArray: segmentsOnFrameArray,
2730
- centroids: centroidXYZ
2731
+ centroids: centroidXYZ,
2732
+ overlappingSegments: overlappingSegments
2731
2733
  });
2732
- case 50:
2734
+ case 51:
2733
2735
  case "end":
2734
2736
  return _context.stop();
2735
2737
  }
@@ -3009,7 +3011,7 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
3009
3011
  var chunkSize = Math.ceil(groupsLen / 10); // 10% of total length
3010
3012
 
3011
3013
  var shouldTriggerEvent = triggerEvent && eventTarget;
3012
-
3014
+ var overlapping = false;
3013
3015
  // Below, we chunk the processing of the frames to avoid blocking the main thread
3014
3016
  // if the segmentation is large. We also use a promise to allow the caller to
3015
3017
  // wait for the processing to finish.
@@ -3050,6 +3052,9 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
3050
3052
  if (data[j]) {
3051
3053
  for (var x = j; x < len; ++x) {
3052
3054
  if (data[x]) {
3055
+ if (!overlapping && labelmap2DView[x] !== 0) {
3056
+ overlapping = true;
3057
+ }
3053
3058
  labelmap2DView[x] = segmentIndex;
3054
3059
  indexCache.push(x);
3055
3060
  }
@@ -3079,7 +3084,7 @@ function insertPixelDataPlanar(segmentsOnFrame, segmentsOnFrameArray, labelmapBu
3079
3084
  setTimeout(processInChunks, 0);
3080
3085
  } else {
3081
3086
  // resolve the Promise when all chunks have been processed
3082
- resolve();
3087
+ resolve(overlapping);
3083
3088
  }
3084
3089
  }
3085
3090
  processInChunks();