Learn R Programming

espadon (version 1.11.3)

fan.to.voxel: Indices of voxels crossed by a fan

Description

The fan.to.voxel function computes the indices of voxels crossed by a fan. It is useful for retrieving voxel values and voxel indices of a volume (dose or ct) along the fan rays.

Usage

fan.to.voxel(vol, fan, restrict = FALSE, vol.value = 1)

Value

Returns a dataframe of 4 columns. Each line gives:

  • column "ray.index": the index (i.e. the row number) of the ray concerned in fan$dxyz,

  • column "vol.index": the index of the voxel crossed in vol$vol.3Ddata,

  • column "l.in": the distance between fan source (i.e. fan$origin) and the first face of the voxel crossed by the ray,

  • column "dl": the distance crossed by the ray in the voxel.

If the rays do not cross any voxel, the dataframe has no row.

Arguments

vol

"volume" class object.

fan

"fan" class object created by fan.sphere for example.

restrict

Boolean. If TRUE, only the voxels with a value equal to vol.value are taken into account.

vol.value

Value of the voxels taken into account, in case of restrict = TRUE

See Also

fan.beam, fan.planar, fan.sphere.

Examples

Run this code
vol <- vol.create (pt000 = c(1,10,10), dxyz = c (1 , 1, 1),
                   n.ijk = c(100, 100, 100)) 
fan.origin <- c (50,50,50)                         
fan <- fan.sphere (angle = 10, origin = fan.origin)
fan.voxel <- fan.to.voxel (vol = vol, fan = fan)
head (fan.voxel)

# Use of the 2nd column of fan.voxel to select voxels 
bin <- vol.copy (vol, modality = "binary")
bin$vol3D.data[] <- FALSE
bin$vol3D.data[fan.voxel[,2]] <- TRUE
bin$max.pixel <- TRUE
bin$min.pixel <- FALSE
display.kplane(bin, k=10)

Run the code above in your browser using DataLab