GaussSmoothArray: Spatially smooth an array with Gaussian kernel.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/f.gaussian.spatial.smoothing.functions.R

Description

Applies a stationary Gaussian spatial smoothing kernel to a 3D or 4D array.

Usage

1
2
GaussSmoothArray(x, voxdim=c(1, 1, 1), ksize=5, sigma=diag(3, 3),
                 mask=NULL, var.norm=FALSE)

Arguments

x

The array to be smoothed.

voxdim

The dimensions of the volume elements (voxel) that make up the array.

ksize

The dimensions (in number of voxels) of the 3D discrete smoothing kernel used to smooth the array.

sigma

The covariance matrix of the 3D Gaussian smoothing kernel. This matrix doesn't have to be non-singular; zero on the diagonal of sigma indicate no smoothing in that direction.

mask

A 3D 0-1 mask that delimits where the smoothing occurs.

var.norm

Logical flag indicating whether to normalize the variance of the smoothed array.

Value

The smoothed array is returned.

Author(s)

J. L. Msrchini

See Also

GaussSmoothKernel

Examples

1
2
3
4
5
6
d <- c(10, 10, 10, 20)
mat <- array(rnorm(cumprod(d)[length(d)]), dim = d)
mat[, , 6:10, ] <- mat[, , 6:10, ] + 3
mask <- array(0, dim = d[1:3])
mask[3:8, 3:8, 3:8] <- 1
b <- GaussSmoothArray(mat, mask = mask, voxdim = c(1, 1, 1), ksize = 5, sigma = diag(1, 3))      

Example output

Loading required package: R.matlab
R.matlab v3.6.2 (2018-09-26) successfully loaded. See ?R.matlab for help.

Attaching package: 'R.matlab'

The following objects are masked from 'package:base':

    getOption, isOpen

Loading required package: fastICA
Loading required package: tcltk
Loading required package: tkrplot
Warning messages:
1: no DISPLAY variable so Tk is not available 
2: loading Rplot failed 

AnalyzeFMRI documentation built on Oct. 5, 2021, 5:06 p.m.