Skip to content
Closed

d #2175

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"prepublishOnly": "yarn run build"
},
"dependencies": {
"@kitware/vtk.js": "32.12.1",
"@kitware/vtk.js": "33.3.2",
"comlink": "^4.4.1",
"gl-matrix": "^3.4.3",
"loglevel": "^1.9.2"
Expand Down
27 changes: 10 additions & 17 deletions packages/core/src/RenderingEngine/RenderingEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import type {
import { OrientationAxis } from '../enums';
import VolumeViewport3D from './VolumeViewport3D';

const FIXED_OFFSCREEN_SIZE = { width: 16384, height: 16384 };

interface ViewportDisplayCoords {
sxStartDisplayCoords: number;
syStartDisplayCoords: number;
Expand Down Expand Up @@ -102,6 +104,8 @@ class RenderingEngine {
this.offscreenMultiRenderWindow =
vtkOffscreenMultiRenderWindow.newInstance();
this.offScreenCanvasContainer = document.createElement('div');
this.offScreenCanvasContainer.style.width = `${FIXED_OFFSCREEN_SIZE.width}px`;
this.offScreenCanvasContainer.style.height = `${FIXED_OFFSCREEN_SIZE.height}px`;
this.offscreenMultiRenderWindow.setContainer(
this.offScreenCanvasContainer
);
Expand Down Expand Up @@ -959,28 +963,17 @@ class RenderingEngine {
} {
const { offScreenCanvasContainer, offscreenMultiRenderWindow } = this;

// 1. Calculated the height of the offScreen canvas to be the maximum height
// between canvases
const offScreenCanvasHeight = Math.max(
...canvasesDrivenByVtkJs.map((canvas) => canvas.height)
);

// 2. Calculating the width of the offScreen canvas to be the sum of all
let offScreenCanvasWidth = 0;

canvasesDrivenByVtkJs.forEach((canvas) => {
offScreenCanvasWidth += canvas.width;
});

// @ts-expect-error
offScreenCanvasContainer.width = offScreenCanvasWidth;
offScreenCanvasContainer.width = FIXED_OFFSCREEN_SIZE.width;
// @ts-expect-error
offScreenCanvasContainer.height = offScreenCanvasHeight;
offScreenCanvasContainer.height = FIXED_OFFSCREEN_SIZE.height;

// 3. Resize command
offscreenMultiRenderWindow.resize();

return { offScreenCanvasWidth, offScreenCanvasHeight };
return {
offScreenCanvasWidth: FIXED_OFFSCREEN_SIZE.width,
offScreenCanvasHeight: FIXED_OFFSCREEN_SIZE.height,
};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ function vtkOffscreenMultiRenderWindow(publicAPI, model) {
model.openGLRenderWindow = vtkStreamingOpenGLRenderWindow.newInstance();
model.renderWindow.addView(model.openGLRenderWindow);

// Create offscreen canvas and set it immediately
const offscreenCanvas = document.createElement('canvas');
offscreenCanvas.width = 16384;
offscreenCanvas.height = 16384;
model.openGLRenderWindow.setCanvas(offscreenCanvas);
model.openGLRenderWindow.setSize(16384, 16384);

// Interactor
model.interactor = vtkRenderWindowInteractor.newInstance();
model.interactor.setView(model.openGLRenderWindow);
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@docusaurus/module-type-aliases": "3.6.3",
"@docusaurus/plugin-google-gtag": "3.6.3",
"@docusaurus/preset-classic": "3.6.3",
"@kitware/vtk.js": "32.12.1",
"@kitware/vtk.js": "33.3.2",
"@mdx-js/react": "^3.0.1",
"@svgr/webpack": "^8.1.0",
"clsx": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/labelmap-interpolation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"peerDependencies": {
"@cornerstonejs/core": "^3.26.0",
"@cornerstonejs/tools": "^3.26.0",
"@kitware/vtk.js": "32.12.1"
"@kitware/vtk.js": "33.3.2"
}
}
2 changes: 1 addition & 1 deletion packages/polymorphic-segmentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"peerDependencies": {
"@cornerstonejs/core": "^3.26.0",
"@cornerstonejs/tools": "^3.26.0",
"@kitware/vtk.js": "32.12.1"
"@kitware/vtk.js": "33.3.2"
}
}
2 changes: 1 addition & 1 deletion packages/tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
},
"peerDependencies": {
"@cornerstonejs/core": "^3.26.0",
"@kitware/vtk.js": "32.12.1",
"@kitware/vtk.js": "33.3.2",
"@types/d3-array": "^3.0.4",
"@types/d3-interpolate": "^3.0.1",
"d3-array": "^3.2.3",
Expand Down
Loading