Add profile 3D preferences and adapt DICOM preview resolution to memory budget

This commit is contained in:
SantaSpeen committed 2026-10-22 22:29:28 +03:00
1 parent 705762d57c
commit 7fd7ae6733
22 files changed
+500 -68

No files matched your search

+46
View File
@@ -59,6 +59,23 @@ const { chromium } = require(process.env.PLAYWRIGHT_MODULE || "playwright");
res.end(JSON.stringify(data));
};
if (u.pathname === "/api/session") return json(user);
if (u.pathname === "/api/users/1" && req.method === "PUT") {
let body = "";
req.on("data", (chunk) => {
body += chunk;
});
req.on("end", () => {
const update = JSON.parse(body);
if (!update.which.includes("dicom3D")) {
res.writeHead(400);
res.end();
return;
}
Object.assign(user, update.data);
json({});
});
return;
}
if (u.pathname === "/api/addons") return json([]);
if (u.pathname.startsWith("/api/resources"))
return json(
@@ -106,6 +123,30 @@ const { chromium } = require(process.env.PLAYWRIGHT_MODULE || "playwright");
});
await route.fulfill({ response });
});
await page.goto(base + "/settings/profile");
await page.getByLabel("3D preview quality").selectOption("half");
await page.getByLabel("Voxel memory limit").selectOption("512");
await page.getByLabel("Initial opacity").fill("50");
await Promise.all([
page.waitForResponse(
(r) => r.url().endsWith("/api/users/1") && r.status() === 200
),
page.getByRole("button", { name: "Save", exact: true }).click(),
]);
await page.reload();
await page.getByLabel("3D preview quality").waitFor();
if (
(await page.getByLabel("3D preview quality").inputValue()) !== "half" ||
(await page.getByLabel("Voxel memory limit").inputValue()) !== "512"
)
throw new Error("3D profile settings were not restored");
await page.getByLabel("3D preview quality").selectOption("auto");
await Promise.all([
page.waitForResponse(
(r) => r.url().endsWith("/api/users/1") && r.status() === 200
),
page.getByRole("button", { name: "Save", exact: true }).click(),
]);
await page.goto(base + "/files/series/scan_1.dcm");
await page.waitForFunction(
() =>
@@ -120,6 +161,11 @@ const { chromium } = require(process.env.PLAYWRIGHT_MODULE || "playwright");
await page
.locator(".dicom-volume-stage canvas")
.waitFor({ timeout: 20000 });
if (
(await page.locator('.dicom-volume input[type="range"]').inputValue()) !==
"0.5"
)
throw new Error("Viewer ignored profile opacity");
for (const label of ["Axial", "Sagittal", "Coronal", "3D"]) {
await page.getByRole("button", { name: label, exact: true }).click();
await page.waitForTimeout(150);