bin.from.roi | R Documentation |
The bin.from.roi
function creates a "volume" class object,
of modality "binary" or "weight", by selecting the voxels defined by the RoI.
bin.from.roi(
vol,
struct,
roi.name = NULL,
roi.sname = NULL,
roi.idx = NULL,
T.MAT = NULL,
within = TRUE,
alias = "",
description = NULL,
modality = c("binary", "weight"),
...
)
vol |
"volume" class object. |
struct |
"struct" class object. |
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, created by
load.patient.from.Rdcm or load.T.MAT. If
|
within |
Boolean, defaults to |
alias |
Character string, |
description |
Character string, describing the created object. If
|
modality |
modality ("binary" or "weight") of the generated object. |
... |
additional argument. |
roi.name
, roi.sname
, and roi.idx
must select
only one RoI.
Returns a "volume" class object of "binary" or "weight" modality (see
espadon.class for class definitions), with the same grid as
vol
.
In the “binary” modality, voxels with 50 percent of their volume within
the ROI are set to TRUE
.
In the “weight” modality, the value of each voxel is its volume fraction included in the ROI.
bin.from.vol.
# loading of toy-patient objects (decrease dxyz for better result)
step <- 5
patient <- toy.load.patient (modality = c("ct", "rtstruct"),
roi.name = c("eye", "optical nerve", "brain"),
dxyz = rep (step, 3))
CT <- patient$ct[[1]]
S <- patient$rtstruct[[1]]
# "optical nerve" binary, with modality "binary" and "weight"
binl <- bin.from.roi (CT, struct = S, roi.sname = "left optical",
alias = "left_optical_nerve", verbose = FALSE,
modality = "binary")
binr <- bin.from.roi (CT, struct = S, roi.sname = "right optical",
alias = "right_optical_nerve", verbose = FALSE,
modality = "weight")
view.coord <- S$roi.info[S$roi.info$roi.pseudo == "leftopticalnerve",]$Gz
palette <- grey.colors(100, start = 0, end = 1,
alpha = c(0, rep(1,99)))
plot(S, view.coord = view.coord, main ="optical nerves")
plot(binl, view.coord = view.coord, col = palette,
cut.interpolate = FALSE, add = TRUE)
plot(binr, view.coord = view.coord, col =palette,
cut.interpolate = FALSE, add = TRUE)
plot(S, view.coord = view.coord, lwd = 2, add= TRUE)
## Not run:
# with a smaller step
step <- 1
patient <- toy.load.patient (modality = c("ct", "rtstruct"),
roi.name = c("eye", "optical nerve", "brain"),
dxyz = rep (step, 3))
CT <- patient$ct[[1]]
S <- patient$rtstruct[[1]]
#' view.coord <- S$roi.info[S$roi.info$roi.pseudo == "leftopticalnerve",]$Gz
# "optical nerve" binary without inclusions management
bin <- bin.from.roi (CT, struct = S, roi.sname = "left optical",
alias = "left_optical_nerve", within = FALSE,
verbose = FALSE)
display.plane (CT, top = bin, struct = S, view.coord = view.coord,
legend.shift = -80, interpolate = FALSE, main = "Left nerve")
# "optical nerve" binary with inclusions management
bin <- bin.from.roi (CT, struct = S, roi.sname = "left optical",
alias = "left_optical_nerve", within = TRUE,
verbose = FALSE)
display.plane (CT, top = bin, struct = S, view.coord = view.coord,
legend.shift = -80, interpolate = FALSE, main = "Left nerve")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.