plot {espadon}R Documentation

plot a 2D cut of a 3D object

Description

The plot function displays the requested map of espadon objects of class "volume", "struct", "mesh".

Usage

## S3 method for class 'volume'
plot(
  x,
  ...,
  view.type = "trans",
  view.coord = NULL,
  flip = FALSE,
  flop = FALSE,
  cut.interpolate = TRUE,
  display.interpolate = FALSE,
  col = grey.colors(255, start = 0, end = 1),
  breaks = NULL,
  sat.transp = FALSE
)

## S3 method for class 'struct'
plot(
  x,
  ...,
  view.type = "trans",
  view.coord = NULL,
  flip = FALSE,
  flop = FALSE,
  roi.name = NULL,
  roi.sname = NULL,
  roi.idx = NULL,
  back.dxyz = c(0.5, 0.5, x$thickness)
)

## S3 method for class 'mesh'
plot(
  x,
  ...,
  view.type = "trans",
  view.coord = NULL,
  flip = FALSE,
  flop = FALSE,
  col = "#ff0000"
)

Arguments

x

object of class "volume", "struct" or "mesh". See espadon.class

...

others parameters of plot functions. See details

view.type

character string among the values 'ij', 'ji', 'ik', 'ki', 'jk', 'kj', 'yx', 'xz', 'zx', 'yz', 'zy', 'trans', 'front' or 'sagi" representing the map to be displayed.

view.coord

value representing the coordinate where the map is displayed. This parameter can be a 3D-vector, representing the coordinate of the point on the displayed map. If NULL, the display is located in the center of the object.

flip

Boolean defaults to FALSE flipping the horizontal axis of the background image.

flop

Boolean defaults to FALSE flipping the vertical axis of the background image.

cut.interpolate

Boolean, indicating whether to calculate the volume cut using linear interpolation.

display.interpolate

Boolean, indicating whether to apply linear interpolation when displaying the cut.

col

Vector, representing the color palette of the image, if x is of class 'volume'. Color of the mesh outline if object x is of class 'mesh'.

breaks

One of :

  • NULL : the minimum and the maximum value of the object x define the range.

  • Vector giving the breakpoints of each color. Outside values are transparent, leaving the background visible, depending on sat.transp.

sat.transp

Boolean. If TRUE, outside values are transparent, else set to breaks limits colors.

roi.name

Vector of exact names of the RoI in the struct object. By default roi.name = NULL. See Details.

roi.sname

Vector of names or parts of names of the RoI in the struct object. By default roi.sname = NULL. See Details.

roi.idx

Vector of indices of the RoI that belong to the struct object. By default roi.idx = NULL. See Details.

back.dxyz

3D vector of voxel size, used to calculate contours in frontal or sagittal view.

Details

... can be xlim, ylim, add, bg etc. If view.type is egal to 'trans' or 'front' or 'sagi', the direction of xlim and ylim is ignored.

If roi.name, roi.sname, and roi.idx are all set to NULL, all closed planar or point RoI, present at view.coord are selected.

Value

Returns a display of the \(k^{th}\) image plane of x.

See Also

display.plane, display.kplane, display.palette, pal.RVV, pal.rainbow.

Examples

# loading of toy-patient objects (decrease dxyz and increase beam.nb for
# better result)
step <- 5
patient <- toy.load.patient (modality = c("ct","mr", "rtdose", "rtstruct"),
                             dxyz = rep (step, 3), beam.nb = 3)
MR <- patient$mr[[1]]
CT <- patient$ct[[1]]
D <- patient$rtdose[[1]]
S <- patient$rtstruct[[1]]

# display 1
layout (matrix(c(1,1,2,3), ncol=2), widths=c(1,0.2))
plot (CT, view.coord = 0, col = pal.RVV(255))
S_plot <- plot (S, view.coord = 0, add = TRUE, lwd = 2)
display.palette (col = pal.RVV(255), main="HU")
display.legend (S_plot, bg="white", text.col="black", lwd = 2, cex = 1.1)
# display 2
layout (matrix(c (1, 1, 2, 3), ncol = 2), widths = c (1, 0.2))
# Coordinates of the PTV barycenter in CT frame of reference
G <- as.numeric (S$roi.info[S$roi.info$roi.pseudo == "ptv", 
                            c ("Gx", "Gy", "Gz")])
# Coordinates of the PTV baricenter in MR frame of reference
G_MR <- as.numeric (c(G, 1) %*% 
                   t(get.rigid.M(CT$ref.pseudo, MR$ref.pseudo, 
                               T.MAT = patient$T.MAT)))[1:3]
plot (MR, view.type = "sagi", view.coord =  G_MR,
      col = grey.colors (255, start = 0, end = 1),
      breaks = seq (0, 500, length.out = 256) , bg = "darkblue")
plot (vol.in.new.ref(D, MR$ref.pseudo, T.MAT = patient$T.MAT),
      view.type = "sagi", view.coord = G_MR,
      col = pal.rainbow(255), add = TRUE)
display.palette (col = grey.colors (255, start = 0, end = 1),
                 breaks = seq (0, 500, length.out = 256), main="MR")
display.palette (col =  pal.rainbow(255),
                 breaks = seq (D$min.pixel, D$max.pixel, length.out = 256),
                 main="Gy")
layout(1)

[Package espadon version 1.7.2 Index]