load_dicom: Loads DICOM images to RIA image format

View source: R/load_dicom.R

load_dicomR Documentation

Loads DICOM images to RIA image format

Description

Loads DICOM images to a RIA_image object. RIA_image is a list with three mandatory attributes.

  • RIA_data is a RIA_data object, which has two potential slots. $orig contains the original image after loading and is a 3D array of integers created with create3D. $modif contains the image that has been modified using functions.

  • RIA_header is a RIA_header object, which is list of DICOM header information.

  • RIA_log is a RIA_log object, which is a list updated by RIA functions and acts as a log and possible input for some functions.

Further attributes may also be added by RIA functions.

Usage

load_dicom(
  filename,
  mask_filename = NULL,
  keep_mask_values = 1,
  switch_z = FALSE,
  crop_in = TRUE,
  replace_in = TRUE,
  center_in = TRUE,
  zero_value = NULL,
  min_to = -1024,
  header_add = NULL,
  header_exclude = NULL,
  verbose_in = TRUE,
  recursive_in = TRUE,
  exclude_in = "sql",
  mode_in = "integer",
  transpose_in = TRUE,
  pixelData_in = TRUE,
  mosaic_in = FALSE,
  mosaicXY_in = NULL,
  sequence_in = FALSE,
  ...
)

Arguments

filename

string, file path to directory containing dcm files.

mask_filename

string vector, file path to optional directory containing dcm files of mask image. If multiple are supplied, then those voxels are kept which have one of the values of keep_mask_values in any of the supplied masks.

keep_mask_values

integer vector or string, indicates which value or values of the mask image to use as indicator to identify voxels wished to be processed. Usually 1-s indicate voxels wished to be processed. However, one mask image might contain several segmentations, in which case supplying several integers is allowed. Furthermore, if the same string is supplied to filename and mask_filename, then the integers in keep_mask_values are used to specify which voxel values to analyze. This way the provided image can be segmented to specific components. For example, if you wish to analyze only the low-density non-calcified component of coronary plaques, then keep_mask_values can specify this by setting it to: -100:30. If a single string is provided, then each element of the mask will be examined against the statement in the string. For example, if '>0.5' is provided i.e. the mask is probabilities after a DL algorithm, then all voxels with values >0.5 in the mask image will be kept. This can be a complex logical expression. The data on which the expression is executed is called data or data_mask, depending on whether you wish to filter the original image, that is the original image is supplied as a mask, or if you have unique mask files respectively. Therefore for complex logical expressions you can define for example: '>-100 & data<30' to consider data values between -100 and 30, or '>0.5 & data_mask<0.75' to select voxels based-on mask values between 0.5 and 0.75 for example if they represent a probability mask.

switch_z

logical, indicating whether to change the orientation of the images in the Z axis. Some software reverse the order of the manipulated image in the Z axis, and therefore the images of the mask image need to be reversed.

crop_in

logical, indicating whether to crop RIA_image to smallest bounding box.

replace_in

logical, whether to replace smallest values indicated by zero_value, which are considered to indicate no signal, to NA.

center_in

logical, whether to shift data so smallest value is equal to min_to input parameter.

zero_value

integer, indicating voxels values which are considered not to have any information. If left empty, then the smallest HU value in the image will be used, if replace_in is TRUE.

min_to

integer, value to which data is shifted to if center_in is TRUE.

header_add

dataframe, with three columns: Name, Group and Element containing the name, the group and the element code of the DICOM fields wished to be added to theRIA_header.

header_exclude

dataframe, with three columns: Name, Group and Element containing the name, the group and the element code of the DICOM fields wished to be excluded from the default header elements present in DICOM_codes rda file.

verbose_in

logical, indicating whether to print detailed information. Most prints can also be suppresed using the suppressMessages function.

recursive_in

recursive parameter input of readDICOM.

exclude_in

exclude parameter input of readDICOM.

