add.margin {espadon}R Documentation

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)

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 cut 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

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.

See Also

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

Examples

# 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 plane
z.mid <- apply (get.extreme.pt (CT), 1, mean)[3]
display.plane (bottom = CT, view.coord = z.mid, bottom.col = pal.RVV(1000),
               bottom.breaks = seq(-1000, 1000, length.out = 1001),
               bg = "#00ffff", interpolate = FALSE)
display.plane (bottom = new.CT, view.coord = z.mid, bottom.col = pal.RVV(1000),
               bottom.breaks = seq(-1000, 1000, length.out = 1001),
               bg = "#00ffff", interpolate = FALSE)


[Package espadon version 1.2.0 Index]