Learn R Programming

espadon (version 1.11.3)

add.margin: Adding or removing a margin to a volume

Description

The add.margin function adds or subtracts a margin of the rectangular parallelepiped circumscribed by a volume.

Usage

add.margin(vol, xyz.margin, alias = "", description = NULL)

Value

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

for class definitions), in which 3D volume is restricted or increased by the requested margins. If the created volume exceeds the initial volume, new voxels are set to NA.

Arguments

vol

"volume" class object.

xyz.margin

Vector of the 3 positive or negative x, y and z margins in mm, in the frame of reference of volume cutting planes.

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 vol$description

See Also

nesting.cube, nesting.roi and nesting.bin.

Examples

Run this code
# loading of toy-patient objects (decrease dxyz for better result)
step <- 4
patient <- toy.load.patient (modality = "ct", roi.name = "", 
                             dxyz = rep (step, 3))
CT <- patient$ct[[1]]

# Calculation of new volumes decreased by 10 mm in all directions.
new.CT <- add.margin (CT, xyz.margin = c (-10, -10, 10), alias = "new CT")
# display of the CT before and after, in the middle cutting plane
z.mid <- apply (get.extreme.pt (CT), 1, mean)[3]
display.plane (bottom = CT, view.coord = z.mid, bottom.col = pal.RVV(1000),
               bg = "#00ffff", interpolate = FALSE)
display.plane (bottom = new.CT, view.coord = z.mid, bottom.col = pal.RVV(1000),
               bg = "#00ffff", interpolate = FALSE)

Run the code above in your browser using DataLab