Learn R Programming

espadon (version 1.11.3)

display.2D.histo: Display of a 2D histogram

Description

The display.2D.histo function displays the density map of a "histo2D" class object.

Usage

display.2D.histo(
  histo.2D,
  add = TRUE,
  main = NULL,
  x.lab = NULL,
  y.lab = NULL,
  x.lim = NULL,
  y.lim = NULL,
  bg = "#000000",
  i.rng = NULL,
  display.mode = c("mono.color", "rainbow.color", "line"),
  col = "#ffffff",
  alpha = 1,
  line.pc.levels = c(1, 100),
  line.lwd = 2,
  line.lty = 1
)

Value

Returns a display of the density map of histo.2D. This one must be an object of class "histo2D". See espadon.class for class definitions.

Arguments

histo.2D

"histo2D" class object.

add

Boolean indicating whether to display the background image.

main

Title of the background image. If main = NULL, the title indicates "2D histogram".

x.lab

Label of the x-axis of the background image. If x.lab = NULL, this label is histo.2D$x.file.src

y.lab

Label of the y-axis of the background image. If y.lab = NULL, this label is histo.2D$y.file.src.

x.lim

Vector, representing the range of the x-axis.

y.lim

Vector, representing the range of the y-axis.

bg

Background color of the image. By default, this color is black.

i.rng

Vector of 2 elements giving the minimum and the maximum intensity of the image. If i.rng = NULL, then the minimum is 0 and the maximum the maximum density.

display.mode

function display mode. See Details.

col

Color of the color gradient in display.mode = "mono.color", or of the level lines in display.mode = "line". By default, this color is white.

alpha

A number from 0 to 1, indicating the opacity of the image in "rainbow.color" mode. Default alpha = 1.

line.pc.levels

Vector of level lines in percent of maximum density in display.mode = "line". By default lines 1% and 100% are displayed.

line.lwd

Line thickness of the level lines in display.mode = "line".

line.lty

Type of lines for level lines in display.mode = "line".

Details

The display.mode argument can be set to three values: "mono.color", "rainbow.color", or "line". The 2D histogram graph is displayed by default in "mono.color" mode.

  • The "mono.color" mode displays a gradient of the color defined by the col argument, depending on the intensity of $density.map 2-dimensional array.

  • The "rainbow.color" mode makes a display according to the "rainbow" palette, while managing the opacity of the colors.

  • The "line" mode draws level lines defined in percent by the line.pc.levels argument.

See Also

histo.2D.

Examples

Run this code
# loading of toy-patient objects (decrease dxyz for better result)
step <- 4
patient <- toy.load.patient (modality = c("ct", "mr", "rtstruct"), 
                             roi.name =  "brain", 
                             dxyz = rep (step, 3))
CT <- patient$ct[[1]]
MR <- patient$mr[[1]]
S <- patient$rtstruct[[1]]
T.MAT <- patient$T.MAT

# restriction of the volume around the RoI
CT.on.roi <- nesting.roi (CT, S, roi.name = "brain", vol.restrict = TRUE,
                          xyz.margin = c (1, 1, 1), alias = CT$description)
MR.on.CT <- vol.regrid (vol = MR, back.vol = CT.on.roi, interpolate = TRUE,
                        T.MAT = T.MAT, alias = CT$description,
                        description = NULL)
# selection of voxels included in the RoI.
roi.bin <- bin.from.roi (vol = CT.on.roi, struct = S, roi.sname = "brain",
                         verbose = FALSE)
MR.select <- vol.from.bin (MR.on.CT, roi.bin, alias = MR$description)
CT.select <- vol.from.bin (CT.on.roi, roi.bin, alias = CT$description)
# 2D histogram
H2D <- histo.2D (MR.select, CT.select, x.breaks = seq (50, 400, 10),
			  y.breaks = seq (50, 400, 10), alias = "H2D MR1 MR2")
display.2D.histo (H2D, display.mode = "mono.color", col = "#ffff00", 
                  main ="mono color mode")
display.2D.histo (H2D, display.mode = "rainbow.color", main ="rainbow mode")
display.2D.histo (H2D, display.mode = "line", main ="level lines mode",
                  line.pc.levels = c (0, 25, 50, 75, 100), col = "#ff0000")

Run the code above in your browser using DataLab