vol.subsampling {espadon} | R Documentation |
Subsampling a volume
Description
The vol.subsampling
function sub-samples the grid of a "volume" class
object.
Usage
vol.subsampling(
vol,
fact.ijk = 2,
interpolate = TRUE,
method = c("NN", "Av"),
alias = "",
description = NULL
)
Arguments
vol |
"volume" class object. |
fact.ijk |
Strictly positive integer, or a vector of 3 strictly positive integers. |
interpolate |
Boolean, default to |
method |
method of interpolation, defaulted to 'NN' ie 'Nearest Neighbor'. See Details. |
alias |
Character string, |
description |
Character string, describing the the created object.
If |
Details
The interpolation method is chosen from:
-
'NN'
: the value of a voxel is calculated from its nearest adajcent neighbors. -
'Av'
: the value of a voxel is the weighted average of the voxels contained in a box, whose sides are automatically calculated from theback.bol$dxyz
steps.
Value
Returns a "volume" class object, in which 3D volume grid is
subsampled: the voxel size is multiplied by fact.ijk
and the center location
of the volume is invariant.
See Also
Examples
vol <- vol.create(n.ijk = c(10,10,1),dxyz = c(2,2,2), ref.pseudo = "ref1",
modality ="test", pt000 = c(0,0,0))
vol$vol3D.data[] <- array(1:prod(vol$n.ijk), dim = vol$n.ijk)
vol$max.pixel <- prod(vol$n.ijk)
vol$min.pixel <- 1
mid <- as.numeric (apply (get.extreme.pt (vol), 1, mean))
vol_ss <- vol.subsampling (vol, fact.ijk= 2)
mid_ss <- as.numeric (apply (get.extreme.pt (vol_ss), 1, mean))
display.plane(vol,interpolate = FALSE, view.coord = mid[3],
abs.rng = c(-5,25), ord.rng = c(-5,25), bg="green")
points (mid[1], mid[2], pch=16, col="red")
display.plane(vol_ss,interpolate = FALSE, view.coord = mid_ss[3],
abs.rng = c(-5,25), ord.rng = c(-5,25), bg="green")
points (mid_ss[1], mid_ss[2], pch=16, col="red")