Learn R Programming

espadon (version 1.11.3)

vol.repair: repairing missing planes of volumes

Description

The vol.repair function repairs missing planes in volumes.

Usage

vol.repair(vol, alias = "", description = NULL)

Value

Returns a "volume" class object (see espadon.class

for class definitions), with no missing plane, if vol is to be repaired. Returns vol otherwise.

Arguments

vol

"volume" class object.

alias

Character string, $alias of the created object.

description

Character string, describing the created object. If description = NULL (default value), it will be set to paste (vol$object.alias, "repair").

Details

Missing planes at download can generate errors or unpredictible results in espadon processing. The vol.repair function detects such missing planes and recreates their value by interpolation.

Examples

Run this code
step <- 4
patient <- toy.load.patient (modality = c("ct", "mr", "rtstruct", "rtdose"),
                             roi.name  = "",
                             dxyz = rep (step, 3), beam.nb = 3)
CT <- patient$ct[[1]]

# this function removes a plane in a volume in order to simulate
# a dicom transfer issue
remove.plane <- function (vol, k) {
  idx <- which (vol$k.idx == k)
  vol$n.ijk[3] <- vol$n.ijk[3] - 1
  vol$xyz0 <- vol$xyz0[-idx, ]
  vol$k.idx <- vol$k.idx[-idx]
  vol$missing.k.idx <- TRUE
  vol$vol3D.data <- vol$vol3D.data[, , -idx]
  return (vol)
}

# Creation of CT.damaged without the 29th slice.
CT.damaged<- remove.plane (CT, 29)
CT.fix <- vol.repair (CT.damaged)

# Display 
par (mfrow=c(3, 3))
for (k in 28:30) {
display.kplane (CT, k, main = paste("CT @ k =",k),interpolate = FALSE)
display.kplane (CT.damaged, k, main = "damaged CT",interpolate = FALSE)
display.kplane (CT.fix, k, main = "fixed CT", interpolate = FALSE)
}

Run the code above in your browser using DataLab