@cornerstonejs/adapters 1.59.0 → 1.59.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.
@@ -42735,6 +42735,22 @@ function getViewportImageIds(viewport) {
42735
42735
  }
42736
42736
  }
42737
42737
 
42738
+ function getRandomSampleFromArray(array, size) {
42739
+ const clonedArray = [...array];
42740
+ if (size >= clonedArray.length) {
42741
+ shuffleArray(clonedArray);
42742
+ return clonedArray;
42743
+ }
42744
+ shuffleArray(clonedArray);
42745
+ return clonedArray.slice(0, size);
42746
+ }
42747
+ function shuffleArray(array) {
42748
+ for (let i = array.length - 1; i > 0; i--) {
42749
+ const j = Math.floor(Math.random() * (i + 1));
42750
+ [array[i], array[j]] = [array[j], array[i]];
42751
+ }
42752
+ }
42753
+
42738
42754
  function linePlaneIntersection(p0, p1, plane) {
42739
42755
  const [x0, y0, z0] = p0;
42740
42756
  const [x1, y1, z1] = p1;
@@ -42838,6 +42854,7 @@ var utilities = /*#__PURE__*/Object.freeze({
42838
42854
  getImageLegacy: getImageLegacy,
42839
42855
  getImageSliceDataForVolumeViewport: getImageSliceDataForVolumeViewport,
42840
42856
  getMinMax: getMinMax,
42857
+ getRandomSampleFromArray: getRandomSampleFromArray,
42841
42858
  getRuntimeId: getRuntimeId,
42842
42859
  getScalarDataType: getScalarDataType,
42843
42860
  getScalingParameters: getScalingParameters,