MRIaggr-multiplot: Slice by slice display

Description Usage Arguments Details Value See Also Examples

Description

Make a slice by slice display of a data.frame, a Carto3D or a MRIaggr object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## S4 method for signature 'data.frame'
multiplot(object, contrast = NULL, num = NULL, 
         index1 = NULL, index2 = NULL, index3 = NULL,
         col = NULL, pch = NULL ,xlim = NULL, ylim = NULL, filename = "multiplot",...)
		 
## S4 method for signature 'Carto3D'
multiplot(object, num = NULL, 
         col=NULL, pch = NULL, xlim = NULL, ylim = NULL,
         filename = "multiplot",...)

## S4 method for signature 'MRIaggr'
multiplot(object, param, num = NULL,
         index1 = NULL, index2 = NULL, index3 = NULL,
         midplane = FALSE, col = NULL, pch = NULL, xlim = NULL, ylim = NULL,
		 filename = "multiplot", ...)

Arguments

object

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
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
#### 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)

bozenne/MRIaggr documentation built on May 13, 2019, 1:39 a.m.