Description Usage Arguments Value Examples
This function calculates Local Moments (mean, standard deviation, skew) for an array.
1 2 3 4 | local_moment(image, window = NULL, nvoxels = NULL, moment,
mask = NULL, only.mask = FALSE, center = is.null(mean_image),
invert = FALSE, mean_image = NULL, na.rm = TRUE, remask = TRUE,
...)
|
image |
input image |
window |
window (in width) for the neighborhood |
nvoxels |
window (in voxels) for the neighborhood 1 results in a 3x3 cube |
moment |
vector moments taken (1- mean, 2-sd, 3-skew) |
mask |
array or object of class nifti of same size as image |
only.mask |
Should objects outside the mask (i.e. zeros) be counted the moment? Default is FALSE so edges are weighted to 0 |
center |
vector of indicator of central moment. if TRUE mean image is subtracted. Same length as moment |
invert |
Standardize the values by the power: 1/moment |
mean_image |
mean image to be subtracted. If not supplied, and central = TRUE, local_moment_edge is run with mom = 1 |
na.rm |
remove NAs from the moment image calculation |
remask |
set areas outside of mask to 0 |
... |
Arguments passed to |
List of arrays same lenght as moment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | x = array(rnorm(1000), dim=c(10, 10, 10))
mask = abs(x) < 1
mean.x = local_moment(x, nvoxels=1, moment = 1, mask=mask,
center = FALSE,
remask = FALSE)[[1]]
var.x = local_moment(x, nvoxels=1, moment = 2, mask=mask, center = TRUE,
mean_image = mean.x, remask=FALSE)[[1]]
### check that x[2,2,2] mean is correct
check = x[1:3,1:3,1:3]
## masking
vals = check[abs(check) < 1]
m = mean(vals)
all.equal(m, mean.x[2,2,2])
n = length(vals)
v = var(vals) * (n-1)/n
var.x[2,2,2]
all.equal(v, var.x[2,2,2])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.