Learn R Programming

oro.dicom (version 0.5.3)

header2matrix: Converts DICOM Header Field to a Matrix

Description

Converts a vector of DICOM header information, assuming there are multiple entries per element of the vector, into a matrix.

Usage

header2matrix(hdr, ncol, sep = " ", byrow = TRUE)

Arguments

hdr

is the result from extracting information from a DICOM header field; e.g., using extractHeader.

ncol

is the number of columns.

sep

is the character string required to split entries in the header field.

byrow

is a logical variable (default = TRUE) telling the routine to populate the matrix by rows then columns.

Value

Matrix with length(hdr) rows and ncol columns.

References

Digital Imaging and Communications in Medicine (DICOM) http://medical.nema.org

See Also

extractHeader, matrix

Examples

Run this code
# NOT RUN {
x <- readDICOMFile(system.file("dcm/Abdo.dcm", package="oro.dicom"))
pixelSpacing <- extractHeader(x$hdr, "PixelSpacing", numeric=FALSE)
pSmat <- header2matrix(pixelSpacing, ncol=2)
IOP <- extractHeader(x$hdr, "ImageOrientationPatient", numeric=FALSE)
IOPmat <- header2matrix(IOP, ncol=6)

# }

Run the code above in your browser using DataLab