Learn R Programming

oro.dicom (version 0.2.4)

dicom2nifti: Convert DICOM Header to NIfTI

Description

A subset of header information from DICOM is placed into NIfTI-1 format.

Usage

dicom2nifti(img, hdr, units=c("mm","sec"), rescale=FALSE, 
            descrip="SeriesDescription", ...)

Arguments

img
Multi-dimensional data volume
hdr
DICOM header
units
Spatial and temporal units for xyzt
rescale
Should slope and intercept parameters be extracted from the DICOM headers and saved?
descrip
DICOM header field(s) to be included in the descrip
...
Arguments to be passed to nifti

Value

  • An object of class nifti.

Details

See the references.

References

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

NIfTI-1 http://nifti.nimh.nih.gov/nifti-1

See Also

dicom2analyze, nifti

Examples

Run this code
## pixelData = TRUE
dcmList <- dicomSeparate(system.file("hk-40", package="oro.dicom"))
dcmImage <- create3D(dcmList, mode="integer")
## Accumulate voxel dimensions
pS <- header2matrix(extractHeader(dcmList$hdr, "PixelSpacing", FALSE), 2)[1,]
sT <- extractHeader(dcmList$hdr, "SliceThickness")[1]
pixdim <- c(0, pS, sT, rep(1,4))
require("oro.nifti")
dcmNifti <- nifti(dcmImage, datatype=4, pixdim=pixdim)
par(bg="black")
image(dcmNifti)
orthographic(dcmNifti)

Run the code above in your browser using DataLab