create3D: Create Arrays from DICOM Headers/Images

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/create.R

Description

A DICOM list structure is used to produce a multi-dimensional array representing a single acquisition of medical imaging data.

Usage

1
2
3
4
5
6
7
create3D(dcm, mode = "integer", transpose = TRUE, pixelData = TRUE,
  mosaic = FALSE, mosaicXY = NULL, sequence = FALSE,
  boffset = NULL)

create4D(dcm, mode = "integer", transpose = TRUE, pixelData = TRUE,
  mosaic = FALSE, mosaicXY = NULL, nslices = NULL, ntimes = NULL,
  instance = TRUE, sequence = FALSE)

Arguments

dcm

is the DICOM list structure (if pixelData = TRUE) or the DICOM header information (if pixelData = FALSE).

mode

is a valid character string for storage.mode.

transpose

is available in order to switch the definition of rows and columns from DICOM (default = TRUE.

pixelData

is a logical variable (default = TRUE) that is associated with the DICOM image data being pre-loaded.

mosaic

is a logical variable (default = FALSE) to denote storage of the data in Siemens ‘Mosaic’ format.

mosaicXY

is a vector of length two that provides the (x,y) dimensions of the individual images. Default behavior is to use the AcquisitonMatrix to determine the (x,y) values.

sequence

is a logical variable (default = FALSE) on whether to look in SequenceItem entries for DICOM header information.

boffset

is the number of bytes to skip at the beginning of the DICOM file (default = NULL which lets the code determine the starting point).

nslices

is the third dimension of the array. Attempts are made to determine this number from the DICOM data.

ntimes

is the fourth dimension of the array. Attempts are made to determine this number from the DICOM data.

instance

is a logical variable (default = TRUE) that determines whether or not to access the InstanceNumber field in the DICOM header to help order the slices.

Value

Multi-dimensional array of medical imaging data.

Author(s)

Brandon Whitcher bwhitcher@gmail.com

References

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

See Also

array, readDICOM, storage.mode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
load(system.file("hk-40/hk40.RData", package="oro.dicom"))
dcmList <- hk40
dcmImage <- create3D(dcmList)
image(dcmImage[,,1], col=grey(0:64/64), axes=FALSE, xlab="", ylab="",
      main=paste("First Slice from HK-40"))
imagePositionPatient <- attributes(dcmImage)$ipp
dSL <- abs(diff(imagePositionPatient[,3]))
plot(dSL, ylim=range(range(dSL) * 1.5, 0, 10), xlab="Image", ylab="mm",
     main="Difference in Slice Location")

## Not run: 
## pixelData = FALSE
## The DICOM image data are read from create3D()
## This may save on memory for large batches of DICOM data
dcmList <- readDICOM(system.file("hk-40", package="oro.dicom"),
                     pixelData=FALSE)
dcmImage <- create3D(dcmList, pixelData=FALSE)
image(dcmImage[,,1], col=grey(0:64/64), axes=FALSE, xlab="", ylab="",
      main=paste("First Slice from HK-40 (again)"))

## End(Not run)
## mosaic = TRUE
mosaicFile <- system.file("dcm/MR-sonata-3D-as-Tile.dcm", package="oro.dicom")
dcm <- readDICOMFile(mosaicFile)
image(t(dcm$img), col=grey(0:64/64), axes=FALSE, xlab="", ylab="",
      main="Siemens MOSAIC")
dcmImage <- create3D(dcm, mode="integer", mosaic=TRUE)
z <- trunc(dim(dcmImage)[3]/2)
image(dcmImage[,,z], col=grey(0:64/64), axes=FALSE, xlab="", ylab="",
      main=paste("Slice", z, "from Siemens MOSAIC"))

neuroconductor-devel-releases/oro.dicom documentation built on May 6, 2020, 4:26 p.m.