## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(dicomtk) library(ggplot2) dcm_file <- system.file("extdata", "example.dcm", package = "dicomtk") ## ----pixels------------------------------------------------------------------- px <- read_dicom_pixels(dcm_file) dim(px) # Apply clinical window presets ("auto", "brain", "stroke", "subdural", # "lung", "mediastinum", "abdomen", "liver", "bone", "angio") win_brain <- dicom_window(px, preset = "brain") range(win_brain) ## ----ggplot-render, fig.width = 5, fig.height = 5----------------------------- plot_dicom(dcm_file, window = "auto", palette = "gray", title = "Radiological Grayscale") # Add custom ggplot2 annotations on top of ggdicom() ggdicom(dcm_file, palette = "inferno", annotate = FALSE) + labs(title = "Inferno Colormap with Custom ggplot2 Layer") ## ----volume-render, fig.width = 7, fig.height = 3----------------------------- series <- read_dicom_series(c(dcm_file, dcm_file, dcm_file)) series # 3-Plane Orthogonal MPR render_volume(series, method = "mpr") # 3-Plane Maximum Intensity Projection (MIP) render_volume(series, method = "mip", palette = "viridis") .