mode_in

mode parameter input of create3D.

transpose_in

transpose parameter input of create3D.

pixelData_in

pixelData parameter input of create3D.

mosaic_in

mosaic parameter input of create3D.

mosaicXY_in

mosaicXY parameter input of create3D.

sequence_in

sequence parameter input of create3D.

...

additional arguments to readDICOM, readDICOMFile and create3D.

Details

load_dicom is used to transform DICOM datasets into the RIA environment. RIA_image object was developed to facilitate and simplify radiomics calculations by keeping all necessary information in one place.

RIA_data stores the DICOM image that is converted to numerical 3D arrays using readDICOM and create3D. The function stores the original loaded image in RIA_data$orig, while all modified images are stored in RIA_data$modif. By default, the original image RIA_data$orig is untouched by functions other than those operating in load_dicom. While other functions operate on the RIA_data$modif image by default.
Due to memory concerns, there can only be one RIA_data$orig and RIA_data$modif image present at one time in a RIA_image. Therefore, if image manipulations are performed, then the RIA_data$modif will be overwritten. However, functions can save images into new slots of RIA_image, for example discretized images can be saved to the discretized slot of RIA_image.
load_dicom not only loads the DICOM image based on parameters that can be set for readDICOM and create3D, but also can perform minimal manipulations on the image itself.
crop_in logical variable is used to indicate, whether to crop the image to the smallest bounding box still containing all the information. If TRUE, then all X, Y and potentially Z slices containing no information will be removed. This allows significant reduction of necessary memory to store image data.
zero_value parameter is used to indicate HU values which contain no information. If left empty, then the smallest value will be considered as indicating voxels without a signal.
replace_in logical can be used to change values that are considered to have no signal to NA. This is necessary to receive proper statistical values later on.
center_in logical is used to indicate whether the values should be shifted. Some vendors save HU values as positive integers to spare memory and minimalize file sizes. Therefore, in some instances shift of the scale is needed. By default, the values are shifted by -1024, but in other cases a different constant might be required, which can be set using the min_to input.

RIA_header is a list containing the most basic patient and examination information needed for further analysis. The default DICOM set is present in DICOM_codes, which can be edited to anyones needs. But if we wish only to add of remove specific DICOM header rows, then the header_add and header_exclude can be used.

RIA_log is a list of variables, which give an overview of what has been done with the image. If the whole RIA_image is supplied to a function, the information regarding the manipulations are written into the $events array in chronological order. Furthermore, some additional information is also saved in the log, which might be needed for further analysis.

Value

Returns a RIA_image object. RIA_image is a list with three mandatory attributes.

  • RIA_data is a RIA_data object containing the image in $orig slot.

  • RIA_header is a RIA_header object, which is s list of DICOM information.

  • RIA_log is a RIA_log object, which is a list updated by RIA functions and acts as a log and possible input for some functions.

References

Márton KOLOSSVÁRY et al. Radiomic Features Are Superior to Conventional Quantitative Computed Tomographic Metrics to Identify Coronary Plaques With Napkin-Ring Sign Circulation: Cardiovascular Imaging (2017). DOI: 10.1161/circimaging.117.006843 https://pubmed.ncbi.nlm.nih.gov/29233836/

Márton KOLOSSVÁRY et al. Cardiac Computed Tomography Radiomics: A Comprehensive Review on Radiomic Techniques. Journal of Thoracic Imaging (2018). DOI: 10.1097/RTI.0000000000000268 https://pubmed.ncbi.nlm.nih.gov/28346329/

Examples

## Not run: 
 #Image will be croped to smallest bounding box, and smallest values will be changed to NA,
 while 1024 will be substracted from all other data points.
 RIA_image <- load_dicom("/Users/Test/Documents/Radiomics/John_Smith/DICOM_folder/")
 
## End(Not run)
 

RIA documentation built on May 31, 2023, 7 p.m.