xlsx.from.Rdcm {espadon} | R Documentation |
Converting .Rdcm files to .xlsx files
Description
A *.Rdcm file contains the list of contents, in dataframe form,
of the DICOM files of the same object.
The xlsx.from.Rdcm
function creates, from a *.Rdcm file, an Excel file,
in which each page contains the dataframe representation of a DICOM file of
the same object.
Usage
xlsx.from.Rdcm(
Rdcm.filenames,
dest.dirname = dirname(Rdcm.filenames),
txt.sep = "\\",
txt.length = 100,
tag.dictionary = dicom.tag.dictionary()
)
Arguments
Rdcm.filenames |
String vector, representing the *.Rdcm filenames to be converted. |
dest.dirname |
String vector of the same length as |
txt.sep |
String. Used if |
txt.length |
Positive integer. Used if |
tag.dictionary |
Dataframe, by default equal to dicom.tag.dictionary, whose structure it must keep. This dataframe is used to parse DICOM files. |
Value
Returns a boolean vector, establishing the existence of the created Excel files which have the same basenames as the *.Rdcm files.
Examples
# First, create a Rdcm file from toy.dicom.raw () to a temporary file for testing.
pat.dir <- file.path (tempdir(), "PM_Rdcm")
dir.create (pat.dir, recursive = TRUE)
dcm.filename <- tempfile (pattern = "PM_rtplan", tmpdir = pat.dir, fileext = ".dcm")
zz <- file (dcm.filename, "wb")
writeBin (toy.dicom.raw (), zz, size = 1)
close (zz)
dicom.to.Rdcm.converter (dcm.filename, pat.dir, update = TRUE)
file.remove (dcm.filename)
list.files (pat.dir)
# Creating an Excel file
Rdcm.filenames <- list.files (pat.dir, pattern = "[.]Rdcm$",
recursive = TRUE, full.names = TRUE)
xlsx.from.Rdcm (Rdcm.filenames)
list.files (pat.dir)
# Cleaning temporary directory
unlink (pat.dir, recursive = TRUE)