readDicomFile: Read a DICOM file into a DicomMetadata object

Description Usage Arguments Value Author(s) References See Also


This function reads a DICOM file into a DicomMetadata object. Only DICOM files from magnetic resonance scanners are supported.


readDicomFile(fileName, checkFormat = TRUE, stopTag = NULL,
  ignoreTransferSyntax = FALSE, ascii = TRUE)



The name of a DICOM file.


If TRUE, the function will check for the magic string "DICM" at byte offset 128. This string should be present, but in reality not all files contain it.


An integer vector giving the group and element numbers (in that order) of a DICOM tag, or NULL. If not NULL, the function will stop parsing the DICOM file if the specified tag is encountered. This can be used to speed up the process if a specific tag is required.


If TRUE, any transfer syntax stored in the file will be ignored, and the code will try to deduce the transfer syntax using heuristics. This may occasionally be necessary for awkward DICOM files, but is not generally recommended.


If TRUE, the function will attempt to read an embedded Siemens ASCII header, if one exists.


readDicomFile returns a DicomMetadata object, or NULL on failure.


Jon Clayden


Please cite the following reference when using TractoR in your work:

J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18.

See Also

The DICOM standard, found online at (Warning: may produce headaches!) Also readDicomDirectory for information on how to create MriImage objects from DICOM files.

Search within the tractor.base package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.