View source: R/err_metrics_from_roi.R
| err.metrics.from.roi | R Documentation | 
The err.metrics.from.roi and err.metrics.from.bin
calculate various metrics (ME, MAE, MSE, RMSE) to compare 2 “volume” class
objects in the zones delimited by the requested RoI or binary selections
err.metrics.from.roi(
  obj,
  obj.ref,
  struct = NULL,
  roi.name = NULL,
  roi.sname = NULL,
  roi.idx = NULL,
  T.MAT = NULL
)
err.metrics.from.bin(obj, obj.ref, bin.list = NULL, T.MAT)
| obj | "volume" class object to be compared. | 
| obj.ref | "volume" class reference object. | 
| struct | "struct" class object or NULL. | 
| roi.name | Vector of exact names of the RoI in the  | 
| roi.sname | Vector of names or parts of names of the RoI in the  | 
| roi.idx | Vector of indices of the RoI that belong to the  | 
| T.MAT | "t.mat" class object to link the reference frames of  | 
| bin.list | list of objects of class 'volume' and modality 'binary' or 'weight', giving the selection of voxels in which metrics will be calculated. | 
If roi.name, roi.sname, and roi.idx are
all set to NULL, all RoI whose volume is greater than 0 are selected.
Returns, in the zones delimited by the requested RoI, the following metrics:
ME: Mean Error
MAE: Mean Absolute Error
MSE: Mean Squared Error
RMSE: Root Mean Squared Error
MIN: Min Error
MAX: Max Error
# loading of toy-patient objects (decrease dxyz)
step <- 5
patient <- toy.load.patient (modality = c("ct", "sct","rtstruct"), 
                             roi.name = c("eye", "brain","gizzard"),
                             dxyz = rep (step, 3))
patient$ct[[1]]$description
patient$ct[[2]]$description
# Calculation of eye zone and ptv metrics
err.metrics.from.roi(obj = patient$ct[[2]], obj.ref = patient$ct[[1]], 
                     struct = patient$rtstruct[[1]], roi.sname = c("eye","ptv"),
                     T.MAT= patient$T.MAT)
# Calculation of metrics on delimited zones on all RoIs
err.metrics.from.roi(obj = patient$ct[[2]], obj.ref = patient$ct[[1]], 
                     struct = patient$rtstruct[[1]],
                     T.MAT= patient$T.MAT)
                     
# Calculation on all volume
err.metrics.from.roi(obj = patient$ct[[2]], obj.ref = patient$ct[[1]], 
                     T.MAT= patient$T.MAT)
 
# Calculation using err.metrics.from.bin. The binary selection must first be 
# created.  
roi.idx <- select.names(patient$rtstruct[[1]]$roi.info$roi.pseudo,
                        roi.sname = c("eye","ptv"))  
bin.ROI <- lapply (roi.idx, function(idx){
   bin.from.roi (patient$ct[[1]], struct = patient$rtstruct[[1]], 
                 roi.idx = idx, T.MAT = patient$T.MAT, 
                 alias = patient$rtstruct[[1]]$roi.info$roi.pseudo[idx], 
                 description = patient$rtstruct[[1]]$roi.info$name[idx],
                 modality = "weight")})   
 names (bin.ROI) <-patient$rtstruct[[1]]$roi.info$name[roi.idx]   
 
 err.metrics.from.bin (obj = patient$ct[[2]], obj.ref = patient$ct[[1]], 
                       bin.list = bin.ROI, T.MAT= patient$T.MAT)                             
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.