spatial_kernel_smooth: Spatial kernel smoothing

Description Usage Arguments Value Author(s) Examples

View source: R/SpatCorrImage.R

Description

Spatial kernel smoothing for images

Usage

1
2
3
4
5
6
7
8
spatial_kernel_smooth(
  img,
  grids = NULL,
  mask = NULL,
  neighbors = NULL,
  radius = 3,
  n_cor = 0.9
)

Arguments

img

an array for image.

grids

a list of grids for each dimension of the image.

mask

an array for mask

neighbors

a list object contains two matrices: idx and dist. idx contains the neighbor indices of each voxel in each row. dist contains the distances between neightbors and the voxel in each row.

radius

a positive number for the size of neighborhood. Only use when neighbors is NULL.

n_cor

a positive correlation value between 0 and 1 to control the smoothness. A lager value generates a smoother image.

Value

Smoothed images with the same dimensions of the raw images.

Author(s)

Jian Kang <jiankang@umich.edu>

Examples

1
2
3
4
5
grids = lapply(1:3,function(i) seq(-29,29,by=2))
dim_img = sapply(1:3,function(i) length(grids[[i]]))
n_voxels = prod(dim_img)
raw_img = array(rnorm(n_voxels),dim=dim_img)
smooth_img = spatial_kernel_smooth(raw_img,grids,n_cor=0.9)

kangjian2016/SpatCorrImage documentation built on Oct. 22, 2021, 1:21 a.m.