# First, save toy.dicom.raw () raw data to a temporary file for testing.
pat.src.dir <- file.path (tempdir(), "toy_dcm")
dir.create (pat.src.dir, recursive = TRUE)
dcm.filename <- tempfile (pattern = "toyrtplan", tmpdir = pat.src.dir,
fileext = ".dcm")
zz <- file (dcm.filename, "wb")
writeBin (toy.dicom.raw (), zz, size = 1)
close (zz)
# loading of file
dicom.raw.data <- dicom.raw.data.loader (dcm.filename)
# checks if it is consistent with the original raw data
all ( dicom.raw.data == toy.dicom.raw () )
# Cleaning temporary directory
unlink (pat.src.dir, recursive = TRUE)
Run the code above in your browser using DataLab