dcm_db: Internal function to create a database of DICOM headers.

View source: R/dcm_db.R

dcm_dbR Documentation

Internal function to create a database of DICOM headers.

Description

The function creates a database of DICOM headers present in a folder structure. Each series should be in its own folder, but they can be in a nested folder structure. Files where there are also folder present next to them at the same level will not be parsed. That is the folder structure needs to comply with the DICOM standard. Be aware that the function requires python and pydicom to be installed! The function cycles through all folders present in the provided path and recursively goes through them, every subfolder, and extracts the DICOM header information from the files using the dcmread function of the pydicom package. The extension of the files can be provided by the ext argument, as DICOM files may have different extensions then that of .dcm. Also, using the all boolean argument, you can specify whether the function provides output for each file, or only for the first file, which is beneficial if you are analyzing multi-slice series, as all instances have almost all the same header information. Furthermore, using the keywords argument you can manually specify which DICOM keywords you wish to extract. These need to be a valid keyword specified in the DICOM standard.

Usage

dcm_db(path, ext, all, keywords, nThread, pydicom)

Arguments

path

string vector, full folder path to folder that contains the images.

ext

string array, possible file extensions to parse. It is advised to add . before the extensions as the given character patterns may be present elsewhere in the file names. Furthermore, if DICOM files without an extension should also be parsed, then add "" to the extensions as then the script will try to read all files without an extension. Also, the file names and the extensions are converted to lower case before matching to avoid mismatches due to capitals.

all

boolean, whether all files in a series should be parsed, or only the first one.

keywords

string array, of valid DICOM keywords.

nThread

integer, number of threads to use for parsing data.

pydicom

package, pydicom package initiated from parent environment.

Value

data.table, with DICOM header information. This is then used by create_img_db which formats the output.


parseRPDR documentation built on March 31, 2023, 11:36 p.m.