Learn R Programming

espadon (version 1.11.3)

bin.cuboid: Create a volume containing predefined shapes

Description

These functions create espadon objects of class “volume”, and of modality “binary” or “weight”, by selecting the voxels defining a rectangular cuboid, an elliptical cylinder or an ellipsoid.

Usage

bin.cuboid(
  back.vol,
  side = c(10, 10, 10),
  center = c(0, 0, 0),
  orientation = c(1, 0, 0, 0, 1, 0),
  modality = "weight",
  alias = "",
  description = NULL,
  ...
)

bin.cylinder( back.vol, center, radius, height, orientation = c(1, 0, 0, 0, 1, 0), modality = "weight", alias = "", description = NULL, ... )

bin.ellipsoid( back.vol, center, radius, orientation = c(1, 0, 0, 0, 1, 0), modality = "weight", alias = "", description = NULL, ... )

Value

Returns a "volume" class object of "binary" or "weight" modality (see espadon.class for class definitions), with the same grid as back.vol.

  • In the “binary” modality, voxels with 50 percent of their volume within the requested shape are set to TRUE.

  • In the “weight” modality, the value of each voxel is its volume fraction included in the requested shape.

Arguments

back.vol

"volume" class object.

side

Numerical vector of length 3, representing the length, width and height of the cuboid.

center

Numeric vector of length 3, representing the xyz-center of the shape, in the back.vol frame of reference.

orientation

Numerical vector of length 6, specifying the coordinates of the 2 vectors making up the shape base.

modality

modality ("binary" or "weight") of the generated object.

alias

Character string, $alias of the created object.

description

Character string, describing the created object.

...

Additional arguments.

radius

Positive number, or xy-vector or xyz-vector of 2 or 3 positive numbers, representing the radius of the cylinder or the ellipsoid.

height

Positive number representing the height of the cylinder.

See Also

add.shape

Examples

Run this code
# Creation of back.vol
CT <- vol.create (c(80, 80,40), c(1.2, 1.2, 2), 
                  pt000 = c(-50.4,-50.4,-39), modality = "ct", 
                  default.value = as.integer(-997), value.sd = 1)
                   
# Creation of a cuboid
cuboid <- bin.cuboid(CT, side = c(29.7, 20.0, 20.2), 
                     center = c(-10.9, -20.4, -10.6))
                       
# Creation of a cylinder 
cylinder <- bin.cylinder(CT, center =c(10.3, 15.6, 0.7), 
                         radius =  c(10, 20), height = 50, 
                         orientation = c(0.5150381, 0.7423287, 0.4285837,
                                         -0.8571673, 0.4460361, 0.2575190)) 
                      
# Creation of an ellipsoid 
ellipsoid <- bin.ellipsoid(CT, center = c(-20.1, 0.1, 5), 
                           radius =  c(3.3, 6.2, 5.3))  
                       
 # Display                         
 k.idx <- unique(which(cuboid$vol3D.data>0, arr.ind = TRUE)[,3]) - 1
 display.3D.stack(cuboid, k.idx, border = FALSE,
                  col = c("#FFFFFF00", "#EBDFDFFF", "#D8BFBFFF", "#C59F9FFF", 
                          "#B27F7FFF", "#9F5F5FFF", "#8C3F3FFF", "#791F1FFF", 
                          "#660000FF"))   
                           
 k.idx <- unique(which(cylinder$vol3D.data>0, arr.ind = TRUE)[,3]) - 1
 display.3D.stack(cylinder, k.idx, border = FALSE,
                  col = c("#FFFFFF00", "#DFEBDFFF", "#BFD8BFFF", "#9FC59FFF", 
                          "#7FB27FFF", "#5F9F5FFF", "#3F8C3FFF", "#1F791FFF", 
                          "#006600FF"))    

 k.idx <- unique(which(ellipsoid$vol3D.data>0, arr.ind = TRUE)[,3]) - 1
 display.3D.stack(ellipsoid, k.idx, border = FALSE,
                  col = c("#FFFFFF00", "#DFDFEBFF", "#BFBFD8FF", "#9F9FC5FF", 
                          "#7F7FB2FF", "#5F5F9FFF", "#3F3F8CFF", "#1F1F79FF", 
                          "#000066FF"))                           

Run the code above in your browser using DataLab