@cornerstonejs/core 3.0.5 → 3.1.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.
@@ -1163,6 +1163,9 @@ class StackViewport extends Viewport {
1163
1163
  async setStack(imageIds, currentImageIdIndex = 0) {
1164
1164
  this._throwIfDestroyed();
1165
1165
  this.imageIds = imageIds;
1166
+ if (currentImageIdIndex > imageIds.length) {
1167
+ throw new Error('Current image index is greater than the number of images in the stack');
1168
+ }
1166
1169
  this.imageKeyToIndexMap.clear();
1167
1170
  imageIds.forEach((imageId, index) => {
1168
1171
  this.imageKeyToIndexMap.set(imageId, index);
@@ -69,10 +69,12 @@ export default class VoxelManager<T> {
69
69
  getScalarDataLength(): number;
70
70
  get sizeInBytes(): number;
71
71
  get bytePerVoxel(): number;
72
+ clearBounds(): void;
72
73
  clear(): void;
73
74
  getConstructor(): new (length: number) => PixelDataTypedArray;
74
75
  getArrayOfModifiedSlices(): number[];
75
76
  resetModifiedSlices(): void;
77
+ setBounds(bounds: BoundsIJK): void;
76
78
  static addBounds(bounds: BoundsIJK, point: Point3): void;
77
79
  addPoint(point: Point3 | number): void;
78
80
  getPoints(): Point3[];
@@ -225,6 +225,10 @@ export default class VoxelManager {
225
225
  const boundsIJK = options?.boundsIJK || this.getBoundsIJK();
226
226
  const { isWithinObject } = options || {};
227
227
  const map = this.map;
228
+ if (!map) {
229
+ console.warn('No map found, you need to use a map voxel manager to use rleForEach');
230
+ return;
231
+ }
228
232
  map.defaultValue = undefined;
229
233
  for (let k = boundsIJK[2][0]; k <= boundsIJK[2][1]; k++) {
230
234
  for (let j = boundsIJK[1][0]; j <= boundsIJK[1][1]; j++) {
@@ -286,12 +290,15 @@ export default class VoxelManager {
286
290
  const value = this._get(0);
287
291
  return value.BYTES_PER_ELEMENT;
288
292
  }
289
- clear() {
290
- this.map?.clear();
293
+ clearBounds() {
291
294
  this.boundsIJK.map((bound) => {
292
295
  bound[0] = Infinity;
293
296
  bound[1] = -Infinity;
294
297
  });
298
+ }
299
+ clear() {
300
+ this.map?.clear();
301
+ this.clearBounds();
295
302
  this.modifiedSlices.clear();
296
303
  this.points?.clear();
297
304
  }
@@ -311,6 +318,9 @@ export default class VoxelManager {
311
318
  resetModifiedSlices() {
312
319
  this.modifiedSlices.clear();
313
320
  }
321
+ setBounds(bounds) {
322
+ this.boundsIJK = bounds;
323
+ }
314
324
  static addBounds(bounds, point) {
315
325
  if (!bounds) {
316
326
  bounds = [
@@ -1,6 +1,9 @@
1
1
  import * as metaData from '../metaData';
2
2
  import isEqual from './isEqual';
3
3
  function isValidVolume(imageIds) {
4
+ if (imageIds.length <= 1) {
5
+ return false;
6
+ }
4
7
  const imageId0 = imageIds[0];
5
8
  const { modality, seriesInstanceUID } = metaData.get('generalSeriesModule', imageId0);
6
9
  const { imageOrientationPatient, pixelSpacing, frameOfReferenceUID, columns, rows, } = metaData.get('imagePlaneModule', imageId0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "3.0.5",
3
+ "version": "3.1.1",
4
4
  "description": "Cornerstone3D Core",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -81,5 +81,5 @@
81
81
  "type": "individual",
82
82
  "url": "https://ohif.org/donate"
83
83
  },
84
- "gitHead": "0b67f91a41eb069e0ef212d4be7acdcb4c68c542"
84
+ "gitHead": "91a215bf75b76f6cbd017a811b5dfcff60f7f060"
85
85
  }