spatialnoise: Generate spatially correlated noise

View source: R/spatialnoise.R

spatialnoiseR Documentation

Generate spatially correlated noise

Description

Generates a spatially correlated noise dataset with specified dimensions and standard deviation.

Usage

spatialnoise(dim, sigma, nscan, method = c("corr", "gammaRF", "gaussRF"), 
	type=c("gaussian","rician"), rho = 0.75, FWHM = 4, gamma.shape = 6, 
	gamma.rate = 1, vee=1, template, verbose = TRUE)

Arguments

dim

A vector specifying the dimensions of the image.

sigma

The standard deviation of the noise.

nscan

The number of scans in the dataset.

method

Method specifying the type of spatial correlation. Default is "corr".

type

Type of distribution if method=="corr". Default is "gaussian"

rho

If method=="corr", the value of the autocorrelation coefficient.

FWHM

If method=="gammaRF" or method=="gaussRF", the full-width-half-maximum of the Gaussian kernel.

gamma.shape

If method=="gammaRF", the shape parameter of the Gamma distribution.

gamma.rate

If method=="gammaRF", the shape parameter of the Gamma distribution.

vee

If method=="corr" and type=="rician", the non-centrality parameter of the rician distribution.

template

An array representing the anatomical structure or mask with dimensions equal to dim.

verbose

Logical indicating if warnings should be printed.

Details

The function generates spatially correlated noise. When method=="corr", AR(1) voxelwise correlations are introduced. If method=="gaussRF" of method=="gammaRF", respectively a Gaussian Random Field or a Gamma Random Field is created. The result is a noise array with specified dimensions and desired standard deviation. The generation of the random fields is based on the function Sim.3D.GRF from J.L. Marchini in the package AnalyzeFMRI.

Value

An array containing the noise with dimensions specified in dim and nscan.

Author(s)

J. Durnez, B. Moerkerke, M. Welvaert

See Also

temporalnoise, lowfreqdrift, physnoise, tasknoise, systemnoise, Sim.3D.GRF

Examples

d <- c(10,10,10)
sigma <- 5
nscan <- 100
rhospat <- 0.7
out <- spatialnoise(d, sigma, nscan, method="corr", rho=rhospat, verbose=FALSE)


neuRosim documentation built on Oct. 18, 2023, 5:09 p.m.