err.metrics.from.roi: Error evaluation metrics for 2-volume comparisons

View source: R/err_metrics_from_roi.R

err.metrics.from.roiR Documentation

Error evaluation metrics for 2-volume comparisons

Description

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

Usage

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)

Arguments

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 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.

T.MAT

"t.mat" class object to link the reference frames of obj obj.ref and struct. T.MAT can be created by load.patient.from.Rdcm or load.T.MAT. If T.MAT = NULL, struct$ref.pseudo must be equal to obj$ref.pseudo and obj.ref$ref.pseudo.

bin.list

list of objects of class 'volume' and modality 'binary' or 'weight', giving the selection of voxels in which metrics will be calculated.

Details

If roi.name, roi.sname, and roi.idx are all set to NULL, all RoI whose volume is greater than 0 are selected.

Value

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

Examples

# 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)                             

espadon documentation built on April 11, 2025, 5:57 p.m.