Learn R Programming

espadon (version 1.11.3)

struct.merge: Merging of structures into a new structure

Description

The struct.merge function merges two structures into a new one. It is useful for comparing contours, for example.

Usage

struct.merge(
  ref.struct,
  add.struct,
  roi.name = NULL,
  roi.sname = NULL,
  roi.idx = NULL,
  suffix = "",
  alias = "",
  description = ""
)

Value

Returns a struct class object. See espadon.class for class definitions.

Arguments

ref.struct

struct class object. All RoI of this structure are kept.

add.struct

struct class object. Only the selected RoI are kept for merging.

roi.name

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

roi.sname

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

roi.idx

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

suffix

Character string. '-suffix' is added to RoI name.

alias

Character string, $alias of the resulted object.

description

Character string, describing the the resulted object.

Details

If roi.name, roi.sname, and roi.idx are all NULL, then all RoI of add.struct are selected.

See Also

struct.from.bin.

Examples

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

# isodose 50% Dmax Gy and 90% Dmax
bin50 <- bin.from.vol (D, min = 0.5 * D$max.pixel)
bin90 <- bin.from.vol (D, min = 0.9 * D$max.pixel)
S.isodose50 <- struct.from.bin (bin50, roi.name = "50pc" , 
                                roi.color = "#00FFFF") 
S.isodose90 <- struct.from.bin (bin90, roi.name = "90pc" , 
                                roi.color = "#FFFF00")
S <- struct.merge (S.isodose50, S.isodose90, alias = "isodose",
                   description = paste ("isodose of", D$object.alias)) 
# Dmax location :
z.dmax <- get.xyz.from.index(which (D$vol3D.data == D$max.pixel), D)[1,3]                 
display.plane(top = D, struct = S, view.coord = z.dmax, legend.shift = -50)                               

Run the code above in your browser using DataLab