@cornerstonejs/core 1.11.3 → 1.12.0

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.3",
3
+ "version": "1.12.0",
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": "c0a3b216dfe15672558bd1186751f68d95a8f7ab"
49
+ "gitHead": "a97d174f00bc561ade811652f0167f3d783b1927"
50
50
  }
@@ -849,6 +849,8 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
849
849
  *
850
850
  */
851
851
  private _setVolumeActors(volumeActorEntries: Array<ActorEntry>): void {
852
+ // New volume actors implies resetting the inverted flag (i.e. like starting from scratch).
853
+ this.inverted = false;
852
854
  this.setActors(volumeActorEntries);
853
855
  }
854
856
 
@@ -1080,6 +1082,31 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
1080
1082
  return volume.getScalarData()[voxelIndex];
1081
1083
  }
1082
1084
 
1085
+ /**
1086
+ * Returns the list of image Ids for the current viewport
1087
+ *
1088
+ * @param volumeId - volumeId
1089
+ * @returns list of strings for image Ids
1090
+ */
1091
+ public getImageIds = (volumeId?: string): Array<string> => {
1092
+ const applicableVolumeActorInfo = this._getApplicableVolumeActor(volumeId);
1093
+
1094
+ if (!applicableVolumeActorInfo) {
1095
+ throw new Error(`No actor found for the given volumeId: ${volumeId}`);
1096
+ }
1097
+
1098
+ const volumeIdToUse = applicableVolumeActorInfo.volumeId;
1099
+
1100
+ const imageVolume = cache.getVolume(volumeIdToUse);
1101
+ if (!imageVolume) {
1102
+ throw new Error(
1103
+ `imageVolume with id: ${volumeIdToUse} does not exist in cache`
1104
+ );
1105
+ }
1106
+
1107
+ return imageVolume.imageIds;
1108
+ };
1109
+
1083
1110
  abstract getCurrentImageIdIndex(): number;
1084
1111
 
1085
1112
  abstract getCurrentImageId(): string;
@@ -28,6 +28,10 @@ export default interface IVolumeViewport extends IViewport {
28
28
  * projected onto the `Viewport`'s `canvas`.
29
29
  */
30
30
  worldToCanvas: (worldPos: Point3) => Point2;
31
+ /**
32
+ * Returns the list of image Ids for the current viewport
33
+ */
34
+ getImageIds: (volumeId?: string) => string[];
31
35
  /**
32
36
  * Uses viewport camera and volume actor to decide if the viewport
33
37
  * is looking at the volume in the direction of acquisition (imageIds).
@@ -142,5 +146,4 @@ export default interface IVolumeViewport extends IViewport {
142
146
  * Reset the viewport properties to the default values
143
147
  */
144
148
  resetProperties(volumeId?: string): void;
145
-
146
149
  }