@cornerstonejs/core 1.4.5 → 1.5.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/dist/cjs/RenderingEngine/BaseVolumeViewport.js +1 -0
- package/dist/cjs/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/RenderingEngine.js +2 -0
- package/dist/cjs/RenderingEngine/RenderingEngine.js.map +1 -1
- package/dist/cjs/RenderingEngine/StackViewport.d.ts +2 -0
- package/dist/cjs/RenderingEngine/StackViewport.js +8 -0
- package/dist/cjs/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/cjs/RenderingEngine/Viewport.d.ts +3 -0
- package/dist/cjs/RenderingEngine/Viewport.js +9 -0
- package/dist/cjs/RenderingEngine/Viewport.js.map +1 -1
- package/dist/cjs/enums/ViewportStatus.d.ts +8 -0
- package/dist/cjs/enums/ViewportStatus.js +12 -0
- package/dist/cjs/enums/ViewportStatus.js.map +1 -0
- package/dist/cjs/enums/index.d.ts +2 -1
- package/dist/cjs/enums/index.js +3 -1
- package/dist/cjs/enums/index.js.map +1 -1
- package/dist/cjs/types/EventTypes.d.ts +2 -0
- package/dist/cjs/types/IViewport.d.ts +3 -0
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js +2 -1
- package/dist/esm/RenderingEngine/BaseVolumeViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/RenderingEngine.js +2 -0
- package/dist/esm/RenderingEngine/RenderingEngine.js.map +1 -1
- package/dist/esm/RenderingEngine/StackViewport.d.ts +2 -0
- package/dist/esm/RenderingEngine/StackViewport.js +8 -0
- package/dist/esm/RenderingEngine/StackViewport.js.map +1 -1
- package/dist/esm/RenderingEngine/Viewport.d.ts +3 -0
- package/dist/esm/RenderingEngine/Viewport.js +9 -0
- package/dist/esm/RenderingEngine/Viewport.js.map +1 -1
- package/dist/esm/enums/ViewportStatus.d.ts +8 -0
- package/dist/esm/enums/ViewportStatus.js +10 -0
- package/dist/esm/enums/ViewportStatus.js.map +1 -0
- package/dist/esm/enums/index.d.ts +2 -1
- package/dist/esm/enums/index.js +2 -1
- package/dist/esm/enums/index.js.map +1 -1
- package/dist/esm/types/EventTypes.d.ts +2 -0
- package/dist/esm/types/IViewport.d.ts +3 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/RenderingEngine/BaseVolumeViewport.ts +2 -0
- package/src/RenderingEngine/RenderingEngine.ts +3 -1
- package/src/RenderingEngine/StackViewport.ts +8 -0
- package/src/RenderingEngine/Viewport.ts +21 -0
- package/src/enums/ViewportStatus.ts +14 -0
- package/src/enums/index.ts +2 -0
- package/src/types/EventTypes.ts +3 -0
- package/src/types/IViewport.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"type": "individual",
|
|
45
45
|
"url": "https://ohif.org/donate"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "cbfe5342099f46b69109d34e09a0a733ca7c897d"
|
|
48
48
|
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
BlendModes,
|
|
14
14
|
Events,
|
|
15
15
|
OrientationAxis,
|
|
16
|
+
ViewportStatus,
|
|
16
17
|
VOILUTFunctionType,
|
|
17
18
|
} from '../enums';
|
|
18
19
|
import ViewportType from '../enums/ViewportType';
|
|
@@ -591,6 +592,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
|
|
|
591
592
|
}
|
|
592
593
|
|
|
593
594
|
this._setVolumeActors(volumeActors);
|
|
595
|
+
this.viewportStatus = ViewportStatus.PRE_RENDER;
|
|
594
596
|
|
|
595
597
|
triggerEvent(this.element, Events.VOLUME_VIEWPORT_NEW_VOLUME, {
|
|
596
598
|
viewportId: this.id,
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
InternalViewportInput,
|
|
21
21
|
NormalizedViewportInput,
|
|
22
22
|
} from '../types/IViewport';
|
|
23
|
-
import { OrientationAxis } from '../enums';
|
|
23
|
+
import { OrientationAxis, ViewportStatus } from '../enums';
|
|
24
24
|
import VolumeViewport3D from './VolumeViewport3D';
|
|
25
25
|
|
|
26
26
|
type ViewportDisplayCoords = {
|
|
@@ -1107,6 +1107,7 @@ class RenderingEngine implements IRenderingEngine {
|
|
|
1107
1107
|
const eventDetail =
|
|
1108
1108
|
this.renderViewportUsingCustomOrVtkPipeline(viewport);
|
|
1109
1109
|
eventDetailArray.push(eventDetail);
|
|
1110
|
+
viewport.setRendered();
|
|
1110
1111
|
|
|
1111
1112
|
// This viewport has been rendered, we can remove it from the set
|
|
1112
1113
|
this._needsRender.delete(viewport.id);
|
|
@@ -1251,6 +1252,7 @@ class RenderingEngine implements IRenderingEngine {
|
|
|
1251
1252
|
suppressEvents,
|
|
1252
1253
|
viewportId,
|
|
1253
1254
|
renderingEngineId,
|
|
1255
|
+
viewportStatus: viewport.viewportStatus,
|
|
1254
1256
|
};
|
|
1255
1257
|
}
|
|
1256
1258
|
|
|
@@ -74,6 +74,7 @@ import {
|
|
|
74
74
|
ImagePixelModule,
|
|
75
75
|
ImagePlaneModule,
|
|
76
76
|
} from '../types';
|
|
77
|
+
import ViewportStatus from '../enums/ViewportStatus';
|
|
77
78
|
|
|
78
79
|
const EPSILON = 1; // Slice Thickness
|
|
79
80
|
|
|
@@ -696,6 +697,9 @@ class StackViewport extends Viewport implements IStackViewport {
|
|
|
696
697
|
}: StackViewportProperties = {},
|
|
697
698
|
suppressEvents = false
|
|
698
699
|
): void {
|
|
700
|
+
this.viewportStatus = this.csImage
|
|
701
|
+
? ViewportStatus.PRE_RENDER
|
|
702
|
+
: ViewportStatus.LOADING;
|
|
699
703
|
// if voi is not applied for the first time, run the setVOI function
|
|
700
704
|
// which will apply the default voi based on the range
|
|
701
705
|
if (typeof voiRange !== 'undefined') {
|
|
@@ -753,6 +757,7 @@ class StackViewport extends Viewport implements IStackViewport {
|
|
|
753
757
|
public resetProperties(): void {
|
|
754
758
|
this.cpuRenderingInvalidated = true;
|
|
755
759
|
this.voiUpdatedWithSetProperties = false;
|
|
760
|
+
this.viewportStatus = ViewportStatus.PRE_RENDER;
|
|
756
761
|
|
|
757
762
|
this.fillWithBackgroundColor();
|
|
758
763
|
|
|
@@ -1494,6 +1499,7 @@ class StackViewport extends Viewport implements IStackViewport {
|
|
|
1494
1499
|
this.voiRange = null;
|
|
1495
1500
|
this.interpolationType = InterpolationType.LINEAR;
|
|
1496
1501
|
this.invert = false;
|
|
1502
|
+
this.viewportStatus = ViewportStatus.LOADING;
|
|
1497
1503
|
|
|
1498
1504
|
this.fillWithBackgroundColor();
|
|
1499
1505
|
|
|
@@ -1715,6 +1721,7 @@ class StackViewport extends Viewport implements IStackViewport {
|
|
|
1715
1721
|
}
|
|
1716
1722
|
|
|
1717
1723
|
this._setCSImage(image);
|
|
1724
|
+
this.viewportStatus = ViewportStatus.PRE_RENDER;
|
|
1718
1725
|
|
|
1719
1726
|
const eventDetail: EventTypes.StackNewImageEventDetail = {
|
|
1720
1727
|
image,
|
|
@@ -2648,6 +2655,7 @@ class StackViewport extends Viewport implements IStackViewport {
|
|
|
2648
2655
|
element: this.element,
|
|
2649
2656
|
viewportId: this.id,
|
|
2650
2657
|
renderingEngineId: this.renderingEngineId,
|
|
2658
|
+
viewportStatus: this.viewportStatus,
|
|
2651
2659
|
};
|
|
2652
2660
|
};
|
|
2653
2661
|
|
|
@@ -7,6 +7,7 @@ import { vec2, vec3 } from 'gl-matrix';
|
|
|
7
7
|
import _cloneDeep from 'lodash.clonedeep';
|
|
8
8
|
|
|
9
9
|
import Events from '../enums/Events';
|
|
10
|
+
import ViewportStatus from '../enums/ViewportStatus';
|
|
10
11
|
import ViewportType from '../enums/ViewportType';
|
|
11
12
|
import renderingEngineCache from './renderingEngineCache';
|
|
12
13
|
import { triggerEvent, planar, isImageActor, actorIsA } from '../utilities';
|
|
@@ -50,6 +51,10 @@ class Viewport implements IViewport {
|
|
|
50
51
|
protected flipHorizontal = false;
|
|
51
52
|
protected flipVertical = false;
|
|
52
53
|
public isDisabled: boolean;
|
|
54
|
+
/** Record the renddering status, mostly for testing purposes, but can also
|
|
55
|
+
* be useful for knowing things like whether the viewport is initialized
|
|
56
|
+
*/
|
|
57
|
+
public viewportStatus: ViewportStatus = ViewportStatus.NO_DATA;
|
|
53
58
|
|
|
54
59
|
/** sx of viewport on the offscreen canvas */
|
|
55
60
|
sx: number;
|
|
@@ -117,6 +122,22 @@ class Viewport implements IViewport {
|
|
|
117
122
|
return false;
|
|
118
123
|
}
|
|
119
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Indicate that the image has been rendered.
|
|
127
|
+
* This will set hte viewportStatus to RENDERED if there is image data
|
|
128
|
+
* available to actually be rendered - otherwise, the rendering simply showed
|
|
129
|
+
* the background image.
|
|
130
|
+
*/
|
|
131
|
+
public setRendered() {
|
|
132
|
+
if (
|
|
133
|
+
this.viewportStatus === ViewportStatus.NO_DATA ||
|
|
134
|
+
this.viewportStatus === ViewportStatus.LOADING
|
|
135
|
+
) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.viewportStatus = ViewportStatus.RENDERED;
|
|
139
|
+
}
|
|
140
|
+
|
|
120
141
|
/**
|
|
121
142
|
* Returns the rendering engine driving the `Viewport`.
|
|
122
143
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
enum ViewportStatus {
|
|
2
|
+
/** Initial state before any volumes or stacks are available*/
|
|
3
|
+
NO_DATA = 'noData',
|
|
4
|
+
/** Stack/volumes are available but are in progress */
|
|
5
|
+
LOADING = 'loading',
|
|
6
|
+
/** Ready to be rendered */
|
|
7
|
+
PRE_RENDER = 'preRender',
|
|
8
|
+
/** In the midst of a resize */
|
|
9
|
+
RESIZE = 'resize',
|
|
10
|
+
/** Rendered image data */
|
|
11
|
+
RENDERED = 'rendered',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default ViewportStatus;
|
package/src/enums/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import GeometryType from './GeometryType';
|
|
|
9
9
|
import ContourType from './ContourType';
|
|
10
10
|
import VOILUTFunctionType from './VOILUTFunctionType';
|
|
11
11
|
import DynamicOperatorType from './DynamicOperatorType';
|
|
12
|
+
import ViewportStatus from './ViewportStatus';
|
|
12
13
|
|
|
13
14
|
export {
|
|
14
15
|
Events,
|
|
@@ -22,4 +23,5 @@ export {
|
|
|
22
23
|
ContourType,
|
|
23
24
|
VOILUTFunctionType,
|
|
24
25
|
DynamicOperatorType,
|
|
26
|
+
ViewportStatus,
|
|
25
27
|
};
|
package/src/types/EventTypes.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type IImage from './IImage';
|
|
|
8
8
|
import type IImageVolume from './IImageVolume';
|
|
9
9
|
import type { VOIRange } from './voi';
|
|
10
10
|
import type VOILUTFunctionType from '../enums/VOILUTFunctionType';
|
|
11
|
+
import type ViewportStatus from '../enums/ViewportStatus';
|
|
11
12
|
import type DisplayArea from './displayArea';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -96,6 +97,8 @@ type ImageRenderedEventDetail = {
|
|
|
96
97
|
renderingEngineId: string;
|
|
97
98
|
/** Whether to suppress the event */
|
|
98
99
|
suppressEvents?: boolean;
|
|
100
|
+
/** Include information on whether this is a real rendering or just background */
|
|
101
|
+
viewportStatus: ViewportStatus;
|
|
99
102
|
};
|
|
100
103
|
/**
|
|
101
104
|
* IMAGE_VOLUME_MODIFIED Event's data
|
package/src/types/IViewport.ts
CHANGED
|
@@ -4,6 +4,7 @@ import Point3 from './Point3';
|
|
|
4
4
|
import ViewportInputOptions from './ViewportInputOptions';
|
|
5
5
|
import { ActorEntry } from './IActor';
|
|
6
6
|
import ViewportType from '../enums/ViewportType';
|
|
7
|
+
import ViewportStatus from '../enums/ViewportStatus';
|
|
7
8
|
import DisplayArea from './displayArea';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -38,6 +39,8 @@ interface IViewport {
|
|
|
38
39
|
suppressEvents: boolean;
|
|
39
40
|
/** if the viewport has been disabled */
|
|
40
41
|
isDisabled: boolean;
|
|
42
|
+
/** The rendering state of this viewport */
|
|
43
|
+
viewportStatus: ViewportStatus;
|
|
41
44
|
/** the rotation applied to the view */
|
|
42
45
|
getRotation: () => number;
|
|
43
46
|
/** frameOfReferenceUID the viewport's default actor is rendering */
|
|
@@ -88,6 +91,8 @@ interface IViewport {
|
|
|
88
91
|
getCanvas(): HTMLCanvasElement;
|
|
89
92
|
/** returns camera object */
|
|
90
93
|
getCamera(): ICamera;
|
|
94
|
+
/** Sets the rendered state to rendered if the render actually showed image data */
|
|
95
|
+
setRendered(): void;
|
|
91
96
|
/** returns the parallel zoom relative to the default (eg returns 1 after reset) */
|
|
92
97
|
getZoom(): number;
|
|
93
98
|
/** Sets the relative zoom - set to 1 to reset it */
|