@cornerstonejs/core 1.58.4 → 1.59.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.58.4",
3
+ "version": "1.59.0",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "type": "individual",
48
48
  "url": "https://ohif.org/donate"
49
49
  },
50
- "gitHead": "27788d9a480cf3dff59865f721cde0d158439734"
50
+ "gitHead": "85e398173df425f594c5ebd4fb5cd96da9d7dbd4"
51
51
  }
@@ -283,6 +283,14 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
283
283
  volumeActor.getProperty().setRGBTransferFunction(0, cfun);
284
284
 
285
285
  this.viewportProperties.colormap = colormap;
286
+
287
+ if (!suppressEvents) {
288
+ const eventDetail = {
289
+ viewportId: this.id,
290
+ colormap
291
+ };
292
+ triggerEvent(this.element, Events.COLORMAP_MODIFIED, eventDetail);
293
+ }
286
294
  }
287
295
 
288
296
  /**
@@ -3006,6 +3006,12 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
3006
3006
  this.cpuRenderingInvalidated = true;
3007
3007
 
3008
3008
  this.render();
3009
+
3010
+ const eventDetail = {
3011
+ viewportId: this.id,
3012
+ colormap: colormapData,
3013
+ };
3014
+ triggerEvent(this.element, Events.COLORMAP_MODIFIED, eventDetail);
3009
3015
  }
3010
3016
 
3011
3017
  private setColormapGPU(colormap: ColormapPublic) {
@@ -3034,6 +3040,14 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
3034
3040
 
3035
3041
  this.colormap = colormap;
3036
3042
  this.render();
3043
+
3044
+ const eventDetail = {
3045
+ viewportId: this.id,
3046
+ colormap,
3047
+ };
3048
+
3049
+ triggerEvent(this.element, Events.COLORMAP_MODIFIED, eventDetail);
3050
+
3037
3051
  }
3038
3052
 
3039
3053
  private unsetColormapGPU() {
@@ -232,6 +232,13 @@ enum Events {
232
232
  // IMAGE_CACHE_FULL = 'CORNERSTONE_IMAGE_CACHE_FULL',
233
233
  // PRE_RENDER = 'CORNERSTONE_PRE_RENDER',
234
234
  // ELEMENT_RESIZED = 'CORNERSTONE_ELEMENT_RESIZED',
235
+
236
+ /**
237
+ * Triggers on the HTML element when viewport modifies its colormap
238
+ * Make use of {@link EventTypes.ColormapModifiedEvent | ColormapModified Event Type } for typing your event listeners for COLORMAP_MODIFIED event,
239
+ * and see what event detail is included in {@link EventTypes.ColormapModifiedEventDetail | ColormapModified Event Detail }
240
+ */
241
+ COLORMAP_MODIFIED = "CORNERSTONE_COLORMAP_MODIFIED"
235
242
  }
236
243
 
237
244
  export default Events;
@@ -11,6 +11,7 @@ import VOILUTFunctionType from '../enums/VOILUTFunctionType';
11
11
  import ViewportStatus from '../enums/ViewportStatus';
12
12
  import type DisplayArea from './displayArea';
13
13
  import IImageCalibration from './IImageCalibration';
14
+ import { ColormapPublic } from './Colormap';
14
15
 
15
16
  /**
16
17
  * CAMERA_MODIFIED Event's data
@@ -48,6 +49,13 @@ type VoiModifiedEventDetail = {
48
49
  invertStateChanged?: boolean;
49
50
  };
50
51
 
52
+ type ColormapModifiedEventDetail = {
53
+ /** Viewport Unique ID in the renderingEngine */
54
+ viewportId: string;
55
+ /** The new colormap */
56
+ colormap: ColormapPublic;
57
+ }
58
+
51
59
  /**
52
60
  * DISPLAY_AREA_MODIFIED Event's data
53
61
  */
@@ -287,6 +295,11 @@ type CameraModifiedEvent = CustomEventType<CameraModifiedEventDetail>;
287
295
  */
288
296
  type VoiModifiedEvent = CustomEventType<VoiModifiedEventDetail>;
289
297
 
298
+ /**
299
+ * COLORMAP_MODIFIED Event type
300
+ */
301
+ type ColormapModifiedEvent = CustomEventType<ColormapModifiedEventDetail>;
302
+
290
303
  /**
291
304
  * DISPLAY_AREA_MODIFIED Event type
292
305
  */
@@ -398,6 +411,8 @@ export type {
398
411
  CameraModifiedEvent,
399
412
  VoiModifiedEvent,
400
413
  VoiModifiedEventDetail,
414
+ ColormapModifiedEvent,
415
+ ColormapModifiedEventDetail,
401
416
  DisplayAreaModifiedEvent,
402
417
  DisplayAreaModifiedEventDetail,
403
418
  ElementDisabledEvent,