Raise DICOM volume limit to 1 GiB and simplify image controls
This commit is contained in:
1 parent
6873f04bfb
commit
68a6801690
8 files changed
+20
-18
No files matched your search
@@ -87,13 +87,15 @@ describe("DICOM series", () => {
|
||||
);
|
||||
});
|
||||
it("rejects excessive allocations before allocating a volume", () => {
|
||||
expect(MAX_VOLUME_BYTES).toBe(128 * 1024 * 1024);
|
||||
expect(MAX_VOLUME_BYTES).toBe(1024 * 1024 * 1024);
|
||||
expect(() =>
|
||||
assembleVolume([
|
||||
{ ...slice(0), rows: 4096, cols: 4096 },
|
||||
{ ...slice(1), rows: 4096, cols: 4096 },
|
||||
{ ...slice(2), rows: 4096, cols: 4096 },
|
||||
])
|
||||
assembleVolume(
|
||||
Array.from({ length: 17 }, (_, i) => ({
|
||||
...slice(i),
|
||||
rows: 4096,
|
||||
cols: 4096,
|
||||
}))
|
||||
)
|
||||
).toThrow("DICOM_VOLUME_LIMIT");
|
||||
});
|
||||
it("decodes real DICOM slices and validates their geometry", async () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ export interface DicomSource {
|
||||
size: number;
|
||||
isDir?: boolean;
|
||||
}
|
||||
export const MAX_VOLUME_BYTES = 128 * 1024 * 1024;
|
||||
export const MAX_VOLUME_BYTES = 1024 * 1024 * 1024;
|
||||
export const MAX_SERIES_FILES = 2048;
|
||||
|
||||
// Names only trigger the offer. Patient-space geometry is checked after consent.
|
||||
|
||||
@@ -18,7 +18,7 @@ export async function loadDicomVolume(
|
||||
throw new Error("DICOM_VOLUME_LIMIT");
|
||||
if (
|
||||
sources.some((s) => s.size > 64 * 1024 * 1024) ||
|
||||
sources.reduce((n, s) => n + s.size, 0) > 512 * 1024 * 1024
|
||||
sources.reduce((n, s) => n + s.size, 0) > MAX_VOLUME_BYTES
|
||||
)
|
||||
throw new Error("DICOM_VOLUME_LIMIT");
|
||||
const worker = new DicomWorker();
|
||||
@@ -30,7 +30,7 @@ export async function loadDicomVolume(
|
||||
const buffer = await readDicomFile(source.source, signal);
|
||||
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
|
||||
bytes += buffer.byteLength;
|
||||
if (bytes > 512 * 1024 * 1024) throw new Error("DICOM_VOLUME_LIMIT");
|
||||
if (bytes > MAX_VOLUME_BYTES) throw new Error("DICOM_VOLUME_LIMIT");
|
||||
const slice = await new Promise<DicomSlice>((resolve, reject) => {
|
||||
const cleanup = () => {
|
||||
clearTimeout(timeout);
|
||||
|
||||
Reference in new issue
Block a user