Skip to content

Commit f41e8a1

Browse files
committed
fix(deps): roll back vtk.js due to paint widget bug
Added a e2e test to catch the bug in the future.
1 parent 06f0bba commit f41e8a1

File tree

9 files changed

+2605
-352
lines changed

9 files changed

+2605
-352
lines changed

package-lock.json

Lines changed: 2525 additions & 327 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@itk-wasm/dicom": "^7.6.4",
3737
"@itk-wasm/image-io": "1.6.0",
3838
"@itk-wasm/morphological-contour-interpolation": "2.0.0",
39-
"@kitware/vtk.js": "^34.15.1",
39+
"@kitware/vtk.js": "^32.12.1",
4040
"@netlify/edge-functions": "^3.0.2",
4141
"@rollup/plugin-replace": "^6.0.3",
4242
"@sentry/vite-plugin": "^4.6.1",

src/components/vtk/VtkBaseVolumeRepresentation.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ useEventListener(
9292
9393
watch(updatedExtents, (current, old) => {
9494
const startOffset = old.length;
95-
rep.property.setUpdatedExtents([
96-
...rep.property.getUpdatedExtents(),
95+
rep.mapper.setUpdatedExtents([
96+
...rep.mapper.getUpdatedExtents(),
9797
...current.slice(startOffset),
9898
]);
9999
view.requestRender();
@@ -149,23 +149,22 @@ watchEffect(() => {
149149
150150
setCinematicVolumeScatter({
151151
enabled: enabled && useVolumetricScatteringBlending,
152-
property,
152+
mapper,
153153
blending: volumetricScatteringBlending,
154154
});
155155
156156
setCinematicVolumeSampling({
157157
enabled,
158158
image: img,
159159
mapper,
160-
property,
161160
quality: volumeQuality,
162161
});
163162
164163
setCinematicLocalAmbientOcclusion({
165164
enabled: enabled && useLocalAmbientOcclusion,
166165
kernelRadius: laoKernelRadius,
167166
kernelSize: laoKernelSize,
168-
property,
167+
mapper,
169168
});
170169
171170
view.requestRender();

src/core/remote/chunkedParser.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
import { Maybe } from '@/src/types';
42
import { ensureError } from '@/src/utils';
53
import * as BaseParser from 'socket.io-parser';

src/store/tools/useAnnotationTool.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,4 @@ export type AnnotationToolAPI<T extends AnnotationTool> = ReturnType<
225225
};
226226

227227
export interface AnnotationToolStore<T extends AnnotationTool = AnnotationTool>
228-
extends UnwrapAll<AnnotationToolAPI<T>>,
229-
IToolStore {}
228+
extends UnwrapAll<AnnotationToolAPI<T>>, IToolStore {}

src/utils/volumeProperties.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,13 @@ export function setCinematicLighting({
8282
export interface SetCinematicVolumeSamplingParameters {
8383
enabled: boolean;
8484
mapper: vtkVolumeMapper;
85-
property: vtkVolumeProperty;
8685
quality: number;
8786
image: vtkImageData;
8887
}
8988

9089
export function setCinematicVolumeSampling({
9190
enabled,
9291
mapper,
93-
property,
9492
quality,
9593
image,
9694
}: SetCinematicVolumeSamplingParameters) {
@@ -105,8 +103,8 @@ export function setCinematicVolumeSampling({
105103
mapper.setMaximumSamplesPerRay(samplesPerRay);
106104
mapper.setSampleDistance(sampleDistance);
107105
// Adjust the global illumination reach by volume quality slider
108-
property.setGlobalIlluminationReach(enabled ? 0.25 * quality : 0);
109-
property.setComputeNormalFromOpacity(!enabled && quality > 2);
106+
mapper.setGlobalIlluminationReach(enabled ? 0.25 * quality : 0);
107+
mapper.setComputeNormalFromOpacity(!enabled && quality > 2);
110108
}
111109

112110
export interface SetCinematicVolumeShadingParameters {
@@ -153,38 +151,38 @@ export function setCinematicVolumeShading({
153151

154152
export interface SetCinematicVolumeScatterParameters {
155153
enabled: boolean;
156-
property: vtkVolumeProperty;
154+
mapper: vtkVolumeMapper;
157155
blending: number;
158156
}
159157

160158
export function setCinematicVolumeScatter({
161159
enabled,
162-
property,
160+
mapper,
163161
blending,
164162
}: SetCinematicVolumeScatterParameters) {
165-
property.setVolumetricScatteringBlending(enabled ? blending : 0);
163+
mapper.setVolumetricScatteringBlending(enabled ? blending : 0);
166164
}
167165

168166
export interface SetCinematicLocalAmbientOcclusionParameters {
169167
enabled: boolean;
170-
property: vtkVolumeProperty;
168+
mapper: vtkVolumeMapper;
171169
kernelSize: number;
172170
kernelRadius: number;
173171
}
174172

175173
export function setCinematicLocalAmbientOcclusion({
176174
enabled,
177-
property,
175+
mapper,
178176
kernelSize,
179177
kernelRadius,
180178
}: SetCinematicLocalAmbientOcclusionParameters) {
181179
if (enabled) {
182-
property.setLocalAmbientOcclusion(true);
183-
property.setLAOKernelSize(kernelSize);
184-
property.setLAOKernelRadius(kernelRadius);
180+
mapper.setLocalAmbientOcclusion(true);
181+
mapper.setLAOKernelSize(kernelSize);
182+
mapper.setLAOKernelRadius(kernelRadius);
185183
} else {
186-
property.setLocalAmbientOcclusion(false);
187-
property.setLAOKernelSize(0);
188-
property.setLAOKernelRadius(0);
184+
mapper.setLocalAmbientOcclusion(false);
185+
mapper.setLAOKernelSize(0);
186+
mapper.setLAOKernelRadius(0);
189187
}
190188
}
113 KB
Loading

tests/pageobjects/volview.page.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ class VolViewPage extends Page {
132132
await button.click();
133133
}
134134

135+
get paintButton() {
136+
return $('button span i[class~=mdi-brush]');
137+
}
138+
139+
async activatePaint() {
140+
const button = this.paintButton;
141+
await button.click();
142+
}
143+
135144
get viewTwoContainer() {
136145
return $('div[data-testid~="two-view-container"]');
137146
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import AppPage from '../pageobjects/volview.page';
2+
3+
describe('Paint tool rendering', () => {
4+
it('should not black out axial view after painting', async () => {
5+
await AppPage.open();
6+
await AppPage.downloadProstateSample();
7+
await AppPage.waitForViews();
8+
9+
const views2D = await AppPage.getViews2D();
10+
const axialView = views2D[0];
11+
12+
await AppPage.activatePaint();
13+
14+
const canvas = await axialView.$('canvas');
15+
const location = await canvas.getLocation();
16+
const size = await canvas.getSize();
17+
18+
const centerX = location.x + size.width / 2;
19+
const centerY = location.y + size.height / 2;
20+
21+
await browser
22+
.action('pointer')
23+
.move({ x: Math.round(centerX), y: Math.round(centerY) })
24+
.down()
25+
.move({ x: Math.round(centerX + 50), y: Math.round(centerY + 30) })
26+
.up()
27+
.perform();
28+
29+
for (let i = 0; i < 5; i++) {
30+
await browser
31+
.action('pointer')
32+
.move({ x: Math.round(centerX + i * 20), y: Math.round(centerY) })
33+
.perform();
34+
}
35+
36+
await browser.waitUntil(
37+
async () => {
38+
const result = await browser.checkElement(
39+
axialView,
40+
'paint_tool_axial_view_after_stroke'
41+
);
42+
return (result as number) < 5;
43+
},
44+
{
45+
timeout: 10000,
46+
timeoutMsg:
47+
'Axial view should not go black after painting with paint tool',
48+
interval: 1000,
49+
}
50+
);
51+
});
52+
});

0 commit comments

Comments
 (0)