@cornerstonejs/core 3.30.3 → 3.31.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/esm/RenderingEngine/BaseRenderingEngine.js +7 -1
- package/dist/esm/RenderingEngine/helpers/stats/StatsOverlay.d.ts +28 -0
- package/dist/esm/RenderingEngine/helpers/stats/StatsOverlay.js +137 -0
- package/dist/esm/RenderingEngine/helpers/stats/StatsPanel.d.ts +24 -0
- package/dist/esm/RenderingEngine/helpers/stats/StatsPanel.js +101 -0
- package/dist/esm/RenderingEngine/helpers/stats/constants.d.ts +44 -0
- package/dist/esm/RenderingEngine/helpers/stats/constants.js +36 -0
- package/dist/esm/RenderingEngine/helpers/stats/enums.d.ts +6 -0
- package/dist/esm/RenderingEngine/helpers/stats/enums.js +7 -0
- package/dist/esm/RenderingEngine/helpers/stats/index.d.ts +2 -0
- package/dist/esm/RenderingEngine/helpers/stats/index.js +2 -0
- package/dist/esm/RenderingEngine/helpers/stats/types.d.ts +22 -0
- package/dist/esm/RenderingEngine/helpers/stats/types.js +0 -0
- package/dist/esm/init.js +3 -0
- package/dist/esm/types/Cornerstone3DConfig.d.ts +3 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +2 -2
|
@@ -8,9 +8,10 @@ import BaseVolumeViewport from './BaseVolumeViewport';
|
|
|
8
8
|
import StackViewport from './StackViewport';
|
|
9
9
|
import viewportTypeUsesCustomRenderingPipeline from './helpers/viewportTypeUsesCustomRenderingPipeline';
|
|
10
10
|
import getOrCreateCanvas from './helpers/getOrCreateCanvas';
|
|
11
|
-
import { getShouldUseCPURendering, isCornerstoneInitialized } from '../init';
|
|
11
|
+
import { getShouldUseCPURendering, isCornerstoneInitialized, getConfiguration, } from '../init';
|
|
12
12
|
import viewportTypeToViewportClass from './helpers/viewportTypeToViewportClass';
|
|
13
13
|
import { OrientationAxis } from '../enums';
|
|
14
|
+
import { StatsOverlay } from './helpers/stats';
|
|
14
15
|
export const VIEWPORT_MIN_SIZE = 2;
|
|
15
16
|
class BaseRenderingEngine {
|
|
16
17
|
constructor(id) {
|
|
@@ -34,6 +35,10 @@ class BaseRenderingEngine {
|
|
|
34
35
|
}
|
|
35
36
|
this._viewports = new Map();
|
|
36
37
|
this.hasBeenDestroyed = false;
|
|
38
|
+
const config = getConfiguration();
|
|
39
|
+
if (config?.debug?.statsOverlay) {
|
|
40
|
+
StatsOverlay.setup();
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
enableElement(viewportInputEntry) {
|
|
39
44
|
const viewportInput = this._normalizeViewportInputEntry(viewportInputEntry);
|
|
@@ -169,6 +174,7 @@ class BaseRenderingEngine {
|
|
|
169
174
|
if (this.hasBeenDestroyed) {
|
|
170
175
|
return;
|
|
171
176
|
}
|
|
177
|
+
StatsOverlay.cleanup();
|
|
172
178
|
if (!this.useCPURendering) {
|
|
173
179
|
const viewports = this._getViewportsAsArray();
|
|
174
180
|
viewports.forEach((vp) => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StatsInstance } from './types';
|
|
2
|
+
export declare class StatsOverlay implements StatsInstance {
|
|
3
|
+
private static instance;
|
|
4
|
+
dom: HTMLDivElement | null;
|
|
5
|
+
private currentMode;
|
|
6
|
+
private startTime;
|
|
7
|
+
private lastUpdateTime;
|
|
8
|
+
private frameCount;
|
|
9
|
+
private panels;
|
|
10
|
+
private animationFrameId;
|
|
11
|
+
private isSetup;
|
|
12
|
+
private constructor();
|
|
13
|
+
static getInstance(): StatsOverlay;
|
|
14
|
+
setup(): void;
|
|
15
|
+
cleanup(): void;
|
|
16
|
+
showPanel(panelType: number): void;
|
|
17
|
+
update(): void;
|
|
18
|
+
private createOverlayElement;
|
|
19
|
+
private applyOverlayStyles;
|
|
20
|
+
private handleClick;
|
|
21
|
+
private initializePanels;
|
|
22
|
+
private isMemoryAvailable;
|
|
23
|
+
private addPanel;
|
|
24
|
+
private startLoop;
|
|
25
|
+
private stopLoop;
|
|
26
|
+
private updateStats;
|
|
27
|
+
private updateMemoryPanel;
|
|
28
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { StatsPanel } from './StatsPanel';
|
|
2
|
+
import { PanelType } from './enums';
|
|
3
|
+
import { STATS_CONFIG, PANEL_CONFIGS, CONVERSION } from './constants';
|
|
4
|
+
export class StatsOverlay {
|
|
5
|
+
static { this.instance = null; }
|
|
6
|
+
constructor() {
|
|
7
|
+
this.dom = null;
|
|
8
|
+
this.currentMode = 0;
|
|
9
|
+
this.startTime = 0;
|
|
10
|
+
this.lastUpdateTime = 0;
|
|
11
|
+
this.frameCount = 0;
|
|
12
|
+
this.panels = new Map();
|
|
13
|
+
this.animationFrameId = null;
|
|
14
|
+
this.isSetup = false;
|
|
15
|
+
}
|
|
16
|
+
static getInstance() {
|
|
17
|
+
if (!StatsOverlay.instance) {
|
|
18
|
+
StatsOverlay.instance = new StatsOverlay();
|
|
19
|
+
}
|
|
20
|
+
return StatsOverlay.instance;
|
|
21
|
+
}
|
|
22
|
+
setup() {
|
|
23
|
+
if (this.isSetup) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
this.dom = this.createOverlayElement();
|
|
28
|
+
this.startTime = performance.now();
|
|
29
|
+
this.lastUpdateTime = this.startTime;
|
|
30
|
+
this.initializePanels();
|
|
31
|
+
this.showPanel(PanelType.FPS);
|
|
32
|
+
this.applyOverlayStyles();
|
|
33
|
+
document.body.appendChild(this.dom);
|
|
34
|
+
this.startLoop();
|
|
35
|
+
this.isSetup = true;
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.warn('Failed to setup stats overlay:', error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
cleanup() {
|
|
42
|
+
this.stopLoop();
|
|
43
|
+
if (this.dom && this.dom.parentNode) {
|
|
44
|
+
this.dom.parentNode.removeChild(this.dom);
|
|
45
|
+
}
|
|
46
|
+
this.dom = null;
|
|
47
|
+
this.panels.clear();
|
|
48
|
+
this.isSetup = false;
|
|
49
|
+
}
|
|
50
|
+
showPanel(panelType) {
|
|
51
|
+
const children = Array.from(this.dom.children);
|
|
52
|
+
children.forEach((child, index) => {
|
|
53
|
+
child.style.display = index === panelType ? 'block' : 'none';
|
|
54
|
+
});
|
|
55
|
+
this.currentMode = panelType;
|
|
56
|
+
}
|
|
57
|
+
update() {
|
|
58
|
+
this.startTime = this.updateStats();
|
|
59
|
+
}
|
|
60
|
+
createOverlayElement() {
|
|
61
|
+
const element = document.createElement('div');
|
|
62
|
+
element.addEventListener('click', this.handleClick.bind(this), false);
|
|
63
|
+
return element;
|
|
64
|
+
}
|
|
65
|
+
applyOverlayStyles() {
|
|
66
|
+
Object.assign(this.dom.style, STATS_CONFIG.OVERLAY_STYLES);
|
|
67
|
+
}
|
|
68
|
+
handleClick(event) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
const panelCount = this.dom.children.length;
|
|
71
|
+
this.showPanel((this.currentMode + 1) % panelCount);
|
|
72
|
+
}
|
|
73
|
+
initializePanels() {
|
|
74
|
+
const fpsPanel = new StatsPanel(PANEL_CONFIGS[PanelType.FPS].name, PANEL_CONFIGS[PanelType.FPS].foregroundColor, PANEL_CONFIGS[PanelType.FPS].backgroundColor);
|
|
75
|
+
this.addPanel(PanelType.FPS, fpsPanel);
|
|
76
|
+
const msPanel = new StatsPanel(PANEL_CONFIGS[PanelType.MS].name, PANEL_CONFIGS[PanelType.MS].foregroundColor, PANEL_CONFIGS[PanelType.MS].backgroundColor);
|
|
77
|
+
this.addPanel(PanelType.MS, msPanel);
|
|
78
|
+
if (this.isMemoryAvailable()) {
|
|
79
|
+
const memPanel = new StatsPanel(PANEL_CONFIGS[PanelType.MEMORY].name, PANEL_CONFIGS[PanelType.MEMORY].foregroundColor, PANEL_CONFIGS[PanelType.MEMORY].backgroundColor);
|
|
80
|
+
this.addPanel(PanelType.MEMORY, memPanel);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
isMemoryAvailable() {
|
|
84
|
+
const perf = performance;
|
|
85
|
+
return perf.memory !== undefined;
|
|
86
|
+
}
|
|
87
|
+
addPanel(type, panel) {
|
|
88
|
+
this.dom.appendChild(panel.dom);
|
|
89
|
+
this.panels.set(type, panel);
|
|
90
|
+
}
|
|
91
|
+
startLoop() {
|
|
92
|
+
const loop = () => {
|
|
93
|
+
this.update();
|
|
94
|
+
this.animationFrameId = requestAnimationFrame(loop);
|
|
95
|
+
};
|
|
96
|
+
this.animationFrameId = requestAnimationFrame(loop);
|
|
97
|
+
}
|
|
98
|
+
stopLoop() {
|
|
99
|
+
if (this.animationFrameId !== null) {
|
|
100
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
101
|
+
this.animationFrameId = null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
updateStats() {
|
|
105
|
+
this.frameCount++;
|
|
106
|
+
const currentTime = performance.now();
|
|
107
|
+
const deltaTime = currentTime - this.startTime;
|
|
108
|
+
const msPanel = this.panels.get(PanelType.MS);
|
|
109
|
+
if (msPanel) {
|
|
110
|
+
msPanel.update(deltaTime, STATS_CONFIG.MAX_MS_VALUE);
|
|
111
|
+
}
|
|
112
|
+
if (currentTime >= this.lastUpdateTime + STATS_CONFIG.UPDATE_INTERVAL) {
|
|
113
|
+
const fps = (this.frameCount * CONVERSION.MS_PER_SECOND) /
|
|
114
|
+
(currentTime - this.lastUpdateTime);
|
|
115
|
+
const fpsPanel = this.panels.get(PanelType.FPS);
|
|
116
|
+
if (fpsPanel) {
|
|
117
|
+
fpsPanel.update(fps, STATS_CONFIG.MAX_FPS_VALUE);
|
|
118
|
+
}
|
|
119
|
+
this.lastUpdateTime = currentTime;
|
|
120
|
+
this.frameCount = 0;
|
|
121
|
+
this.updateMemoryPanel();
|
|
122
|
+
}
|
|
123
|
+
return currentTime;
|
|
124
|
+
}
|
|
125
|
+
updateMemoryPanel() {
|
|
126
|
+
const memPanel = this.panels.get(PanelType.MEMORY);
|
|
127
|
+
if (!memPanel) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const perf = performance;
|
|
131
|
+
if (perf.memory) {
|
|
132
|
+
const memoryMB = perf.memory.usedJSHeapSize / CONVERSION.BYTES_TO_MB;
|
|
133
|
+
const maxMemoryMB = perf.memory.jsHeapSizeLimit / CONVERSION.BYTES_TO_MB;
|
|
134
|
+
memPanel.update(memoryMB, maxMemoryMB);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Panel } from './types';
|
|
2
|
+
export declare class StatsPanel implements Panel {
|
|
3
|
+
dom: HTMLCanvasElement;
|
|
4
|
+
private context;
|
|
5
|
+
private minValue;
|
|
6
|
+
private maxValue;
|
|
7
|
+
private readonly name;
|
|
8
|
+
private readonly foregroundColor;
|
|
9
|
+
private readonly backgroundColor;
|
|
10
|
+
private readonly devicePixelRatio;
|
|
11
|
+
private readonly dimensions;
|
|
12
|
+
constructor(name: string, foregroundColor: string, backgroundColor: string);
|
|
13
|
+
update(value: number, maxValue: number): void;
|
|
14
|
+
private calculateDimensions;
|
|
15
|
+
private createCanvas;
|
|
16
|
+
private initializeContext;
|
|
17
|
+
private drawInitialPanel;
|
|
18
|
+
private updateMinMax;
|
|
19
|
+
private clearTextArea;
|
|
20
|
+
private drawText;
|
|
21
|
+
private formatText;
|
|
22
|
+
private scrollGraph;
|
|
23
|
+
private drawNewValue;
|
|
24
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { PANEL_CONFIG } from './constants';
|
|
2
|
+
export class StatsPanel {
|
|
3
|
+
constructor(name, foregroundColor, backgroundColor) {
|
|
4
|
+
this.minValue = Infinity;
|
|
5
|
+
this.maxValue = 0;
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.foregroundColor = foregroundColor;
|
|
8
|
+
this.backgroundColor = backgroundColor;
|
|
9
|
+
this.devicePixelRatio = Math.round(window.devicePixelRatio || 1);
|
|
10
|
+
this.dimensions = this.calculateDimensions();
|
|
11
|
+
this.dom = this.createCanvas();
|
|
12
|
+
this.context = this.initializeContext();
|
|
13
|
+
this.drawInitialPanel();
|
|
14
|
+
}
|
|
15
|
+
update(value, maxValue) {
|
|
16
|
+
this.updateMinMax(value);
|
|
17
|
+
this.clearTextArea();
|
|
18
|
+
this.drawText(value);
|
|
19
|
+
this.scrollGraph();
|
|
20
|
+
this.drawNewValue(value, maxValue);
|
|
21
|
+
}
|
|
22
|
+
calculateDimensions() {
|
|
23
|
+
const pr = this.devicePixelRatio;
|
|
24
|
+
return {
|
|
25
|
+
width: PANEL_CONFIG.WIDTH * pr,
|
|
26
|
+
height: PANEL_CONFIG.HEIGHT * pr,
|
|
27
|
+
textX: PANEL_CONFIG.TEXT_PADDING * pr,
|
|
28
|
+
textY: PANEL_CONFIG.TEXT_Y_OFFSET * pr,
|
|
29
|
+
graphX: PANEL_CONFIG.TEXT_PADDING * pr,
|
|
30
|
+
graphY: PANEL_CONFIG.GRAPH_Y_OFFSET * pr,
|
|
31
|
+
graphWidth: PANEL_CONFIG.GRAPH_WIDTH * pr,
|
|
32
|
+
graphHeight: PANEL_CONFIG.GRAPH_HEIGHT * pr,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
createCanvas() {
|
|
36
|
+
const canvas = document.createElement('canvas');
|
|
37
|
+
canvas.width = this.dimensions.width;
|
|
38
|
+
canvas.height = this.dimensions.height;
|
|
39
|
+
canvas.style.cssText = `width:${PANEL_CONFIG.WIDTH}px;height:${PANEL_CONFIG.HEIGHT}px`;
|
|
40
|
+
return canvas;
|
|
41
|
+
}
|
|
42
|
+
initializeContext() {
|
|
43
|
+
const ctx = this.dom.getContext('2d');
|
|
44
|
+
if (!ctx) {
|
|
45
|
+
throw new Error('Failed to get 2D context');
|
|
46
|
+
}
|
|
47
|
+
ctx.font = `bold ${PANEL_CONFIG.FONT_SIZE * this.devicePixelRatio}px ${PANEL_CONFIG.FONT_FAMILY}`;
|
|
48
|
+
ctx.textBaseline = 'top';
|
|
49
|
+
return ctx;
|
|
50
|
+
}
|
|
51
|
+
drawInitialPanel() {
|
|
52
|
+
const { width, height, textX, textY, graphX, graphY, graphWidth, graphHeight, } = this.dimensions;
|
|
53
|
+
this.context.fillStyle = this.backgroundColor;
|
|
54
|
+
this.context.fillRect(0, 0, width, height);
|
|
55
|
+
this.context.fillStyle = this.foregroundColor;
|
|
56
|
+
this.context.fillText(this.name, textX, textY);
|
|
57
|
+
this.context.fillRect(graphX, graphY, graphWidth, graphHeight);
|
|
58
|
+
this.context.fillStyle = this.backgroundColor;
|
|
59
|
+
this.context.globalAlpha = PANEL_CONFIG.GRAPH_ALPHA;
|
|
60
|
+
this.context.fillRect(graphX, graphY, graphWidth, graphHeight);
|
|
61
|
+
this.context.globalAlpha = 1;
|
|
62
|
+
}
|
|
63
|
+
updateMinMax(value) {
|
|
64
|
+
this.minValue = Math.min(this.minValue, value);
|
|
65
|
+
this.maxValue = Math.max(this.maxValue, value);
|
|
66
|
+
}
|
|
67
|
+
clearTextArea() {
|
|
68
|
+
const { width, graphY } = this.dimensions;
|
|
69
|
+
this.context.fillStyle = this.backgroundColor;
|
|
70
|
+
this.context.fillRect(0, 0, width, graphY);
|
|
71
|
+
}
|
|
72
|
+
drawText(value) {
|
|
73
|
+
const { textX, textY } = this.dimensions;
|
|
74
|
+
const text = this.formatText(value);
|
|
75
|
+
this.context.fillStyle = this.foregroundColor;
|
|
76
|
+
this.context.fillText(text, textX, textY);
|
|
77
|
+
}
|
|
78
|
+
formatText(value) {
|
|
79
|
+
const roundedValue = Math.round(value);
|
|
80
|
+
const roundedMin = Math.round(this.minValue);
|
|
81
|
+
const roundedMax = Math.round(this.maxValue);
|
|
82
|
+
return `${roundedValue} ${this.name} (${roundedMin}-${roundedMax})`;
|
|
83
|
+
}
|
|
84
|
+
scrollGraph() {
|
|
85
|
+
const { graphX, graphY, graphWidth, graphHeight } = this.dimensions;
|
|
86
|
+
const pr = this.devicePixelRatio;
|
|
87
|
+
this.context.drawImage(this.dom, graphX + pr, graphY, graphWidth - pr, graphHeight, graphX, graphY, graphWidth - pr, graphHeight);
|
|
88
|
+
}
|
|
89
|
+
drawNewValue(value, maxValue) {
|
|
90
|
+
const { graphX, graphY, graphWidth, graphHeight } = this.dimensions;
|
|
91
|
+
const pr = this.devicePixelRatio;
|
|
92
|
+
const x = graphX + graphWidth - pr;
|
|
93
|
+
this.context.fillStyle = this.foregroundColor;
|
|
94
|
+
this.context.fillRect(x, graphY, pr, graphHeight);
|
|
95
|
+
const normalizedHeight = Math.round((1 - value / maxValue) * graphHeight);
|
|
96
|
+
this.context.fillStyle = this.backgroundColor;
|
|
97
|
+
this.context.globalAlpha = PANEL_CONFIG.GRAPH_ALPHA;
|
|
98
|
+
this.context.fillRect(x, graphY, pr, normalizedHeight);
|
|
99
|
+
this.context.globalAlpha = 1;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const PANEL_CONFIG: {
|
|
2
|
+
readonly WIDTH: 160;
|
|
3
|
+
readonly HEIGHT: 96;
|
|
4
|
+
readonly TEXT_PADDING: 3;
|
|
5
|
+
readonly TEXT_Y_OFFSET: 2;
|
|
6
|
+
readonly GRAPH_Y_OFFSET: 15;
|
|
7
|
+
readonly GRAPH_WIDTH: 150;
|
|
8
|
+
readonly GRAPH_HEIGHT: 70;
|
|
9
|
+
readonly FONT_SIZE: 9;
|
|
10
|
+
readonly FONT_FAMILY: "Helvetica,Arial,sans-serif";
|
|
11
|
+
readonly GRAPH_ALPHA: 0.9;
|
|
12
|
+
};
|
|
13
|
+
declare const STATS_CONFIG: {
|
|
14
|
+
readonly UPDATE_INTERVAL: 1000;
|
|
15
|
+
readonly MAX_MS_VALUE: 200;
|
|
16
|
+
readonly MAX_FPS_VALUE: 300;
|
|
17
|
+
readonly OVERLAY_STYLES: {
|
|
18
|
+
readonly position: "fixed";
|
|
19
|
+
readonly top: "0px";
|
|
20
|
+
readonly right: "0px";
|
|
21
|
+
readonly left: "auto";
|
|
22
|
+
readonly zIndex: "9999";
|
|
23
|
+
readonly cursor: "pointer";
|
|
24
|
+
readonly opacity: "0.9";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
declare const CONVERSION: {
|
|
28
|
+
readonly BYTES_TO_MB: 1048576;
|
|
29
|
+
readonly MS_PER_SECOND: 1000;
|
|
30
|
+
};
|
|
31
|
+
declare const PANEL_CONFIGS: readonly [{
|
|
32
|
+
readonly name: "FPS";
|
|
33
|
+
readonly foregroundColor: "#0ff";
|
|
34
|
+
readonly backgroundColor: "#002";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "MS";
|
|
37
|
+
readonly foregroundColor: "#0f0";
|
|
38
|
+
readonly backgroundColor: "#020";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "MB";
|
|
41
|
+
readonly foregroundColor: "#f08";
|
|
42
|
+
readonly backgroundColor: "#201";
|
|
43
|
+
}];
|
|
44
|
+
export { PANEL_CONFIG, STATS_CONFIG, CONVERSION, PANEL_CONFIGS };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const PANEL_CONFIG = {
|
|
2
|
+
WIDTH: 160,
|
|
3
|
+
HEIGHT: 96,
|
|
4
|
+
TEXT_PADDING: 3,
|
|
5
|
+
TEXT_Y_OFFSET: 2,
|
|
6
|
+
GRAPH_Y_OFFSET: 15,
|
|
7
|
+
GRAPH_WIDTH: 150,
|
|
8
|
+
GRAPH_HEIGHT: 70,
|
|
9
|
+
FONT_SIZE: 9,
|
|
10
|
+
FONT_FAMILY: 'Helvetica,Arial,sans-serif',
|
|
11
|
+
GRAPH_ALPHA: 0.9,
|
|
12
|
+
};
|
|
13
|
+
const STATS_CONFIG = {
|
|
14
|
+
UPDATE_INTERVAL: 1000,
|
|
15
|
+
MAX_MS_VALUE: 200,
|
|
16
|
+
MAX_FPS_VALUE: 300,
|
|
17
|
+
OVERLAY_STYLES: {
|
|
18
|
+
position: 'fixed',
|
|
19
|
+
top: '0px',
|
|
20
|
+
right: '0px',
|
|
21
|
+
left: 'auto',
|
|
22
|
+
zIndex: '9999',
|
|
23
|
+
cursor: 'pointer',
|
|
24
|
+
opacity: '0.9',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const CONVERSION = {
|
|
28
|
+
BYTES_TO_MB: 1048576,
|
|
29
|
+
MS_PER_SECOND: 1000,
|
|
30
|
+
};
|
|
31
|
+
const PANEL_CONFIGS = [
|
|
32
|
+
{ name: 'FPS', foregroundColor: '#0ff', backgroundColor: '#002' },
|
|
33
|
+
{ name: 'MS', foregroundColor: '#0f0', backgroundColor: '#020' },
|
|
34
|
+
{ name: 'MB', foregroundColor: '#f08', backgroundColor: '#201' },
|
|
35
|
+
];
|
|
36
|
+
export { PANEL_CONFIG, STATS_CONFIG, CONVERSION, PANEL_CONFIGS };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface Panel {
|
|
2
|
+
dom: HTMLCanvasElement;
|
|
3
|
+
update: (value: number, maxValue: number) => void;
|
|
4
|
+
}
|
|
5
|
+
interface StatsInstance {
|
|
6
|
+
dom: HTMLDivElement;
|
|
7
|
+
showPanel: (id: number) => void;
|
|
8
|
+
update: () => void;
|
|
9
|
+
destroy?: () => void;
|
|
10
|
+
}
|
|
11
|
+
interface PerformanceWithMemory extends Performance {
|
|
12
|
+
memory?: {
|
|
13
|
+
usedJSHeapSize: number;
|
|
14
|
+
jsHeapSizeLimit: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface PanelConfig {
|
|
18
|
+
name: string;
|
|
19
|
+
foregroundColor: string;
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
}
|
|
22
|
+
export type { Panel, StatsInstance, PerformanceWithMemory, PanelConfig };
|
|
File without changes
|
package/dist/esm/init.js
CHANGED
|
@@ -11,6 +11,9 @@ interface Cornerstone3DConfig {
|
|
|
11
11
|
renderingEngineMode?: RenderingEngineModeType;
|
|
12
12
|
webGlContextCount?: number;
|
|
13
13
|
};
|
|
14
|
+
debug: {
|
|
15
|
+
statsOverlay?: boolean;
|
|
16
|
+
};
|
|
14
17
|
peerImport?: (moduleId: string) => Promise<any>;
|
|
15
18
|
}
|
|
16
19
|
export type { Cornerstone3DConfig as default };
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.
|
|
1
|
+
export declare const version = "3.31.0";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.
|
|
1
|
+
export const version = '3.31.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.31.0",
|
|
4
4
|
"description": "Cornerstone3D Core",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"type": "individual",
|
|
98
98
|
"url": "https://ohif.org/donate"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "ea3e44970a9e535db1f38c8186653ffb7376ecf9"
|
|
101
101
|
}
|