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