2026-05-04-05-20-16 优化DICOM切片下载和3D预览

This commit is contained in:
2026-05-04 05:32:34 +08:00
parent 4ef3be69f4
commit 4922c2d991
8 changed files with 584 additions and 37 deletions

View File

@@ -81,3 +81,24 @@ export async function downloadMask(projectId: string, format: 'nii' | 'nii.gz' =
link.remove();
URL.revokeObjectURL(url);
}
export async function downloadDicomArchive(projectId: string) {
const response = await fetch(`/api/projects/${projectId}/dicom-archive`);
if (!response.ok) {
throw new Error(`DICOM 压缩包下载失败:${response.status}`);
}
const blob = await response.blob();
const disposition = response.headers.get('Content-Disposition') ?? '';
const match = disposition.match(/filename="([^"]+)"/);
const filename = match?.[1] ?? `${projectId}-dicom-series.tar.gz`;
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();
link.remove();
URL.revokeObjectURL(url);
}