# First, save toy.dicom.raw () raw data to a temporary file pat.dir for testing.
temp <- tempdir()
pat.dir <- file.path (temp, "toy_dcm")
dir.create (pat.dir, recursive = TRUE)
dcm.filename <- tempfile (pattern = "toyrtplan", tmpdir = pat.dir,
fileext = ".dcm")
zz <- file (dcm.filename, "wb")
writeBin (toy.dicom.raw (), zz, size = 1)
close (zz)
# Files anonymisation
anonymous.pat.dir <- file.path (temp, "anonymous")
dicom.patient.anonymiser (dcm.files = pat.dir, pat.dest.dir = anonymous.pat.dir,
offset = 0, new.PIN = "Anonymous patient",
reset.private.tag = TRUE)
lf <- list.files(anonymous.pat.dir, full.names = TRUE)
dp <- dicom.parser(lf[1])
dp[grep("^[(]0008|^[(]0010", dp$TAG),]
# Cleaning temporary directory
unlink (pat.dir, recursive = TRUE)
Run the code above in your browser using DataLab