Expand DICOM decoding and Enhanced CT support
This commit is contained in:
1 parent
c7f9af8025
commit
6b95fbb1fc
9 files changed
+508
-96
No files matched your search
@@ -83,13 +83,15 @@ final class PatientLibrary: ObservableObject {
|
||||
return image
|
||||
}
|
||||
|
||||
func importDICOM(from sources: [URL], for patientID: UUID) throws -> PatientImage {
|
||||
func importDICOM(from sources: [URL], for patientID: UUID) async throws -> PatientImage {
|
||||
let accessed = sources.filter { $0.startAccessingSecurityScopedResource() }
|
||||
defer { accessed.forEach { $0.stopAccessingSecurityScopedResource() } }
|
||||
try await Task.detached(priority: .userInitiated) {
|
||||
_ = try DICOMVolume(urls: sources)
|
||||
}.value
|
||||
guard let position = patients.firstIndex(where: { $0.id == patientID }) else {
|
||||
throw LibraryError.patientMissing
|
||||
}
|
||||
let accessed = sources.filter { $0.startAccessingSecurityScopedResource() }
|
||||
defer { accessed.forEach { $0.stopAccessingSecurityScopedResource() } }
|
||||
_ = try DICOMVolume(urls: sources)
|
||||
try prepareDirectory()
|
||||
let name = sources.count == 1 ? sources[0].lastPathComponent : "Серия DICOM (\(sources.count) срезов)"
|
||||
let image = PatientImage(id: UUID(), name: name, importedAt: Date(), dicomCount: sources.count)
|
||||
|
||||
Reference in new issue
Block a user