@cornerstonejs/core 1.11.1 → 1.11.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -46,5 +46,5 @@
46
46
  "type": "individual",
47
47
  "url": "https://ohif.org/donate"
48
48
  },
49
- "gitHead": "6d964dfaf15fc9ac45dd9e9241f387623860ac9f"
49
+ "gitHead": "633503fc6db1fac1fcc5992ce5f4d5c1dec42034"
50
50
  }
@@ -1095,7 +1095,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
1095
1095
  filterActorUIDs?: Array<string>
1096
1096
  ): void;
1097
1097
 
1098
- abstract resetProperties(): void;
1098
+ abstract resetProperties(volumeId?: string): void;
1099
1099
  }
1100
1100
 
1101
1101
  export default BaseVolumeViewport;
@@ -356,15 +356,32 @@ class VolumeViewport extends BaseVolumeViewport {
356
356
  /**
357
357
  * Reset the viewport properties to the default values
358
358
  *
359
+
360
+ * @param volumeId - Optional volume ID to specify which volume properties to reset.
361
+ * If not provided, it will reset the properties of the default actor.
362
+ *
359
363
  * @returns void
360
364
  */
361
- public resetProperties(): void {
362
- this._resetProperties();
365
+ public resetProperties(volumeId?: string): void {
366
+ this._resetProperties(volumeId);
363
367
  }
364
368
 
365
- private _resetProperties() {
366
- const volumeActor = this.getDefaultActor();
369
+ private _resetProperties(volumeId?: string) {
370
+ // Get the actor based on the volumeId if provided, otherwise use the default actor.
371
+ const volumeActor = volumeId
372
+ ? this.getActor(volumeId)
373
+ : this.getDefaultActor();
374
+
375
+ if (!volumeActor) {
376
+ throw new Error(`No actor found for the given volumeId: ${volumeId}`);
377
+ }
378
+
367
379
  const imageVolume = cache.getVolume(volumeActor.uid);
380
+ if (!imageVolume) {
381
+ throw new Error(
382
+ `imageVolume with id: ${volumeActor.uid} does not exist in cache`
383
+ );
384
+ }
368
385
  setDefaultVolumeVOI(volumeActor.actor as vtkVolume, imageVolume, false);
369
386
  }
370
387
  }
@@ -61,7 +61,7 @@ class VolumeViewport3D extends BaseVolumeViewport {
61
61
  return null;
62
62
  }
63
63
 
64
- resetProperties(): void {
64
+ resetProperties(volumeId?: string): void {
65
65
  return null;
66
66
  }
67
67
  }
@@ -141,5 +141,6 @@ export default interface IVolumeViewport extends IViewport {
141
141
  /**
142
142
  * Reset the viewport properties to the default values
143
143
  */
144
- resetProperties(): void;
144
+ resetProperties(volumeId?: string): void;
145
+
145
146
  }