Last data update: 2014.03.03

R: Display quality criteria for the GR algorithm
plotSigmaGRR Documentation

Display quality criteria for the GR algorithm

Description

Display the quality criteria for various values of sigma using the result of the calcSigmaGR function.

Usage

plotSigmaGR(calcSigmaGR, mar = c(3, 3, 2, 2), mgp = c(2, 0.75, 0), main = "",
     col = c("black", grDevices::rainbow(5)),
     criterion = c("n.obs", "transition", "sdfront", "entropy", "Kalinsky", "Laboure"),
     name_criteria = c("region size", "boundary transition", "boundary heterogeneity", 
                       "region entropy", "region Kalinsky", "region Laboure"), 
     filename = "calcSigmaGR", ...)

Arguments

calcSigmaGR

an object generated by the calcSigmaGR function. REQUIRED.

mar

the number of margin lines to be specified on the four sides of the plot. positive numeric vector of size 4.

mgp

the margin line for the axis title, axis labels and axis line. positive numeric vector of size 3.

main

an overall title for the plot. character.

col

the color to use to plot each criterion. character vector.

criterion

the criterion to be displayed. character vector.

name_criteria

the name to be used in the legend. character vector.

filename

the name of the file used to export the plot. character.

...

additional arguments for the graphical device : window, width, height, path, unit, res (see optionsMRIaggr).

See Also

calcSigmaGR to compute the quality criteria.

Examples

## load an code{MRIaggr} object
data(MRIaggr.Pat1_red, package = "MRIaggr")

calcThresholdMRIaggr(MRIaggr.Pat1_red,param = c("TTP_t0","MTT_t0"), threshold = 1:10,
                     name_newparam = c("TTP.th_t0","MTT.th_t0"),
                     update.object = TRUE, overwrite = TRUE)

## display raw parameter
multiplot(MRIaggr.Pat1_red, param = "TTP.th_t0", num = 3, numeric2logical = TRUE,
          index1 = list(coords = "MASK_DWI_t0", outline = TRUE))

## extract raw parameter, coordinates and compute the neighbourhood matrix
carto <- selectContrast(MRIaggr.Pat1_red, num = 3, hemisphere = "lesion",
                        param = c("TTP.th_t0","TTP_t0","MASK_DWI_t0"))
coords <- selectCoords(MRIaggr.Pat1_red, num = 3, hemisphere = "lesion")
W <- calcW(coords, range = sqrt(2))$W

## the seed is taken to be the point with the largest TTP in the lesion mask
indexN <- which(carto$MASK_DWI_t0 == 1)
seed <- indexN[which.max(carto[indexN,"TTP_t0"])]

## find optimal sigma
resGR_sigma <- calcSigmaGR(contrast = carto$TTP.th_t0, W = W, seed = seed,
                           sigma = seq(1,4,0.1), iter_max = 50,
                           keep.upper = TRUE)

## display quality criteria according to sigma
plotSigmaGR(resGR_sigma)

plotSigmaGR(resGR_sigma, criterion = "entropy")

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/GRalgo-plotSigmaGR.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotSigmaGR
> ### Title: Display quality criteria for the GR algorithm
> ### Aliases: plotSigmaGR
> ### Keywords: functions
> 
> ### ** Examples
> 
> ## load an code{MRIaggr} object
> data(MRIaggr.Pat1_red, package = "MRIaggr")
> 
> calcThresholdMRIaggr(MRIaggr.Pat1_red,param = c("TTP_t0","MTT_t0"), threshold = 1:10,
+                      name_newparam = c("TTP.th_t0","MTT.th_t0"),
+                      update.object = TRUE, overwrite = TRUE)
Step 1 : keep both hemipheres, keep CSF 
Step 2 : thresholding **********
allocContrast[MRIaggr] : Cartographies "TTP.th_t0" "MTT.th_t0" 
                         have been allocated 
> 
> ## display raw parameter
> multiplot(MRIaggr.Pat1_red, param = "TTP.th_t0", num = 3, numeric2logical = TRUE,
+           index1 = list(coords = "MASK_DWI_t0", outline = TRUE))
> 
> ## extract raw parameter, coordinates and compute the neighbourhood matrix
> carto <- selectContrast(MRIaggr.Pat1_red, num = 3, hemisphere = "lesion",
+                         param = c("TTP.th_t0","TTP_t0","MASK_DWI_t0"))
> coords <- selectCoords(MRIaggr.Pat1_red, num = 3, hemisphere = "lesion")
> W <- calcW(coords, range = sqrt(2))$W
> 
> ## the seed is taken to be the point with the largest TTP in the lesion mask
> indexN <- which(carto$MASK_DWI_t0 == 1)
> seed <- indexN[which.max(carto[indexN,"TTP_t0"])]
> 
> ## find optimal sigma
> resGR_sigma <- calcSigmaGR(contrast = carto$TTP.th_t0, W = W, seed = seed,
+                            sigma = seq(1,4,0.1), iter_max = 50,
+                            keep.upper = TRUE)
number of valid seeds : 1 over 1 seeds 
loop over 31 sigma : *************************
> 
> ## display quality criteria according to sigma
> plotSigmaGR(resGR_sigma)
> 
> plotSigmaGR(resGR_sigma, criterion = "entropy")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>