com.github.charleslzq.dicom.store.LocalFileSaveHandler.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dicom-tools Show documentation
Show all versions of dicom-tools Show documentation
some tool to handle dicom file
package com.github.charleslzq.dicom.store
import java.net.URI
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
class LocalFileSaveHandler : DicomImageFileSaveHandler {
override fun save(path: Path, imageMap: Map): Map {
return imageMap.map { it.key to copyFile(it.value, path.toFile().absolutePath) }.toMap()
}
private fun copyFile(uri: URI, newDir: String): URI {
val rawPath = Paths.get(uri)
val fileName = rawPath.toFile().name
val filePath = Paths.get(newDir, fileName)
Files.copy(rawPath, filePath, StandardCopyOption.REPLACE_EXISTING)
return filePath.toUri()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy