#### 1- data.frame ####
## simulate
n <- 10
Y <- rnorm(n^2)
## display
multiplot(object = data.frame(expand.grid(1:n,1:n),1),
contrast = Y, window = FALSE)
## load a MRIaggr object
data(MRIaggr.Pat1_red, package = "MRIaggr")
## select data
data <- selectContrast(MRIaggr.Pat1_red,
param = c("DWI_t0","TTP_t0","MTT_t0","MASK_T2_FLAIR_t2"),
hemisphere = "lesion", coords = TRUE)
## fit model
glm.1 <- glm(MASK_T2_FLAIR_t2 ~ DWI_t0 + TTP_t0 + MTT_t0, data = data,
family = binomial(link = "logit"))
## display fitted values
multiplot(object = data[,c("i","j","k")],
contrast = predict(glm.1, type = "response"), window = FALSE)
## display residuals
multiplot(object = data[,c("i","j","k")], num = 3,
contrast = predict(glm.1, type = "response"), window = FALSE,
index1 = list(coords = data[data$MASK_T2_FLAIR_t2,c("i","j","k")], outline = TRUE)
)
#### 2- carto3D ####
## load NIFTI files and convert them to carto3D
path.Pat1 <- system.file("nifti", package = "MRIaggr")
nifti.Pat1_TTP_t0 <- readMRI(file.path(path.Pat1, "TTP_t0"), format = "nifti")
Carto3D.Pat1_TTP_t0 <- constCarto3D(nifti.Pat1_TTP_t0, identifier = "Pat1", param = "TTP_t0")
## display
multiplot(Carto3D.Pat1_TTP_t0)
## Not run:
# multiplot(Carto3D.Pat1_TTP_t0, num = 1:2)
# multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE)
# multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE, legend = FALSE)
# multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE, legend = FALSE,
# main = "", num.main = FALSE)
# multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE, main = "", num.main = FALSE,
# palette = "gray.colors", breaks = seq(0,100))
# ## End(Not run)
#### 3- MRIaggr ####
## load a MRIaggr object
data(MRIaggr.Pat1_red, package = "MRIaggr")
# display 3 slices
multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
num = 1:3)
## Not run:
# # display 3 slices with no axes and white background
# multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
# num = 1:3, axes = FALSE, bg = "white")
#
# # remove the legend
# multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
# num = 1:3, legend = FALSE)
# ## End(Not run)
## display an set of points
# using a binary parameter stored in the object
multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
num = 1:3, index1 = list(coords = "MASK_DWI_t0")
)
## Not run:
# # customize the display of the points
# multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
# num = 1:3, index1 = list(coords = "MASK_DWI_t0", col = "pink", pch = 14)
# )
#
# # display only the edges of the set
# multiplot(MRIaggr.Pat1_red, param = "DWI_t0", num = 3, legend = FALSE,
# index1 = list(coords = "MASK_DWI_t0", outline = TRUE)
# )
#
#
# # specify the index of points using coordinates
# coordsIndex <- data.frame(i = c(40,60), j = c(80,100), k = c(3,3))
#
# multiplot(MRIaggr.Pat1_red, param = "DWI_t0", num = 3, legend = FALSE,
# index2 = list(coords = coordsIndex, col = "black", pch = 15, cex = 4)
# )
#
# # various possibilities for the display
# multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
# legend = FALSE, window = FALSE)
# multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
# legend = TRUE, window = FALSE)
# multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
# legend = NULL, window = FALSE)
# multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
# legend = "only", window = FALSE)
# ## End(Not run)
Run the code above in your browser using DataLab