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 Rdcm.filenames, indicating the directory where the *.xlsx files will be created.

txt.sep

String. Used if as.txt = TRUE. Separator of the tag value elements.

txt.length

Positive integer. Used if as.txt = TRUE. Maximum number of letters in the representation of the TAG value.

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)

[Package espadon version 1.7.0 Index]