an object of class MRIaggr, or a Carto3D, or a 2 or 3 column data.frame containing the coordinates of the observations in columns. REQUIRED.
param
the contrast parameter to display. character. REQUIRED.
contrast
the intensities to display. numerical vector or NULL leading to use the same color for all observations.
num
the slices to display. numeric vector or NULL.
index1,index2,index3
the coordinates of additionnal points to display. data.frame or list or NULL.
midplane
should the mid-sagittal plan be displayed ? logical.
col
the color with which the observations will be displayed. character vector or NULL leading to determine the colors using the palette and breaks arguments.
pch
the symbol with which the observations will be displayed. positive integer or NULL leading to use the image function instead of plot.
xlim
the x limits of the plot. numeric vector of size 2 or NULL leading to automatic setting of the x limits.
ylim
the y limits of the plot. numeric vector of size 2 or NULL leading to automatic setting of the y limits.
filename
the name of the file used to export the plot. character.
...
additional arguments to be passed to optionsMRIaggr for specifying the graphical parameters.
Details
ARGUMENTS:
Information about the num argument can be found in the details section of initNum.
Information about the index1, index2 and index3 arguments can be found in the details section of initIndex (argument index).
Information about the ... can be found in the documentation of the optionsMRIaggr function.
Value
Invisible, return a list containing :
breaks.plot
the breaks used to display the images.
palette.plot
the palette used to display the images.
breaks.legend
the breaks used to display the legend. character.
palette.legend
the palette used to display the legend. character.
quantiles.legend
the quantiles used to display the legend. character.
See Also
plotLesion3D for a 3D plot of the lesion. slices3d of the misc3d package for a more interactive 3D plot.
Examples
#### 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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MRIaggr)
Loading required package: Rcpp
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MRIaggr/MRIaggr-multiplot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: multiplot
> ### Title: Slice by slice display
> ### Aliases: multiplot multiplot,data.frame-method multiplot,Carto3D-method
> ### multiplot,MRIaggr-method
> ### Keywords: methods
>
> ### ** Examples
>
> #### 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:
> ##D multiplot(Carto3D.Pat1_TTP_t0, num = 1:2)
> ##D multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE)
> ##D multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE, legend = FALSE)
> ##D multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE, legend = FALSE,
> ##D main = "", num.main = FALSE)
> ##D multiplot(Carto3D.Pat1_TTP_t0, num = 1:2, axes = FALSE, main = "", num.main = FALSE,
> ##D 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:
> ##D # display 3 slices with no axes and white background
> ##D multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
> ##D num = 1:3, axes = FALSE, bg = "white")
> ##D
> ##D # remove the legend
> ##D multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
> ##D 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:
> ##D # customize the display of the points
> ##D multiplot(MRIaggr.Pat1_red, param = "DWI_t0",
> ##D num = 1:3, index1 = list(coords = "MASK_DWI_t0", col = "pink", pch = 14)
> ##D )
> ##D
> ##D # display only the edges of the set
> ##D multiplot(MRIaggr.Pat1_red, param = "DWI_t0", num = 3, legend = FALSE,
> ##D index1 = list(coords = "MASK_DWI_t0", outline = TRUE)
> ##D )
> ##D
> ##D
> ##D # specify the index of points using coordinates
> ##D coordsIndex <- data.frame(i = c(40,60), j = c(80,100), k = c(3,3))
> ##D
> ##D multiplot(MRIaggr.Pat1_red, param = "DWI_t0", num = 3, legend = FALSE,
> ##D index2 = list(coords = coordsIndex, col = "black", pch = 15, cex = 4)
> ##D )
> ##D
> ##D # various possibilities for the display
> ##D multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
> ##D legend = FALSE, window = FALSE)
> ##D multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
> ##D legend = TRUE, window = FALSE)
> ##D multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
> ##D legend = NULL, window = FALSE)
> ##D multiplot(MRIaggr.Pat1_red, num = 1:3, param = "DWI_t0",
> ##D legend = "only", window = FALSE)
> ##D
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>