How to create isodose rtstruct from an rtdose?

How to create isodose rtstruct from an rtdose?

We suppose that D is a espadon object of class volume and modality rtdose. We suppose that the reference dose is Ref.dose grays. The following instructions create an espadon object of class struct, defining isodoses at several percent of Ref.dose.

# Isodose reference value
Ref.dose  <-D$max.pixel

# Percentage of max dose value
pc <- c (0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.85,0.9,0.95,1,1.05,1.10,1.2,2)

# Creation of isodose colors
pc.col <- c ("#000000","#0033CC","#00CCFF","#33CCCC","#006600","#33FF00","#99FF99",
             "#FFFF33","#FFCC33","#FF9966","#FF0000","#CC6600","#FF99FF","#CC3366",
             "#9900FF")

# Create isodose structure
S.isodose <- NULL
for (idx in 1:length (pc)){
  bin <- bin.from.vol (D, min = Ref.dose*pc[idx])
  S.isodose <- struct.merge (S.isodose, 
                             struct.from.bin (bin, 
                                              roi.name = paste0 (pc[idx]*100,"%"), 
                                              roi.color = pc.col[idx], 
                                              roi.nb = idx),
                             alias = "isodose",
                             description = paste ("isodoses of",D$object.alias))
}

# Result
S.isodose$roi.info
display.plane (top=D, struct=S.isodose, legend.shift = -50)