plot.ieegio_volume {ieegio} | R Documentation |
Plot '3D' volume in anatomical slices
## S3 method for class 'ieegio_volume'
plot(
x,
position = c(0, 0, 0),
center_position = FALSE,
which = c("coronal", "axial", "sagittal"),
slice_index = 1L,
transform = "vox2ras",
zoom = 1,
pixel_width = max(zoom/2, 1),
crosshair_gap = 4,
crosshair_lty = 2,
col = c("black", "white"),
crosshair_col = "#00FF00A0",
continuous = TRUE,
vlim = NULL,
add = FALSE,
main = "",
axes = FALSE,
background = col[[1]],
foreground = col[[length(col)]],
...,
.xdata = x$data
)
x |
|
position |
cross-hair focused position |
center_position |
whether to center canvas at |
which |
which slice to plot; choices are |
slice_index |
length of 1: if |
transform |
which transform to apply, can be a 4-by-4 matrix,
an integer or name indicating the matrix in |
zoom |
zoom-in level |
pixel_width |
pixel size, ranging from |
crosshair_gap |
the cross-hair gap in milliliter |
crosshair_lty |
the cross-hair line type |
col |
color palette for continuous |
crosshair_col |
the cross-hair color; set to |
continuous |
reserved |
vlim |
the range limit of the data; default is computed from range of
|
add |
whether to add the plot to existing underlay;
default is |
main , ... |
passed to |
axes |
whether to draw axes; default is |
background , foreground |
background and foreground colors; default is
the first and last elements of |
.xdata |
default is |
library(ieegio)
nifti_file <- "brain.demosubject.nii.gz"
# Use `ieegio_sample_data(nifti_file)`
# to download sample data
if( ieegio_sample_data(nifti_file, test = TRUE) ) {
# ---- NIfTI examples ---------------------------------------------
file <- ieegio_sample_data(nifti_file)
# basic read
vol <- read_volume(file)
par(mfrow = c(1, 3), mar = c(0, 0, 3.1, 0))
ras_position <- c(-50, -10, 15)
ras_str <- paste(sprintf("%.0f", ras_position), collapse = ",")
for(which in c("coronal", "axial", "sagittal")) {
plot(x = vol, position = ras_position, crosshair_gap = 10,
crosshair_lty = 2, zoom = 3, which = which,
main = sprintf("%s T1RAS=[%s]", which, ras_str))
}
}