sortDicomDirectories: Sort a directory of DICOM files into series

Description Usage Arguments Value Author(s) References See Also

View source: R/dicom_dir.R


This function sorts a directory containing DICOM files into subdirectories by series UID (DICOM tag 0x0020,0x000e), subject name (0x0010,0x0010) and/or scan date (0x0008,0x0020). Each unique identifier, together with its description for series, will be used as the name for a new subdirectory, and all relevant files will be copied into that subdirectory. Duplicate file names are disambiguated if necessary.


sortDicomDirectories(directories, deleteOriginals = FALSE,
  sortOn = "series", seriesId = c("UID", "number", "time"), nested = TRUE,



A character vector giving the directories to search for DICOM files. Subdirectories will also be searched.


A single logical value. If TRUE, then the source files will be deleted after being copied to their new locations, making the operation a move rather than a copy. Nothing will be deleted if the copy fails.


The string "series", "subject" or "date", or any combination in the order desired. This will be the basis of the sort, which will be nested if more than one type is specified.


A string describing the kind of series identifier to use for sorting by series: "UID" (DICOM tag 0x0020,0x000e; the default), "number" (0x0020,0x0011) or "time" (0x0008,0x0031).


Logical value. If TRUE and directories is of length 1, subdirectories will be created within the specified original directory. Otherwise they will be created in the working directory.


Additional arguments to pass to readDicomFile.


This function is called for its side effect.


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

readDicomDirectory for reading DICOM files into an MriImage object.

tractor.base documentation built on March 18, 2018, 2:20 p.m.