
Find Center of Gravity of Image, after thresholding
cog(img, thresh = 0, ceil = FALSE, warn = TRUE)
Vector of length 3
Object of class nifti
threshold for image, will find img > 0
Run ceiling
to force integers (usu for plotting)
Produce a warning if the image is empty after thresholding
dims = rep(20, 3)
x = array(rnorm(prod(dims)), dim = dims)
img = nifti(x, dim= dims,
datatype = convert.datatype()$FLOAT32, cal.min = min(x),
cal.max = max(x), pixdim = rep(1, 4))
cog(img)
Run the code above in your browser using DataLab