Upload CT studies through the original EzServer API

This commit is contained in:
SantaSpeen committed 2026-11-23 17:23:25 +03:00
1 parent b11a8f62f9
commit 6eb601a4fe
3 files changed
+74 -22

No files matched your search

+7 -8
View File
@@ -208,8 +208,7 @@ struct PatientWorkspace: View {
Divider()
if record.images.isEmpty {
emptyState("Снимков пока нет", detail: server == nil ? "Выберите изображение или все DICOM-срезы одной серии."
: "Выберите изображение или 2D-файл DICOM.",
emptyState("Снимков пока нет", detail: "Выберите изображение, файл DICOM или все срезы одной серии.",
icon: "photo.on.rectangle")
} else {
let selected = record.images.first { $0.id == imageID } ?? record.images[0]
@@ -271,14 +270,14 @@ struct PatientWorkspace: View {
do {
let image: PatientImage
if let server {
guard series.count == 1 else { throw ServerError.seriesUpload }
let source = series[0]
let frames = try await Task.detached(priority: .userInitiated) {
try DICOMVolume(urls: [source]).size.z
try DICOMVolume(urls: series).size.z
}.value
guard frames == 1 else { throw ServerError.seriesUpload }
let uploaded = try await server.upload(source, chart: targetChart.chartNumber, dicom: true)
image = uploaded.record
if frames > 1 {
image = try await server.uploadCT(series, chart: targetChart.chartNumber).record
} else {
image = try await server.upload(series[0], chart: targetChart.chartNumber, dicom: true).record
}
} else {
image = try await library.importDICOM(from: series, for: importPatientID)
}